Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem With JBoss In Action Example

 
Preston Thornton
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, all

I searched the archives for a solution to my problem to no success. I am trying to deploy the HelloWorld application used in the JBoss In Action book, but I am encountering a few issues has seen here.

Using Windows XP I had to modify the example with back spaces


hmm . . . help! please!

Preston.
 
Preston Thornton
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<< WINDOWS XP or 7 USERS . . . >>

Oh, I got it! I just needed some lunch and some music (Aaliyah - Are You The Somebody). I was missing comma in the java file (throws ServletException, IOException{ ):



The class file is now created. The deployment descriptor is as follows



To recap the source of trouble was that the "servlet-api.jar" was not found in the JBOSS server/default directory. I had to copy it from the the java jre directory. What I forgot to do will restart the AS for only the deploy directory is dynamics and detect changes as files are placed in that directory.

The final results . . .

C:\JBoss5>javac -classpath C:\JBoss5\server\default\lib\servlet-api.jar -d C:\JBoss5\helloWorldBuild\helloapp.war\WEB-INF\classes <<It's a space here>> C:\JBoss5\helloWorldBuild\src\com\manning\jbia\intro\*

Remember: javac (options) (Source Files)

So just remember, throw on some 50 Cent "In Da Club," and rock your head back and forward . . . you'll get it.


Preston @ Large
Detroit
 
Preston Thornton
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay, one problem down, one to go . . . I hope. I am now see the following error:





Here, I have just copy or exploded directory to the server/default/deploy directory



Here is the site page:



I did restart the AS to confirm the issue. So . . . any thoughts would help.

Thanks.
JBossPage1.jpg
[Thumbnail for JBossPage1.jpg]
Site Page
 
Preston Thornton
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay, I found the problem the last issue.




Peter Johnson (Author)
webpage


1. Jan 7, 2010 11:09 AM (in response to marco scagliola)
Correct AnswerRe: WARNING [config] unable to process deployment descriptor for context /xxx
I am not sure that I follow your file hierachy diagram, but it looks as if you have the web.xml located at WEB-IFN/classes/web.xml - it should be at WEB-INF/web.xml.

P.S. - it would have been better if you ran "jar -tf Helloapp.war" (assuming you hvae a WAR file, and not an exploded diectory) and posted the response.



Now looking at the web site: http://localhost:8080/helloapp/sayhello


HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Error instantiating servlet class com.manning.jbia.HelloWorldServlet
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
java.lang.Thread.run(Thread.java:619)
root cause

java.lang.ClassNotFoundException: com.manning.jbia.HelloWorldServlet
java.net.URLClassLoader$1.run(URLClassLoader.java:200)
java.security.AccessController.doPrivileged(Native Method)
java.net.URLClassLoader.findClass(URLClassLoader.java:188)
java.lang.ClassLoader.loadClass(ClassLoader.java:307)
java.lang.ClassLoader.loadClass(ClassLoader.java:252)
org.jboss.web.tomcat.service.TomcatInjectionContainer.newInstance(TomcatInjectionContainer.java:262)
org.jboss.web.tomcat.service.TomcatInjectionContainer.newInstance(TomcatInjectionContainer.java:256)
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
java.lang.Thread.run(Thread.java:619)
note The full stack trace of the root cause is available in the JBoss Web/2.1.3.GA logs.



Now this is interesting . . .

javax.servlet.ServletException: Error instantiating servlet class com.manning.jbia.HelloWorldServlet

Looking back at the javac command:



Wow! The last directory "intro," is being cut off - Error instantiating servlet class com.manning.jbia.<<?? intro ??>>HelloWorldServlet

Okay, that is a problem.



 
Preston Thornton
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay, when in doubt . . . check the author's site and use the source code provided. Go figure.

HelloWorldServlet.java


Web.xml






Preston@Large
Detroit
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As I pointed out in response to your question on the book's web site, your javac command isn't going to work because the files will be in the wrong location. And the WAR directory will be missing the web.xml file. You need to make sure that when you are done that the WAR file contains these two files (assuming you use the same class and package names as in the book):

WEB-INF/web.xml
WEB-INF/classes/com/manning/jbia/HelloWorldServlet.class
 
Preston Thornton
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey! Peter!

Thank you!

As you can see, I have been running across sites looking for the solution to the problem(s). And yes, you are correct. I did see my mistake from the other site. Tell the editer at Manning that the image in the book is way too small for old people like me. (That's my excuse and I'm sticking to it!)

I did sign up at the book site and did note the update and errata information. I have to fly through this book fast! I hope to be done by the end of next week. I will try to find the bread crumb trail at the various site first. Thanks again for this great post.



Preston@Large
Detroit
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic