WebLogic + odata4j = java.lang.NoClassDefFoundError:org / apache / cxf / jaxrs / impl / UriBuilderImpl

时间:2015-06-05 13:09:03

标签: java weblogic

我的Web应用程序包含一些使用在WebLogic 12.1.2.0和Java 1.7上运行的odata4j编写的遗留代码。有时(但并非总是)当我尝试从我的OData服务获取元数据时,我有异常java.lang.NoClassDefFoundError:org / apache / cxf / jaxrs / impl / UriBuilderImpl。

完整的堆栈跟踪:

java.lang.NoClassDefFoundError: org/apache/cxf/jaxrs/impl/UriBuilderImpl
    at org.apache.cxf.jaxrs.impl.RuntimeDelegateImpl.createUriBuilder(RuntimeDelegateImpl.java:87)
    at javax.ws.rs.core.UriBuilder.newInstance(UriBuilder.java:69)
    at javax.ws.rs.core.UriBuilder.fromUri(UriBuilder.java:80)
    at javax.ws.rs.core.UriBuilder.fromUri(UriBuilder.java:99)
    at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:649)
    at weblogic.jaxrs.server.portable.servlet.ServletContainer.service(ServletContainer.java:218)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:844)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:280)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:254)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:136)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:341)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:25)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)
    at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)
    at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3367)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3333)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
    at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57)
    at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2220)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2146)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2124)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1564)
    at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:254)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:295)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:254)

我试图通过wls-cat检查这个课程并得到以下结果:

General Information
Type: weblogic.utils.classloaders.ChangeAwareClassLoader
HashCode: 1492139542

Resource Analysis
Resource: org.apache.cxf.jaxrs.impl.UriBuilderImpl
Checksum: 3c9f3e5e3c2493e3d960c4e0cb41ed97
Load Location:     jar:file:/home/stas/Oracle/Middleware/Oracle_Home/user_projects/domains/xxx/servers/AdminServer/tmp/_WL_user/datagrid/9s8vqk/war/WEB-INF/lib/cxf-rt-frontend-jaxrs-2.6.0.jar!/org/apache/cxf/jaxrs/impl/UriBuilderImpl.class
Classloader Type: weblogic.utils.classloaders.ChangeAwareClassLoader
Classloader Hash Code: 1492139542
Classloader Search Order: 1492139542 ->1492139542

Alternative Locations:

/home/stas/Oracle/Middleware/Oracle_Home/user_projects/domains/xxx/servers/AdminServer/tmp/_WL_user/datagrid/9s8vqk/war/WEB-INF/lib/cxf-rt-frontend-jaxrs-2.6.0.jar!/org/apache/cxf/jaxrs/impl/UriBuilderImpl.class
/home/stas/Oracle/Middleware/Oracle_Home/user_projects/domains/xxx/servers/AdminServer/tmp/_WL_user/datagrid/9s8vqk/war/WEB-INF/lib/odata4j-dist-0.7.0.jar!/org/apache/cxf/jaxrs/impl/UriBuilderImpl.class

并且此claas存在于已加载的类列表中。

我不知道如何解决这个问题,欢迎任何帮助。

1 个答案:

答案 0 :(得分:0)

看起来这个odata4j的mvn配置有助于解决问题:

<dependency>
    <groupId>org.odata4j</groupId>
    <artifactId>odata4j-core</artifactId>
    <version>0.7.0</version>
    <exclusions>
        <exclusion>
            <groupId>javax.ws.rs</groupId>
            <artifactId>jsr311-api</artifactId>
        </exclusion>
        <exclusion>
            <groupId>org.eclipse.persistence</groupId>
            <artifactId>javax.persistence</artifactId>
        </exclusion>
        <exclusion>
            <groupId>org.eclipse.persistence</groupId>
            <artifactId>eclipselink</artifactId>
        </exclusion>
    </exclusions>
</dependency>