java-与CXF 2.4.10相关的Spring初始化失败

前端之家收集整理的这篇文章主要介绍了java-与CXF 2.4.10相关的Spring初始化失败 前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

我们的工作系统具有以下技术

<spring-version>3.0.1.RELEASE</spring-version>
<quartz-version>1.5.2</quartz-version>
<axi2-version>1.5.4</axi2-version>
<cxf.version>2.2.12</cxf.version>

但是,在尝试升级依赖项之后,发生了一些绑定问题,并且在网络上找不到任何答案,因此我正在寻求帮助.

我成功地升级了弹簧和石英,但是当我厌倦了升级cxf时,这成了一场噩梦.

现在我们在Quartz 1.8.6的Spring 3.2.0.RELEASE上运行,但是不能超过cxf 2.3.11,

当我第一次厌倦使用cxf 2.7.2时,我对XmlSchema有一些冲突(未发现方法异常),我通过从axis2依赖项(XmlSchema 1.4.3)中排除了旧版本并导入了最新版本xmlschema-core 2.0.3和问题解决了.

但是我开始遇到以下异常,这是在高于cxf 2.3.11之后立即发生的.

    Oca 24,2013 5:36:38 PM org.apache.catalina.core.StandardContext listenerStart
    SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userService': Invocation of init method Failed; nested exception is javax.xml.ws.WebServiceException: java.lang.NullPointerException
        at org.springframework.beans.factory.support.AbstractAutowireCapablebeanfactory.initializeBean(AbstractAutowireCapablebeanfactory.java:1486)
        at org.springframework.beans.factory.support.AbstractAutowireCapablebeanfactory.doCreateBean(AbstractAutowireCapablebeanfactory.java:524)
        at org.springframework.beans.factory.support.AbstractAutowireCapablebeanfactory.createBean(AbstractAutowireCapablebeanfactory.java:461)
        at org.springframework.beans.factory.support.Abstractbeanfactory$1.getObject(Abstractbeanfactory.java:295)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
        at org.springframework.beans.factory.support.Abstractbeanfactory.doGetBean(Abstractbeanfactory.java:292)
        at org.springframework.beans.factory.support.Abstractbeanfactory.getBean(Abstractbeanfactory.java:194)
        at org.springframework.beans.factory.support.DefaultListablebeanfactory.preInstantiateSingletons(DefaultListablebeanfactory.java:607)
        at org.springframework.context.support.AbstractApplicationContext.finishbeanfactoryInitialization(AbstractApplicationContext.java:932)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
        at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:383)
        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283)
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4323)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4780)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:139)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:785)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:763)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:557)
        at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1124)
        at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1047)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:542)
        at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1390)
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:355)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:89)
        at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:313)
        at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:293)
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:996)
        at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:771)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:139)
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:988)
        at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:275)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:139)
        at org.apache.catalina.core.StandardService.startInternal(StandardService.java:427)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:139)
        at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:649)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:139)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:585)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
        at com.googlecode.t7mp.RunMojo.execute(RunMojo.java:52)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
    Caused by: javax.xml.ws.WebServiceException: java.lang.NullPointerException
        at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:357)
        at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:246)
        at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:525)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at org.springframework.beans.factory.support.AbstractAutowireCapablebeanfactory.invokeCustomInitMethod(AbstractAutowireCapablebeanfactory.java:1612)
        at org.springframework.beans.factory.support.AbstractAutowireCapablebeanfactory.invokeInitMethods(AbstractAutowireCapablebeanfactory.java:1553)
        at org.springframework.beans.factory.support.AbstractAutowireCapablebeanfactory.initializeBean(AbstractAutowireCapablebeanfactory.java:1483)
        ... 65 more
    Caused by: java.lang.NullPointerException
        at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createBindingInfo(AbstractWSDLBasedEndpointFactory.java:338)
        at org.apache.cxf.jaxws.JaxWsServerfactorybean.createBindingInfo(JaxWsServerfactorybean.java:181)
        at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpointInfo(AbstractWSDLBasedEndpointFactory.java:258)
        at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:143)
        at org.apache.cxf.frontend.Serverfactorybean.create(Serverfactorybean.java:159)
        at org.apache.cxf.jaxws.JaxWsServerfactorybean.create(JaxWsServerfactorybean.java:207)
        at org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:442)
        at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:329)
        ... 74 more

    Oca 24,2013 5:36:38 PM org.apache.catalina.core.StandardContext startInternal
    SEVERE: Error listenerStart
    Oca 24,2013 5:36:38 PM org.apache.catalina.core.StandardContext startInternal
    SEVERE: Context [/mpp] startup Failed due to prevIoUs errors
    Oca 24,2013 5:36:38 PM org.apache.catalina.core.ApplicationContext log
    INFO: Closing Spring root WebApplicationContext
    Oca 24,2013 5:36:38 PM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
    SEVERE: The web application [/mpp] registered the JBDC driver [com.MysqL.jdbc.Driver] but Failed to unregister it when the web application was stopped. To prevent a memory leak,the JDBC Driver has been forcibly unregistered.
    Oca 24,2013 5:36:38 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
    SEVERE: The web application [/mpp] appears to have started a thread named [Abandoned connection cleanup thread] but has Failed to stop it. This is very likely to create a memory leak.

