Spring mvc 如何在SpringMVC应用程序中设置类路径?
我的服务器上有两个不同的web应用程序。一个是SpringMVC应用程序,另一个是struts应用程序。这些应用程序的库位于不同的位置。以下是我的Spring mvc应用程序结构: SpringMVC应用程序的所有jar文件都位于Spring mvc 如何在SpringMVC应用程序中设置类路径?,spring-mvc,jboss7.x,Spring Mvc,Jboss7.x,我的服务器上有两个不同的web应用程序。一个是SpringMVC应用程序,另一个是struts应用程序。这些应用程序的库位于不同的位置。以下是我的Spring mvc应用程序结构: SpringMVC应用程序的所有jar文件都位于WEB-INF/lib目录中。以下是my web.xml: <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-ins
WEB-INF/lib
目录中。以下是my 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>My project</display-name>
<servlet>
<servlet-name>route</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>route</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
但当我在没有struts应用的情况下运行SpringMVC应用时,它运行得很好。也许有相互冲突的库
我可以在我的SpringMVC应用程序中添加类路径,以便它在适当的位置查看库jar吗 JBoss7附带Hibernate3。如果您想使用Hibernate4,就必须在jboss部署结构中排除它。有关隐式依赖关系的更多信息,请参阅
[org.springframework.web.servlet.DispatcherServlet] (MSC service thread 1-6) Context initialization failed: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'loginDao': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory com.myproject.scm.dao.LoginDao.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/route-servlet.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.addAnnotatedClass(Ljava/lang/Class;)Lorg/hibernate/cfg/Configuration;