0

Thanks to the UNUSUAL deployment of Tomcat6 I need to deploy my web app that is using the Spring & Hibernate on a server where access to the WAR deployment's web.xml at /webapps/MyDeployment/WEB-INF/web.xml is not allowed.

So I need to know if such a deployment is even possible, Where we will initialize the spring framework in the serever's web.xml at /webapps/WEB-INF/web.xml and not use the WAR's web.xml ?

Below is the WAR's web.xml that I am currently using at my environment,

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>abcd</display-name>

<!--Here we specify about the DispatcherServlet class in the Web Deployment 
    Descriptor -->
<servlet>
    <servlet-name>dispatcher</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>dispatcher</servlet-name>
    <url-pattern>*.abcd</url-pattern>
</servlet-mapping>
<servlet-mapping>
    <servlet-name>dispatcher</servlet-name>
    <url-pattern>*.xyz</url-pattern>
    <url-pattern>*.pqr</url-pattern>
</servlet-mapping>

Unfortunately changes in the Tomcat configuration is not allowed,

Any suggestions will be highly appreciated.

4
  • Should work, but you'll hit some issues with dependencies/classloaders. Not sure where you should place Spring JARs, probably in /WEB-INF/lib or (worse) /lib of Tomcat. Nov 1, 2012 at 8:17
  • No, As I am not sure about the affect that this will will have on the other deployments on the same server. I am also not sure where the code for the Spring controllers would go. Nov 1, 2012 at 9:17
  • Set up a test-server and find out. It takes about 10 minutes to download and get a tomcat instance running...
    – pap
    Nov 1, 2012 at 13:00
  • I have tried it on my instance of the server but not on the production server. I wanted to know if someone faced issues after such a deployment. Nov 2, 2012 at 4:35

1 Answer 1

0

Thank you for all your help, but we ended up solving the problem by asking the server administrator to lift some of the restrictions that had been put regarding file access to the tomcat user.

Now we can access the domain web xml aswell as the server web xml.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.