Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1092
  • Last Modified:

Need a very simple .war file (java servlet)

Hi,

I need a very simple .war file (java servlet) that I will be able to upload to my server.
It's not important what it does, even printing "hello world" is good enough.
P.S.  I read some instructions on how to create one, but it didn't work... so all I need is a simple ready file. From that point I'll manage.

Thanks,
0
slavikn
Asked:
slavikn
4 Solutions
 
girionisCommented:
Hi slavikn

the simplest you can find: http://access1.sun.com/techarticles/simple.WAR.html

Cheers
0
 
Tomas Helgi JohannssonCommented:
  Hi!
What IDE environment do you use ?
I recommend NetBeans http://www.netbeans.org 
This environment creates war file for you automatically.

Regards,
  Tomas Helgi
0
Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

 
Mayank SAssociate Director - Product EngineeringCommented:
0
 
slaviknAuthor Commented:
I created a .war file, run it on the server, but it still doesn't seem to work:
http://www.organizermp3.com/servlet/hello
Any clues?
0
 
Mayank SAssociate Director - Product EngineeringCommented:
What does your web.xml look like? What is the URL pattern of the servlet? If its /hello and the context-root is /, then use http://url:port/hello

Which server/ version are you using? Tomcat used to support /servlet for directly loading servlets (it was mostly used in testing) but I guess Tomcat 5 has removed that feature so you need to use the correct URL pattern for the servlet.
0
 
slaviknAuthor Commented:
web.xml:

<web-app xmlns="http://java.sun.com/xml/ns/j2ee" version="2.4"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http:/java.sun.com/dtd/web-app_2_3.dtd">
  <servlet>
    <servlet-name>hello</servlet-name>
    <servlet-class>test.HelloServlet</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>hello</servlet-name>
    <url-pattern>/hello</url-pattern>
  </servlet-mapping>
</web-app>

##########################################################

I don't know what tomcat version they run. What's the other alternative of running this servlet?
0
 
Mayank SAssociate Director - Product EngineeringCommented:
0
 
Mayank SAssociate Director - Product EngineeringCommented:
What is the web app's context root, hope it is /
0
 
slaviknAuthor Commented:
0
 
Mayank SAssociate Director - Product EngineeringCommented:
Then the context root should be something else. Basically it has to be:

http://server-address:port/web-app-context-root/servlet-url-pattern
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now