我目前正在使用Wink 1.1.1和Spring 3.1.2将Java应用程序从WAS 7迁移到WAS 8.5.5。我正在尝试使用WAS 8.5中可用的本机Wink集成,而不是使用WAS 7当前具有的单独Wink jar。

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


  造成原因:java.lang.ClassNotFoundException:
  org.apache.wink.server.internal.registry.ResourceRegistry位于
  java.net.URLClassLoader.findClass(URLClassLoader.java:434)


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

我想我的问题是围绕IBM集成到WAS 8.5.5中的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>


另外,在我的战争中,我的lib文件夹中只有wink-spring-support-1.1.1-incubating.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-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时曾与许多ClassNotFoundException进行过斗争,根据我的经验,可以通过将Websphere类加载器更改为PARENT_LAST来解决许多此类问题。这使您的应用程序可以在Websphere尝试加载Websphere JRE中包含的jar之前加载与应用程序打包在一起的所有jar。

08-05 01:09