Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Messed up web.xml deployment descriptor

Status
Not open for further replies.

dendenners

Programmer
Jul 17, 2001
110
IE
Hey there,
Last week I had weblogic understanding a .war file I had created. Unfortunately, in the time being I have messed something up, and I don't know what. My war file is defined as follows in weblogic.properties:

weblogic.httpd.webApp.ramApp=c:\\weblogic\\myserver\\public_html\\WEB-INF\\RAM.war

The servlet mapping is defined as follows in my web.xml file:
<servlet>
<servlet-name>
ramtool
</servlet-name>

<servlet-class>
com.omnipay.ram.control.RamServlet
</servlet-class>

However, this doesn't work. The action in the form on my jsps refers to &quot;/ramtool&quot;. Whenever I click a button in my war-red application, the url goes to &quot;/ramtool&quot; and not &quot;/ramApp/ramtool&quot; as it should. What am I forgetting? This is very frustrating because it was working fine until I starting messing around with it.
Thanks
 
You need to give it a servlet-mapping. Check the DTD for the web.xml file.
 
Sorry I should have said I already had a (probably incorrect)servlet mapping. This is it:
<servlet-mapping>
<servlet-name>ramtool</servlet-name>
<url-pattern>ramApp/ramtool</url-pattern>
</servlet-mapping>

This doesn't seem to do anything, my browser still goes back to /ramtool each time. Is there a problem with this mapping, or what? Thanks
 
First of all your Web App will have the base context of unless you have set the Web Application to be WebLogic's default Web Application. In this case it's context would be
So change the servlet-mapping to just reflect the servlet name, not the web application name. Try:
Code:
    <servlet-mapping>
        <servlet-name>ramtool</servlet-name>
        <url-pattern>/ramtool</url-pattern>
    </servlet-mapping>

Then in your case, try accessing the servlet using:

The previous attempt probably would have worked if you tried because you were duplicating the web app name in the servlet-mapping.

It would also help if you mention what version of WebLogic you are using in future posts. You are using 5.X correct?
 
Thanks for your interest so far.
I'm using WL 5.1 SP9.
The way I access the application is through a jsp page called ram.jsp
When I try to access the ram jsp comes up fine. It is when I click on the submit button on this page that the server attempts to access the /ramtool servlet, without putting in the ramApp.

I had the mapping as you suggested as /ramtool, but the server is still attempting to access the wrong url. There must be something stupid I am forgetting, because this was working a few days ago. Thanks again
 
Thanks for your help. I discovered the problem was not in the actual deployment descriptor, but in the code. I was actually encoding the url in a class I had written, and the servlet name had been hard-coded there. So I had to add an optional property to add in the war name before this so that the url was correct. Thanks for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top