Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Simple HelloServlet not working

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
I am reposting this because my previous post had too many replies, I think this was discouraging people.

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/hello/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
"Internal Server Error
The server encountered an internal error (Internal Server Error) that
prevented it from fulfilling this request"
..and so on


I have been following the SAMS Teach yourself EJB book.


Further, I have also tried putting my files in jboss/catalina/webapps
The structure is as


webapps/helloapp/welcome.html
webapps/helloapp/META-INF
webapps/helloapp/WEB-INF/web.xml
webapps/helloapp/WEB-INF/classes/hello/HelloServlet.class


At the browser, I do
http://localhost:8080/helloapp/HelloServlet and get


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


Please help. Thanks, DG
 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Try looking into DD (web.xml), you must be missing URL mapping of this servlet. It should conform to the address you are typing in the browser.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Duplicate of:
https://coderanch.com/t/364283/Servlets/java/Servlet-Not-working

Please do not post the same question more than once.
If you got responses the first time, follow up on them.
Ignoring them and posting again is just a waste of everyone's time.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic