Tag Archives: cxf

CXF Webservice 部署到Wildfly服务器

部署的过程中一直报这个错误

16:01:18,127 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-8) JBAS015960: Class Path entry jaxb-api.jar in /content/MavenDeployTest-0.0.1-SNAPSHOT.war/WEB-INF/lib/jaxb-impl-2.2.6.jar  does not point to a valid jar for a Class-Path reference.
16:01:18,201 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC000001: Failed to start service jboss.deployment.unit."MavenDeployTest-0.0.1-SNAPSHOT.war".PARSE: org.jboss.msc.service.StartException in service jboss.deployment.unit."MavenDeployTest-0.0.1-SNAPSHOT.war".PARSE: JBAS018733: Failed to process phase PARSE of deployment "MavenDeployTest-0.0.1-SNAPSHOT.war"
	at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:166) [wildfly-server-8.1.0.Final.jar:8.1.0.Final]
	at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
	at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_45]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_45]
	at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_45]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS015599: Apache CXF library (cxf-rt-bindings-soap-2.7.6.jar) detected in ws endpoint deployment; either provide a proper deployment replacing embedded libraries with container module dependencies or disable the webservices subsystem for the current deployment adding a proper jboss-deployment-structure.xml descriptor to it. The former approach is recommended, as the latter approach causes most of the webservices Java EE and any JBossWS specific functionality to be disabled.
	at org.jboss.as.webservices.deployers.WSLibraryFilterProcessor.deploy(WSLibraryFilterProcessor.java:71)
	at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:159) [wildfly-server-8.1.0.Final.jar:8.1.0.Final]
	... 5 more

16:01:18,207 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 4) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "MavenDeployTest-0.0.1-SNAPSHOT.war")]) - failure description: {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"MavenDeployTest-0.0.1-SNAPSHOT.war\".PARSE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"MavenDeployTest-0.0.1-SNAPSHOT.war\".PARSE: JBAS018733: Failed to process phase PARSE of deployment \"MavenDeployTest-0.0.1-SNAPSHOT.war\"
    Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS015599: Apache CXF library (cxf-rt-bindings-soap-2.7.6.jar) detected in ws endpoint deployment; either provide a proper deployment replacing embedded libraries with container module dependencies or disable the webservices subsystem for the current deployment adding a proper jboss-deployment-structure.xml descriptor to it. The former approach is recommended, as the latter approach causes most of the webservices Java EE and any JBossWS specific functionality to be disabled."}}
16:01:18,210 ERROR [org.jboss.as.server] (management-handler-thread - 4) JBAS015870: Deploy of deployment "MavenDeployTest-0.0.1-SNAPSHOT.war" was rolled back with the following failure message: 
{"JBAS014671: Failed services" => {"jboss.deployment.unit.\"MavenDeployTest-0.0.1-SNAPSHOT.war\".PARSE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"MavenDeployTest-0.0.1-SNAPSHOT.war\".PARSE: JBAS018733: Failed to process phase PARSE of deployment \"MavenDeployTest-0.0.1-SNAPSHOT.war\"
    Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS015599: Apache CXF library (cxf-rt-bindings-soap-2.7.6.jar) detected in ws endpoint deployment; either provide a proper deployment replacing embedded libraries with container module dependencies or disable the webservices subsystem for the current deployment adding a proper jboss-deployment-structure.xml descriptor to it. The former approach is recommended, as the latter approach causes most of the webservices Java EE and any JBossWS specific functionality to be disabled."}}

 

在tomcat 7中运行是正常的,就是在wildfly中部署不了。 搜索之后发现解决方案很简单。在你的应用里面WEB-INF文件夹加入_jboss-deployment-structure.xml

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
	<deployment>
		<exclude-subsystems>
	        <subsystem name="webservices" />
	    </exclude-subsystems>
	</deployment>
</jboss-deployment-structure>

Wildfly Deploy Test

原因: wildfly 为了高效的运行在本身集成了cxf,所以导致了冲突。

 

 

在github查看项目源码:
https://github.com/yhjhoo/WildflyDeployTest

或者在本站WildflyDeployTest下载

Write operations are not allowed in read-only mode (FlushMode.NEVER/MANUAL): Turn your Session into FlushMode.COMMIT/AUTO or remove ‘readOnly’ marker from transaction definition

Write operations are not allowed in read-only mode (FlushMode.NEVER/MANUAL): Turn your Session into FlushMode.COMMIT/AUTO or remove ‘readOnly’ marker from transaction definition

让人蛋疼的错误,找了好久不知道是什么原因,最后看源码,原来spring自动帮我加我flushmode = 手动。 明明在web.xml里面已经配置过了的,最后发现原来是有我自己的安全方法,哎。。。。

 

如下[java]












[/java]

加上你的方法表达式就可以了

cxf NTLM 客户端验证(Spring 配置)

FormServiceSoap cs = (FormServiceSoap) ctx.getBean("client");
Client client = ClientProxy.getClient("http://10.188.12.7/formservice.asmx?wsdl");
HTTPConduit http = (HTTPConduit) client.getConduit();
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setConnectionTimeout(36000);
httpClientPolicy.setAllowChunking(false);
http.setClient(httpClientPolicy);
http.getAuthorization().setAuthorizationType("NTLM");
http.getAuthorization().setUserName("xxxx");
http.getAuthorization().setPassword("xxxxx");
URL wsdlURL = FormService.WSDL_LOCATION;
#boolean port = cs.createSystemError("123", "456", "789", "0123", true); 这个是我用cxf自动生成的一个web service方法
System.out.println(port);

主要spring 配置文件

<bean id="client" class="org.tempuri.FormServiceSoap"
        factory-bean="clientFactory" factory-method="create" />

    <bean id="clientFactory"
        class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
        <property name="serviceClass" value="org.tempuri.FormServiceSoap" />
        <property name="address" value="http://sharepoint/formservice.asmx?wsdl" />
    </bean>