Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2007

Tip: Looking for answers? Try searching our database.

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

Thread view: 
dami.gupta@gmail.com - 03 Apr 2007 04:49 GMT
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
vishist - 03 Apr 2007 05:53 GMT
On Apr 2, 11:49 pm, dami.gu...@gmail.com wrote:
> Hello,
> This is a newbie question. Any help would be MUCH appreciated.
[quoted text clipped - 22 lines]
> <servlet-name>HelloServlet</servlet-name>
> <url-pattern>/HelloServlet/*</url-pattern>

Try THIS
  <url-pattern>/HelloServlet</url-pattern>

> </servlet-mapping>
> <welcome-file-list>
[quoted text clipped - 16 lines]
>
> Please help. Thanks, DG
Danno - 03 Apr 2007 05:59 GMT
On Apr 2, 9:49 pm, dami.gu...@gmail.com wrote:
> Hello,
> This is a newbie question. Any help would be MUCH appreciated.
[quoted text clipped - 6 lines]
> 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
dami.gupta@gmail.com - 03 Apr 2007 07:00 GMT
> On Apr 2, 9:49 pm, dami.gu...@gmail.com wrote:
>
[quoted text clipped - 15 lines]
> 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?
dami.gupta@gmail.com - 03 Apr 2007 07:36 GMT
On Apr 3, 11:00 am, dami.gu...@gmail.com wrote:

> > On Apr 2, 9:49 pm, dami.gu...@gmail.com wrote:
>
[quoted text clipped - 25 lines]
>
> - 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?
Lew - 03 Apr 2007 12:54 GMT
> OK, I have tried some different things. I put HelloServlet.jar in the
> package hello so it is now hello.HelloServlet. I do
[quoted text clipped - 7 lines]
> 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
[quoted text clipped - 5 lines]
>
> 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>

Signature

Lew



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.