aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Cant find servlet in J2EE Server.help! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Cant find servlet in J2EE Server.help!" Watch "Cant find servlet in J2EE Server.help!" New topic
Author

Cant find servlet in J2EE Server.help!

David Mathew
Greenhorn

Joined: Oct 25, 2003
Posts: 10
I want to run my web application having a .html ,servlet and a session bean (a bonus example at java.sun.com).I have created .ear,.war and .jar files using the deployTool wizard of j2eesdk1.4_beta2 then i varified it and finally deploy my application using Tools-->Deploy option of deployTool.
Then I open explorer and type http://localhost:4848/MyRoot/MyHtml.html.
The html is displayed right but when i enter the values in the fields of html form and submit the form (where i have mentioned to call a servlet)a 404 error occur stating that /MyRoot/MyServlet no found.
I have counter checked my html/servlet mapping in html file and also recreate a new application to do it but the problem persist.
I have followed the instruction given in the example but ant find the problem and also I can not find public_html folder in j2eesdk1.4_beta2 root.
I am running application using the default server provided in j2eesdk1.4
Plz help me soon as I am in hurry.
any help will be highly appreciated.
Bye.
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
What have you defined as a url-mapping for MyServlet in web.xml?


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
David Mathew
Greenhorn

Joined: Oct 25, 2003
Posts: 10
i haven't defined anything there.Infact it was not recommended in tutorial and if u think that the problem is occuring due to this then plz tell me in a bit detail that where i can find web.xm in j2eesdk1.4 and wat have to be defined in url mapping for servlet there? and whether i have too do anything more to run my web application or not(mean any additional info to be guven for application to run).
Plz tell me the declarations in web.xml or any other document neccessry to run my web app.cause it is my first web application with ejb component.
Thankyou for ur help.
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Here's an example web.xml which defines one servlet and the corresponding url-mapping for the same.
If you want to do the mapping using deploytool, the J2EE Tutorial (1.4) has a section titled "Mapping URLs to Web Components".
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Oh, forgot to mention that the example mapping, "/MyServlet", means that your HTML hrefs should point to "<server>:<port>/<application>/MyServlet" (the url-mapping element is specified relative to the application's root, not the web server's root).
David Mathew
Greenhorn

Joined: Oct 25, 2003
Posts: 10
hi friend...
why should i use url-mapping? i do not want to define any alias for my servlet.Also the web.xml file is made automaticlly by the deployment tool so that i have to do nothing more.Therefore its difficult to find the problem.
can anyone help me asap.
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
If you don't define a mapping, the servlet can probably be accessed using a URL similar to "/servlet/your.package.MyServlet".
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Cant find servlet in J2EE Server.help!
 
Similar Threads
Application server
Sun Java System Application Server Platform Edition 8.0
How do i convert a swing application to a web application
Websphere 3.5
Servlet