我已经阅读了迁移文档,但无法找到关于我的问题的任何答案.

这就是我缩短的pom.xml的样子

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <spring-version>3.2.0.RELEASE</spring-version>
        <cxf.version>2.6.0</cxf.version>
        <aspectjrt-version>1.6.2</aspectjrt-version>
        <aspectjweaver-version>1.5.0</aspectjweaver-version>
        <log4j-version>1.2.17</log4j-version>
    </properties>

    <dependencies>

        <!-- CXF Dependencies -->
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-api</artifactId>
            <version>${cxf.version}</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-frontend-jaxws</artifactId>
            <version>${cxf.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-transports-http</artifactId>
            <version>${cxf.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-ws-security</artifactId>
            <version>${cxf.version}</version>
        </dependency>

        <!-- Spring Dependencies -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>${spring-version}</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>${spring-version}</version>
            <type>pom</type>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aop</artifactId>
            <version>${spring-version}</version>
            <type>pom</type>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context-support</artifactId>
            <version>${spring-version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.ws.xmlschema</groupId>
            <artifactId>xmlschema-core</artifactId>
            <version>2.0.3</version>
        </dependency>
    </dependencies>

这是我的网络服务界面

    @WebService(name="UserWSImplService",targetNamespace = "http://user.services.ws.fourplay.com.tr/")
    public interface UserWSIF

这是我的网络服务实现

    @WebService(endpointInterface = "tr.com.fourplay.ws.services.user.UserWSIF")
    public class UserWSImpl implements UserWSIF

这是我的配置XML

    <bean id="userDBImpl" class="tr.com.fourplay.db.services.user.UserDBImpl" />
    <bean id="userSrv" class="tr.com.fourplay.ws.services.user.UserWSImpl" >
        <property name="dbImpl" ref="userDBImpl" />
    </bean>

    <jaxws:endpoint id="userService" implementor="#userSrv" address="/userService" >
    </jaxws:endpoint>

这是我的web.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
             http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

        <display-name>Mobile Service Platform</display-name>

        <listener>
            <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
        </listener>

        <context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>
                classpath:application-context.xml
            </param-value>
        </context-param>

        <servlet>
            <servlet-name>CXFServlet</servlet-name>
            <display-name>CXF Servlet</display-name>
            <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
            <load-on-startup>1</load-on-startup>
        </servlet>

        <servlet-mapping>
            <servlet-name>CXFServlet</servlet-name>
            <url-pattern>/*</url-pattern>
        </servlet-mapping>

    </web-app>

任何帮助都将得到高度重视.

最佳答案
http://cxf.547215.n5.nabble.com/Spring-context-not-loading-when-upgrading-from-2-2-9-to-2-4-1-version-td4518167.html

问题与配置有关.

Hi,Cxf bus refactor a lot since cxf 2.4.0.
In your spring configuration
<import resource="classpath:Meta-INF/cxf/cxf-extension-soap.xml" />
is unnecessary
and you need change
<bean id="cxf" class="org.apache.cxf.bus.CXFBusImpl" />
to something like
<cxf:bus/>

Freeman

猜你在找的Spring相关文章