Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/hibernate/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我可以通过Tomcats web xml(../webapps/web-INF/web.xml)初始化Spring吗?_Spring_Hibernate_Tomcat_Spring Mvc - Fatal编程技术网

我可以通过Tomcats web xml(../webapps/web-INF/web.xml)初始化Spring吗?

我可以通过Tomcats web xml(../webapps/web-INF/web.xml)初始化Spring吗?,spring,hibernate,tomcat,spring-mvc,Spring,Hibernate,Tomcat,Spring Mvc,由于Tomcat6的非常规部署,我需要在服务器上部署使用Spring和Hibernate的web应用程序,在服务器上不允许访问WAR部署的web.xml(位于/webapps/MyDeployment/web-INF/web.xml) 所以我需要知道这样的部署是否可行,我们将在serever的web.xml中的/webapps/web-INF/web.xml初始化spring框架,而不使用WAR的web.xml 下面是我目前在我的环境中使用的WAR的web.xml <?xml versio

由于Tomcat6的非常规部署,我需要在服务器上部署使用Spring和Hibernate的web应用程序,在服务器上不允许访问WAR部署的web.xml(位于/webapps/MyDeployment/web-INF/web.xml)

所以我需要知道这样的部署是否可行,我们将在serever的web.xml中的/webapps/web-INF/web.xml初始化spring框架,而不使用WAR的web.xml

下面是我目前在我的环境中使用的WAR的web.xml

<?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>

abcd
调度员
org.springframework.web.servlet.DispatcherServlet
1.
调度员
*.abcd
调度员
*.xyz
*.pqr

不幸的是,不允许更改Tomcat配置


任何建议都将不胜感激。

感谢您的帮助,但我们最终解决了问题,要求服务器管理员取消了一些关于tomcat用户文件访问的限制


现在,我们可以访问域web xml以及服务器web xml。

应该可以工作,但是您会遇到依赖项/类加载器的一些问题。不确定应该将Spring JAR放在哪里,可能是在Tomcat的
/WEB-INF/lib
或(更糟的)
/lib
中。不,因为我不确定这会对同一服务器上的其他部署产生什么影响。我也不确定Spring控制器的代码会去哪里。设置一个测试服务器并找出答案。下载并运行tomcat实例大约需要10分钟……我已经在我的服务器实例上试过了,但没有在生产服务器上试过。我想知道在这样的部署之后是否有人面临问题。