Weblogic Jaxws部署 - 类不支持JDK1.5

时间:2018-03-12 12:49:00

标签: weblogic jax-ws

WebLogic Server版本:10.3.6.0

Spring版本:3.2.1.RELEASE

Java JDK 1.6

我正在尝试将Spring应用程序部署为WAR,将jaxws用于Weblogic服务器。 该应用程序适用于Jetty。但是,当部署(我的意思是启动已部署的应用程序)Weblogic发生以下异常时:

Caused By: java.lang.UnsupportedOperationException: This class does not support JDK1.5
        at weblogic.xml.jaxp.RegistryTransformerFactory.setFeature(RegistryTransformerFactory.java:317)
        at com.sun.xml.ws.util.xml.XmlUtil.newTransformerFactory(XmlUtil.java:392)
        at com.sun.xml.ws.util.xml.XmlUtil.newTransformerFactory(XmlUtil.java:400)
        at com.sun.xml.ws.util.xml.XmlUtil.<clinit>(XmlUtil.java:233)
        at org.jvnet.jax_ws_commons.spring.SpringService.getObject(SpringService.java:36

maven pom.xml

<dependency>
    <groupId>com.sun.xml.ws</groupId>
    <artifactId>jaxws-rt</artifactId>
    <version>2.2.10</version>
    </dependency>
<dependency>
<groupId>org.jvnet.jax-ws-commons.spring</groupId>
    <artifactId>jaxws-spring</artifactId>
    <version>1.9</version>
</dependency>

weblogic.xml中

<weblogic-web-app>
<context-root>/MyApp</context-root>
  <container-descriptor>
    <prefer-web-inf-classes>true</prefer-web-inf-classes>
    <show-archived-real-path-enabled>true</show-archived-real-path-enabled>  
  </container-descriptor>
</weblogic-web-app>

1 个答案:

答案 0 :(得分:0)

通过更改weblogic.xml进行修复

 <container-descriptor>
    <prefer-web-inf-classes>false</prefer-web-inf-classes>
    <show-archived-real-path-enabled>true</show-archived-real-path-enabled>
    <prefer-application-packages>
        <package-name>com.sun.xml.ws.server.*</package-name>
    </prefer-application-packages>
  </container-descriptor>

在init servlet(如果使用旧样式)中,应将获取上下文的方式更改为:

            private static WebApplicationContext context;

            @Override
            public void contextInitialized(ServletContextEvent sce) {

                ServletContext sc = sce.getServletContext(); 
                this.context = WebApplicationContextUtils.getWebApplicationContext(sc);  

                ...
            }

            public static WebApplicationContext getApplicationContext(){
                return context;
            }

可以解决