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,
LVL 1
slaviknAsked:
Who is Participating?
 
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
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
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.

All Courses

From novice to tech pro — start learning today.