URGENT: javax.servlet.ServletException: Wrapper cannot find servlet

D

dami.gupta

Hello,
This is a newbie question. Any help would be MUCH appreciated.

I am using JBoss. My servlet, HelloServlet, prints a simple Hello
statement. I create a hello.war file with files

welcome.html
META-INF/Manifest.mf
WEB-INF/web.xml
WEB-INF/classes/HelloServlet.class


web.xml is as -

<?xml version="1.0"?>

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web
Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd" >

<web-app>
<servlet>
<servlet-name>HelloServlet</servlet-name>
<servlet-class>hello.HelloServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>HelloServlet</servlet-name>
<url-pattern>/HelloServlet/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>welcome.html</welcome-file>
</welcome-file-list>
</web-app>

I place the hello.war in the jboss/server/default/deploy directory.
JBoss starts up fine saying that the war file has been deployed.
In my browser, I type
http://localhost:8080/hello/welcome.html
This works fine.

However when I do
http://localhost:8080/hello/HelloServlet

I get
"javax.servlet.ServletException: Wrapper cannot find servlet class
hello.HelloServlet or a class it depends on"
and so on.
I have been following the SAMS Teach yourself EJB book.

Please help. Thanks, DG
 
V

vishist

Hello,
This is a newbie question. Any help would be MUCH appreciated.

I am using JBoss. My servlet, HelloServlet, prints a simple Hello
statement. I create a hello.war file with files

welcome.html
META-INF/Manifest.mf
WEB-INF/web.xml
WEB-INF/classes/HelloServlet.class

web.xml is as -

<?xml version="1.0"?>

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web
Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd" >

<web-app>
<servlet>
<servlet-name>HelloServlet</servlet-name>
<servlet-class>hello.HelloServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>HelloServlet</servlet-name>
<url-pattern>/HelloServlet/*</url-pattern>


Try THIS
 
D

Danno

Hello,
This is a newbie question. Any help would be MUCH appreciated.

I am using JBoss. My servlet, HelloServlet, prints a simple Hello
statement. I create a hello.war file with files

welcome.html
META-INF/Manifest.mf
WEB-INF/web.xml
WEB-INF/classes/HelloServlet.class

also your war file should look like this, note the hello directory...

welcome.html
META-INF/Manifest.mf
WEB-INF/web.xml
WEB-INF/classes/hello/HelloServlet.class
 
D

dami.gupta

also your war file should look like this, note the hello directory...

welcome.html
META-INF/Manifest.mf
WEB-INF/web.xml
WEB-INF/classes/hello/HelloServlet.class

Thanks , all of you , a lot.

I tried it.. the error I get now is
The requested service (Servlet HelloServlet is currently unavailable)
is not currently available.

any help?
 
D

dami.gupta

Thanks , all of you , a lot.

I tried it.. the error I get now is
The requested service (Servlet HelloServlet is currently unavailable)
is not currently available.

any help?- Hide quoted text -

- Show quoted text -


OK, I have tried some different things. I put HelloServlet.jar in the
package hello so it is now hello.HelloServlet. I do
http://localhost:8080/servlets/hello/HelloServlet
and get
The requested resource (/hello/HelloServlet) is not available.

Next, I use
jboss/catalina/webapps/servlets/helloapp and place
helloapp/META-INF
helloapp/WEB-INF/web.xml
helloapp/WEB-INF/classes/hello/HelloServlet.class
and do
http://localhost:8080/servlets/hello/HelloServlet
Now I get

No Context configured to process this request
server encountered an internal error (No Context configured to process
this request) that prevented it from fulfilling this request.

Oh dear, what Can I do?
 
L

Lew

OK, I have tried some different things. I put HelloServlet.jar in the
package hello so it is now hello.HelloServlet. I do
http://localhost:8080/servlets/hello/HelloServlet
and get
The requested resource (/hello/HelloServlet) is not available.

Next, I use
jboss/catalina/webapps/servlets/helloapp and place
helloapp/META-INF
helloapp/WEB-INF/web.xml
helloapp/WEB-INF/classes/hello/HelloServlet.class

Is your app called "helloapp" or "hello"?

Paths in the WAR should be relative, that is, the app directory should not be
there.

I'm going to assume "helloapp.war" deployed to Tomcat, thus creating a
"webapps/helloapp/" directory.
and do
http://localhost:8080/servlets/hello/HelloServlet
Now I get

No Context configured to process this request
server encountered an internal error (No Context configured to process
this request) that prevented it from fulfilling this request.

Oh dear, what Can I do?

You need to deploy "helloapp.war" to Tomcat's "webapps/" directory and let
Tomcat create the "helloapp/" directory there.

Inside Tomcat's "webapps/helloapp/WEB-INF/" directory there is a file
web.xml:
--------
<web-app>
<servlet>
<servlet-name>HelloServlet</servlet-name>
<servlet-class>hello.HelloServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>HelloServlet</servlet-name>
<url-pattern>/HelloServlet</url-pattern>
</servlet-mapping>
</web-app>

Notice, no "/*" at the end of the servlet-mapping url-pattern.

location of servlet class within "webapps/helloapp/":
--------
WEB-INF/classes/hello/HelloServlet.class


invocation from the browser:

http://localhost:8080/helloapp/HelloServlet

Tomcat's web page has some good stuff about this.
<http://tomcat.apache.org/tomcat-5.5-doc/appdev/deployment.html>

Their docs talk about using their Deployer, which I never use.

The Sun Java EE tutorial is also good. Try
<http://java.sun.com/javaee/5/docs/tutorial/doc/WebApp4.html#wp189052>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top