gpt4 book ai didi

java - 将 Spring 与 WebSphere 8.5.5 和 Apache Wink 结合使用 - ClassNotFoundException

转载 作者:行者123 更新时间:2023-11-30 03:21:12 32 4
gpt4 key购买 nike

我目前正在使用 Wink 1.1.1 和 Spring 3.1.2 将 Java 应用程序从 WAS 7 迁移到 WAS 8.5.5。我正在尝试使用 WAS 8.5 中提供的 native Wink 集成,而不是使用我们目前在 WAS 7 中使用的单独 Wink jar。

我在服务器启动时遇到如下错误:

Caused by: java.lang.ClassNotFoundException: org.apache.wink.server.internal.registry.ResourceRegistry at java.net.URLClassLoader.findClass(URLClassLoader.java:434)

我对此有点困惑,因为上面引用的类确实包含在 Apache version of the wink jar 中据我所知。

我想我的问题围绕着集成到 WAS 8.5.5 中的 IBM Wink 1.1.1 实现。这个类不应该在 IBM 的实现中也可用吗?我在这里缺少什么?

这是我的 web.xml 的片段,以防有帮助:

 <servlet>
<servlet-name>IBM Rest Servlet</servlet-name>
<servlet-class>com.ibm.websphere.jaxrs.server.IBMRestServlet</servlet-class>
</servlet>

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:META-INF/server/wink-core-context.xml
/WEB-INF/spring/applicationContext-configuration.xml</param-value>
</context-param>

另外,我的 war 中的 lib 文件夹中只有 wink-spring-support-1.1.1-incubating.jar 。那里没有其他眨眼 jar 。

这是我的applicationContext-configuration.xml:

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

<context:annotation-config />

<bean class="org.apache.wink.spring.Registrar">
<property name="classes">
<set value-type="java.lang.Class">
</set>
</property>
<property name="instances">
<set>
<ref local="someResource" />
<!-- ... -->
</set>
</property>
</bean>

<!-- Providers -->
<bean id="jaxbProvider" class="org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider" >
<property name="mapper" ref="jacksonObjectMapper"/>
</bean>

<bean id="jacksonObjectMapper" class="org.codehaus.jackson.map.ObjectMapper" >
<property name="annotationIntrospector" ref="jacksonAnnotationIntrospector"></property>
</bean>

<bean id="jacksonAnnotationIntrospector" class="org.codehaus.jackson.map.AnnotationIntrospector$Pair" >
<constructor-arg ref="primaryAnnotationIntrospector" />
<constructor-arg ref="secondaryAnnotationIntrospector" />
</bean>

<bean id="primaryAnnotationIntrospector" class="org.codehaus.jackson.xc.JaxbAnnotationIntrospector" />
<bean id="secondaryAnnotationIntrospector" class="org.codehaus.jackson.map.introspect.JacksonAnnotationIntrospector" />

<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="ignoreUnresolvablePlaceholders" value="true"/>
</bean>

<bean id="propertyPlaceholderConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="ignoreUnresolvablePlaceholders" value="true" />
<property name="properties" ref="allProperties"/>
</bean>


<bean id="allProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="ignoreResourceNotFound" value="true" />
<property name="locations">
<list>

<value>classpath*:/META-INF/${Environment}-environment.properties</value>

</list>
</property>
</bean>

<import resource="applicationContext-otherFile.xml"/>

</beans>

类路径上的 Spring jar:

spring-jdbc-3.1.1.RELEASE.jar
spring-test-3.1.2.RELEASE.jar
spring-context-3.1.2.RELEASE.jar
spring-beans-3.1.2.RELEASE.jar
spring-core-3.1.2.RELEASE.jar
spring-tx-3.1.1.RELEASE.jar
spring-web-3.1.2.RELEASE.jar
spring-asm-3.1.2.RELEASE.jar
spring-aop-3.1.2.RELEASE.jar
spring-expression-3.1.2.RELEASE.jar

我已经尝试了在 EnterpriseApplications > WebAppName >> 类加载器中找到的两个类加载器设置(类加载器顺序和 WAR 类加载器策略)的所有 4 种可能组合,但结果相同。

感谢您的帮助!

最佳答案

在使用 websphere 的过程中,我遇到了许多 ClassNotFoundExceptions,根据我的经验,其中许多问题可以通过将 websphere 类加载器更改为 PARENT_LAST 来解决。这允许您的应用程序在 websphere 尝试加载 websphere JRE 中包含的 jar 之前加载您与应用程序一起打包的所有 jar。

关于java - 将 Spring 与 WebSphere 8.5.5 和 Apache Wink 结合使用 - ClassNotFoundException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31297575/

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