Bug 780247 (SOA-2644)

Summary: CXF does not support WS extensions with EJB3 based services
Product: [JBoss] JBoss Enterprise SOA Platform 5 Reporter: Martin Vecera <mvecera>
Component: JBossWSAssignee: Default User <jbpapp-maint>
Status: CLOSED NOTABUG QA Contact:
Severity: urgent Docs Contact:
Priority: urgent    
Version: 5.1.0.ER4CC: darran.lofthouse, mvecera
Target Milestone: ---Keywords: Regression
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
URL: http://jira.jboss.org/jira/browse/SOA-2644
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
SOA-P switched to CXF
Last Closed: 2010-12-06 18:32:30 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
Quickstart_helloworld_ejb3_1.jar
none
Quickstart_helloworld_ejb3_2.jar
none
helloworld_ejb3_src.tar.bz2
none
PhoneBook_EJB_UsernameToken.tgz none

Description Martin Vecera 2010-12-06 13:19:23 UTC
project_key: SOA

For one to be able to use WS extensions, jbossws-cxf.xml must be configured properly. With servlet based WS this is no problem since the file can be placed within WEB-INF directory inside the war.

With EJB3 based web services, it is not possible to have WEB-INF directory inside the jar file (the jar file will be completely ignored by AS).

The configuration file can be placed inside META-INF but every try to access the service throws an exception.

Attached are two files. The first one (*_1.jar) is working but does not support WS-S. After deployment, you can access http://localhost:8080/Quickstart_helloworld_ejb3/HelloWorldEjbWSBean?wsdl. The second one (*_2.jar) contains META-INF/jbossws-cxf.xml file. It is even not possible to access WSDL. Instead, the following exception is thrown:

javax.servlet.ServletException: Servlet.init() for servlet HelloWorldEjbWSBean threw exception
	org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:183)
	org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:95)
	org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
	org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
	org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
	org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
	org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:451)
	java.lang.Thread.run(Thread.java:619)

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'HelloWorldEjbWS': Invocation of init method failed; nested exception is javax.xml.ws.WebServiceException: java.lang.RuntimeException: Soap 1.1 endpoint already registered on address http://localhost:8080/Quickstart_helloworld_ejb3_jar
	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)
	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
	java.security.AccessController.doPrivileged(Native Method)
	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
	org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
	org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
	org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
	org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
	org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
	org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
	org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
	org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
	org.jboss.wsf.stack.cxf.CXFServletExt.loadAdditionalConfigExt(CXFServletExt.java:151)
	org.jboss.wsf.stack.cxf.CXFServletExt.loadBus(CXFServletExt.java:109)
	org.apache.cxf.transport.servlet.AbstractCXFServlet.init(AbstractCXFServlet.java:78)
	org.jboss.wsf.stack.cxf.CXFServletExt.init(CXFServletExt.java:79)
	org.jboss.internal.soa.esb.soap.cxf.ESBCXFServletExt.init(ESBCXFServletExt.java:38)
	org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:183)
	org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:95)
	org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
	org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
	org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
	org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
	org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:451)
	java.lang.Thread.run(Thread.java:619)

With native WS, it was possible to use WS extensions with pure EJB3 endpoints.

Comment 1 Martin Vecera 2010-12-06 13:20:23 UTC
Attachment: Added: Quickstart_helloworld_ejb3_1.jar


Comment 2 Martin Vecera 2010-12-06 13:21:26 UTC
Attachment: Added: Quickstart_helloworld_ejb3_2.jar


Comment 3 Martin Vecera 2010-12-06 13:24:52 UTC
Attached sources.

Comment 4 Martin Vecera 2010-12-06 13:24:52 UTC
Attachment: Added: helloworld_ejb3_src.tar.bz2


Comment 5 Darran Lofthouse 2010-12-06 13:30:08 UTC
What error do you get for _1.jar ?  Locally I have a project I know worked in the past to enable WS-Security Username Token validation for an EJB3 endpoint with CXF on EAP 5.1.0

Comment 6 Martin Vecera 2010-12-06 15:10:08 UTC
There is no error for _1.jar except it does not support WS-S. I know about a workaround, because you can have EJBs in a war in JEE6, but this is not what I originally wanted. Can you provide me with your project for me to give it a try? Thanks!

Comment 7 Darran Lofthouse 2010-12-06 15:13:15 UTC
What do you mean when you say it does not support WS-Security?  Are you saying the inbound message with a WS-Security header is not processed?


Comment 8 Darran Lofthouse 2010-12-06 16:17:43 UTC
Attached is a simple Eclipse / Ant project to deploy an EJB3 based endpoint with WS-Security / Username Token being used for the authentication.

Comment 9 Darran Lofthouse 2010-12-06 16:17:43 UTC
Attachment: Added: PhoneBook_EJB_UsernameToken.tgz


Comment 10 Martin Vecera 2010-12-06 18:32:22 UTC
Many thanks Darran. I was able to make it work using your sample application. I needed to specify even the bean name in jbossws-cxf.xml in the address attribute.