Spring 4.3.30 ~ Spring 5.3.18 - 스레드 바운드 요청을 찾을 수 없음
7262 단어 spring
Spring 4.3.30을 Spring 5.3.18로 업그레이드하려고 합니다. Tomcat 8.5.56을 로드할 때 다음 오류가 발생합니다.
원인: java.lang.IllegalStateException: 스레드 바운드 요청을 찾을 수 없음: 실제 웹 요청 외부의 요청 속성을 참조하거나 원래 수신 스레드 외부에서 요청을 처리하고 있습니까? 실제로 웹 요청 내에서 작업 중이고 여전히 이 메시지를 수신하는 경우 코드가 DispatcherServlet 외부에서 실행 중일 수 있습니다. 이 경우 RequestContextListener 또는 RequestContextFilter를 사용하여 현재 요청을 노출하십시오.
기술 스택:
이클립스링크 JPA 2.5.1
BasicDatasource 연결은 Apache commons-dbcp-1.1을 사용하여 설정됩니다.
Apache CXF 번들 Jar 2.7.18.SP7-redhat-1 - JAXRS에 사용
ThreadContextInheritable의 기본값이 true인 업데이트된 RequestContextFilter로 RequestContextListener를 교체하려고 했습니다.
아래 목록은 web.xml, persistence.xml 및 spring-config.xml 파일에서 발췌한 것입니다. 모든 입력이 유용합니다.
감사,
만수르 파루크`
Web.xml:
org.springframework.web.context.ContextLoaderListener
<filter>
<filter-name>requestContextFilter</filter-name>
<filter-class>org.springframework.web.filter.RequestContextFilter</filter-class>
<init-param>
<param-name>threadContextInheritable</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>requestContextFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
지속성.xml:
xmlns="http://java.sun.com/xml/ns/persistence"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
트랜잭션 유형="RESOURCE_LOCAL">
<mapping-file>META-INF/orm.xml</mapping-file>
<class><Custom JPA entities></class>
진실
<property name="eclipselink.weaving" value="static">
</property>
<property name="eclipselink.logging.level" value="OFF" />
<property name="eclipselink.logging.logger"
value="org.eclipse.persistence.logging.CommonsLoggingSessionLog" />
<property name="eclipselink.logging.session" value="FALSE" />
<property name="eclipselink.logging.level.sql" value="OFF" />
<property name="eclipselink.logging.parameters" value="FALSE" />
</properties>
<!-- custom SessionLog implementation to use apache commons logging 1.1
API (so log4J) -->
<shared-cache-mode>NONE</shared-cache-mode>
</persistence-unit>
Spring-Config.xml:
xmlns:aop="http://www.springframework.org/schema/aop"xmlns:context="http://www.springframework.org/schema/context"
xmlns:flow="http://www.springframework.org/schema/webflow-config"xmlns:jms="http://www.springframework.org/schema/jms"
xmlns:jee="http://www.springframework.org/schema/jee"xmlns:lang="http://www.springframework.org/schema/lang"
xmlns:osgi="http://www.springframework.org/schema/osgi"xmlns:tx="http://www.springframework.org/schema/tx"xmlns:util="http://www.springframework .org/스키마/유틸"
xmlns:p="http://www.springframework.org/schema/p"xmlns:cxf="http://cxf.apache.org/core"xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/webflow-config http://www.springframework.org/schema/webflow-config/spring-webflow-config-1.0.xsd
http://www.springframework.org/schema/jms http://www.springframework.org/schema/jms/spring-jms-2.5.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd
http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-2.5.xsd
http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd
http://cxf.apache.org/core
http://cxf.apache.org/schemas/core.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd
http://cxf.apache.org/jaxrs
http://cxf.apache.org/schemas/jaxrs.xsd
"
default-autowire="byName">
<cxf:bus>
<cxf:features>
<cxf:logging />
</cxf:features>
</cxf:bus>
<jaxrs:server id="restServer" address="/services/"
beanNames="<custom bean names> ">
<jaxrs:extensionMappings>
<entry key="feed" value="application/atom+xml" />
<entry key="json" value="application/json" />
<entry key="xml" value="application/xml" />
<entry key="html" value="text/html" />
</jaxrs:extensionMappings>
<jaxrs:providers>
<bean class="org.apache.cxf.jaxrs.provider.json.JSONProvider">
<property name="writeXsiType" value="false" />
<property name="readXsiType" value="false" />
</bean>
</jaxrs:providers>
</jaxrs:server>
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" scope="session">
<property name="dataSource" ref="dataSource" />
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter">
<property name="showSql" value="false" />
<property name="generateDdl" value="false" />
</bean>
</property>
<property name="persistenceUnitPostProcessors" ref="persistenceUnitPostProcessor" />
</bean>
<bean id="persistenceUnitPostProcessor" class="<path to custom class file>"
scope="session">
<property name="dataSource" ref="dataSource" />
</bean>
<bean id="dataSource" class="<path to custom datasource class file(Apache DBCP)>" scope="session">
</bean>
Reference
이 문제에 관하여(Spring 4.3.30 ~ Spring 5.3.18 - 스레드 바운드 요청을 찾을 수 없음), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://dev.to/farma07dev/spring-4330-to-spring-5318-no-thread-bound-request-found-228o텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)