gpt4 book ai didi

java - Spring 3.0 SimpleUrlhand错误

转载 作者:行者123 更新时间:2023-12-01 04:45:29 25 4
gpt4 key购买 nike

安装应用程序后,我尝试部署我的ear文件并尝试启动服务器,但它没有启动,并且出现以下错误:错误:

SimpleUrlHand I org.springframework.web.servlet.handler.AbstractUrlHandlerMapping
registerHandler Mapped URL path [/resources/**] onto handler 'org.springframework.web.servlet.resource.ResourceHttpRequestHandler#0'

Web.xml:

   <?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.5"
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">
<display-name>excs</display-name>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>

<servlet>
<servlet-name>springmvc</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>springmvc</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/spring-security.xml
/WEB-INF/springmvc-servlet.xml
</param-value>
</context-param>

<!-- Spring Security -->
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern> <!-- all actions will intercepted -->
</filter-mapping>


<welcome-file-list>
<welcome-file>/WEB-INF/index.jsp</welcome-file>
</welcome-file-list>
</web-app>

Springmvc-servlet.xml:

 <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation=
"http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">

<!-- all static thing should be listed under the resources folder. for example,
img, css, ... -->
<mvc:resources mapping="/resources/**" location="/resources/" /> <!-- sets up a
handler for serving static content -->

<!-- Configures the annotation-driven Spring MVC Controller programming model.
Note that, with Spring 3.0, this tag works in Servlet MVC only! -->
<mvc:annotation-driven/> <!-- turn on all of the annotation-driven features you’ll
need from Spring MVC -->

<!-- Activates various annotations to be detected in bean classes -->
<!-- tells Spring that you intend to use annotation-based wiring in Spring.
Spring 3 supports a few different annotations for
autowiring:
Spring’s own @Autowired
annotation
@Inject annotation from
JSR-330
@Resource annotation from
JSR-250
-->
<context:annotation-config />


<!-- Scans the classpath for annotated components that will be auto-registered as
Spring beans.
For example @Component,@Controller, @Repository, and @Service. Make sure to set the
correct base-package-->
<context:component-scan base-package="psup.excs" />


<!-- To use Tiles views in Spring MVC, add the following two -->
<!-- TilesConfigurer loads one or more Tiles definition files and make them available
for
TilesViewResolver to resolve views from. -->
<bean class="org.springframework.web.servlet.view.UrlBasedViewResolver"
id="tilesViewResolver">
<property name="order" value="1"/>
<property name="viewClass"
value="org.springframework.web.servlet.view.tiles2.TilesView"/>
</bean>
<bean class="org.springframework.web.servlet.view.tiles2.TilesConfigurer"
id="tilesConfigurer">
<property name="definitions">
<list>
<value>/WEB-INF/tiles-config.xml</value>
</list>
</property>
</bean>

<!-- if not using tiles, uncomment out the folowing and comment out the above
tilesViewResolver and tileConfiguerer,
then controlller will forward to jsp instead of tiles.
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/views/"></property>
<property name="suffix" value=".jsp" />
</bean>
!-->


<!-- MyBatis Configuration -->

<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="jdbc/excs" />
<property name="resourceRef" value="false" />
</bean>

<tx:annotation-driven transaction-manager="txManager" />
<bean id="txManager"

class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>

<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"
scope="singleton">
<property name="dataSource" ref="dataSource"/>
<property name="typeAliasesPackage" value="excs.data.bean" />
</bean>

<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="excs.data.mapper" />
</bean>


</beans>

最佳答案

我解决了!基本上,我们的 WAS 技术团队在应用程序服务器上安装了 Hibernate,而该应用程序使用 myBatis,因此存在冲突。一旦我们卸载了 Hibernate,它就可以正常工作并且服务器也启动了。

关于java - Spring 3.0 SimpleUrlhand错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15937297/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com