This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JBoss/WildFly and the fly likes Problem With JBoss In Action Example Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Problem With JBoss In Action Example" Watch "Problem With JBoss In Action Example" New topic
Author

Problem With JBoss In Action Example

Preston Thornton
Ranch Hand

Joined: Jun 24, 2008
Posts: 80
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

Joined: Jun 24, 2008
Posts: 80
<< 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

Joined: Jun 24, 2008
Posts: 80
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.



[Thumbnail for JBossPage1.jpg]

Preston Thornton
Ranch Hand

Joined: Jun 24, 2008
Posts: 80
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

Joined: Jun 24, 2008
Posts: 80
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

Joined: May 14, 2008
Posts: 5812
    
    7

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


JBoss In Action
Preston Thornton
Ranch Hand

Joined: Jun 24, 2008
Posts: 80
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem With JBoss In Action Example
 
Similar Threads
HF: JSP & Servlets, compiling on Windows
HF: JSP & Servlets (Can't compile my first class on Windows)
Software requirements??
Compiling a Servlet
Problems compiling packages #2 with JSP