Click to See Complete Forum and Search --> : problem deploying war module


aks01
May 3rd, 2010, 11:26 AM
i have created a folder in C:\>howdyapp
created folders within this main folder SRC, WEB, WEB-INF.
and then sub folders in WEB_INF -> CLASSES, LIB, ETC.
i have compiled HowdyServlet.java and copied it's classs to =>C:\>howdyapp\WEB_INF\Classes
i have created web.xml and copied it to WEB_INF folder.

created a war file on the command prompt as:
c:\jwork\howdyapp\>jar cvf howdyapp.war src web WEB_INF
created a howdyapp.war file in the directory-howdyapp.

when i am deploying the above war file in the sun's Application server, it displays the following error:-

Trying to upload an illegal war archive. Make sure the archive file contains the descriptor file web.xml.

what could have gone wrong with the above procedure.
please help me.

ProgramThis
May 4th, 2010, 07:49 AM
Well, first thing to check is to open up the WAR file and see what's inside. You can use 7zip or ZipItFree to open it up since a war file is basically just a zip file with a different extension. Make sure that the web.xml is there and in its proper place.

Also, I use Tomcat myself so I am not familiar with how glassfish explodes its war files. It may be checking the web.xml for validity. Check the web.xml and make sure it is properly formatted xml.

aks01
May 4th, 2010, 08:23 AM
First your suggestion was awesome.
It was helpful in a way that i can really know what's really inside the WAR file.
Thanks for sharing it.
Now that i have seen inside of it, to me everything is fine.
I have checked it.
Web.xml file looks like this:-
<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
PUBLIC"-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">

<web-app>
<servlet>
<servlet-name>fred<servlet-name>
<servlet-class>HowdyServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>fred</servlet-name>
<url-pattern>/jabber/Howdy</url-pattern>
</servlet-mapping>
</web-app>
Thanks

ProgramThis
May 4th, 2010, 11:11 AM
Try replacing your doctype tag with the following tag:

<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
Generally you don't need doctype in your web.xml, but you do need to say that it is a java 2ee web application.

aks01
May 4th, 2010, 11:28 AM
I have replaced the tag with the one you said.
But still it shows error message:
---------------------------------------------------------------------------------------------------------------------------
Trying to upload an illegal war archive. Make sure the archive file contains the descriptor file web.xml.
---------------------------------------------------------------------------------------------------------------------------
I am still unable to upload this file successfully in my application server.

thanks

aks01
May 5th, 2010, 09:48 AM
i need serious help with the above code.
help plzzz.

dlorde
May 5th, 2010, 02:56 PM
Assuming you've verified that the file is in the correct directory in the war, my next step would be to find a simple example war file that works and compare it with the problem war to see where the difference is. For example, perhaps the directory names are case-sensitive.

As soon as we started programming, we found out to our surprise that it wasn't as easy to get programs right as we had thought. Debugging had to be discovered. I can remember the exact instant when I realized that a large part of my life from then on was going to be spent in finding mistakes in my own programs...
M. Wilkes

ProgramThis
May 6th, 2010, 08:21 AM
Another thing to try along the same lines as dlorde's suggestion is to download apache tomcat and try to run the war file inside of that container. If the war file work in that container and you can access the web page then there could be a problem with either your configuration of glassfish, or something that it is expecting and not finding, to which you would have to read the documentation in order to figure out which piece it is.

aks01
May 7th, 2010, 02:28 AM
Thanks to all the members for their advise.
Here is what i have done up to now.
I have downloaded a .War file from the net and executed on application server(sun) and it executed perfectly( which is obviously one step forward).

THE PROBLEM----
The situation stands like this, although the file executed successfully on the application server but still not getting executed on tomcat server(i am surprised).
One member rightly quoted that the issue might be with the configuration and i have no knowledge of that.
I have downloaded easily available PreConfigured Tomcat folder, but i want to be sure that should i copy- paste the whole thing or should replace it with certain files only.

thanks

aks01
May 7th, 2010, 03:18 AM
HTTP Status 404 - /myServletWAR/hello

type Status report

message /myServletWAR/hello

description The requested resource (/myServletWAR/hello) is not available.
Apache Tomcat/6.0.26


The above is the error i get when i try to deploy war file on tomcat sever.

http://localhost:8085/myServletWAR/hello