You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by roshansn <sn...@gmail.com> on 2010/02/23 12:54:37 UTC

How to install two service units with same service and two namespaces

I wanted to install two service unit which expose same service inside the
servicemix. 
I used servicemix-jsr181 componenet and it can be easily installed inside
the servicemix.
Following show my service implementation class.

	public class DestinationHelloServicePojo implements
DestinationHelloServiceBI{

	private static long times = 0;

	public String hello(String phrase) {
		
		System.out.println("DestinationHelloServiceBean.hello{" + (++times) +
"}...");
		return "From DestinationHelloServiceBean : HELLO!! You just said :" +
phrase;
	}

}

This service implementation classes are same in each service unit. But I
changed the namespace of the each service as below.
jsr181 has given that facility to change the service name within the
xbean.xml file.

xbean.xml file of the first service unit.
namespace : http://servicemix.apache.org/samples/wsdl-first

<beans  xmlns:jsr181="http://servicemix.apache.org/jsr181/1.0"
       xmlns:person="http://servicemix.apache.org/samples/wsdl-first">

   <jsr181:endpoint annotations="none"
service="person:NotificationAdminService"
serviceInterface="org.apache.servicemix.samples.wsdl_first.DestinationHelloServiceBI">
    <jsr181:pojo>
      <bean
class="org.apache.servicemix.samples.wsdl_first.DestinationHelloServicePojo">
      </bean>
    </jsr181:pojo>
  </jsr181:endpoint>
</beans>

xbean.xml file of the second service unit.
namespace : http://servicemix.apache.org/samples/wsdl--second

<beans  xmlns:jsr181="http://servicemix.apache.org/jsr181/1.0"
       xmlns:person="http://servicemix.apache.org/samples/wsdl-second">

  <jsr181:endpoint annotations="none"
service="person:NotificationAdminService"
serviceInterface="org.apache.servicemix.samples.wsdl_first.DestinationHelloServiceBI">
    <jsr181:pojo>
      <bean
class="org.apache.servicemix.samples.wsdl_first.DestinationHelloServicePojo">
      </bean>
    </jsr181:pojo>
  </jsr181:endpoint>
</beans>

This approch is working properly inside the ESB. Now i want to move to
jsr181 to cxf-se. As they described in the documentation i configured 
xbean.xml as below.

<beans xmlns:cxfse="http://servicemix.apache.org/cxfse/1.0"
	xmlns:person="http://servicemix.apache.org/samples/wsdl-first">
<cxfse:endpoint service="person:NotificationAdminService">
		<cxfse:pojo>
			<bean
			
class="org.apache.servicemix.samples.wsdl_first.DestinationHelloServicePojo">
			</bean>
		</cxfse:pojo>
</cxfse:endpoint>
</beans>

<beans xmlns:cxfse="http://servicemix.apache.org/cxfse/1.0"
	xmlns:person="http://servicemix.apache.org/samples/wsdl-second">
<cxfse:endpoint service="person:NotificationAdminService">
		<cxfse:pojo>
			<bean
			
class="org.apache.servicemix.samples.wsdl_first.DestinationHelloServicePojo">
			</bean>
		</cxfse:pojo>
</cxfse:endpoint>
</beans>

But this is not working. It thorows following exception. Anyone have an idea
how to install two service unith with same service and different namespaces.

<jbi-task xmlns="http://java.sun.com/xml/ns/jbi/management-message"
version="1.0">
<jbi-task-result>
<frmwk-task-result>
<frmwk-task-result-details>
<task-result-details>
<task-id>deploy</task-id>
<task-result>FAILED</task-result>
<message-type>ERROR</message-type>
</task-result-details>
</frmwk-task-result-details>
</frmwk-task-result>
<component-task-result
xmlns="http://java.sun.com/xml/ns/jbi/management-message">
        <component-name>servicemix-cxf-se</component-name>
        <component-task-result-details>
                <task-result-details>
                        <task-id>deploy</task-id>
                        <task-result>SUCCESS</task-result>
                </task-result-details>
        </component-task-result-details>
</component-task-result>
<component-task-result
xmlns="http://java.sun.com/xml/ns/jbi/management-message">
        <component-name>servicemix-cxf-se</component-name>
        <component-task-result-details>
                <task-result-details>
                        <task-id>deploy</task-id>
                        <task-result>FAILED</task-result>
                        <message-type>ERROR</message-type>
                        <task-status-msg>
<msg-loc-info>
<loc-token/>
<loc-message>Could not deploy xbean service unit</loc-message>
</msg-loc-info>
</task-status-msg>
                        <exception-info>
                                <nesting-level>1</nesting-level>
                                <msg-loc-info>
                                        <loc-token/>
                                       
<loc-message>org.apache.cxf.service.factory.ServiceConstructionException</loc-message>
                                       
<stack-trace><![CDATA[javax.xml.ws.WebServiceException:
org.apache.cxf.service.factory.ServiceConstructionException
        at
org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:275)
        at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:209)
        at
org.apache.servicemix.cxfse.CxfSeEndpoint.validate(CxfSeEndpoint.java:335)
        at
org.apache.servicemix.common.AbstractDeployer.validate(AbstractDeployer.java:58)
        at
org.apache.servicemix.common.xbean.BaseXBeanDeployer.validate(BaseXBeanDeployer.java:55)
        at
org.apache.servicemix.common.xbean.AbstractXBeanDeployer.deploy(AbstractXBeanDeployer.java:97)
        at
org.apache.servicemix.common.BaseServiceUnitManager.doDeploy(BaseServiceUnitManager.java:88)
        at
org.apache.servicemix.common.BaseServiceUnitManager.deploy(BaseServiceUnitManager.java:69)
        at
org.apache.servicemix.jbi.framework.DeploymentService.deployServiceAssembly(DeploymentService.java:520)
        at
org.apache.servicemix.jbi.framework.AutoDeploymentService.checkPendingSAs(AutoDeploymentService.java:473)
        at
org.apache.servicemix.jbi.framework.AutoDeploymentService.checkPendingComponents(AutoDeploymentService.java:526)
        at
org.apache.servicemix.jbi.framework.AutoDeploymentService.updateSharedLibrary(AutoDeploymentService.java:313)
        at
org.apache.servicemix.jbi.framework.AutoDeploymentService.updateArchive(AutoDeploymentService.java:253)
        at
org.apache.servicemix.jbi.framework.AutoDeploymentService.monitorDirectory(AutoDeploymentService.java:658)
        at
org.apache.servicemix.jbi.framework.AutoDeploymentService.access$800(AutoDeploymentService.java:63)
        at
org.apache.servicemix.jbi.framework.AutoDeploymentService$1.run(AutoDeploymentService.java:622)
        at java.util.TimerThread.mainLoop(Timer.java:512)
        at java.util.TimerThread.run(Timer.java:462)
Caused by: org.apache.cxf.service.factory.ServiceConstructionException
        at
org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:127)
        at
org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:167)
        at
org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:346)
        at
org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:259)
        ... 17 more
Caused by: java.io.IOException: JBIDestination for Endpoint
{http://servicemix.apache.org/samples/wsdl}destinationHelloService{http://servicemix.apache.org/samples/wsdl}NotificationAdmin
has already been created
        at
org.apache.cxf.transport.jbi.JBITransportFactory.getDestination(JBITransportFactory.java:138)
        at
org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:90)
        at org.apache.cxf.endpoint.ServerImpl.<init>(ServerImpl.java:69)
        at
org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:106)
        ... 20 more
]]></stack-trace>
                                </msg-loc-info>
                        </exception-info>
                </task-result-details>
        </component-task-result-details>
</component-task-result>
<component-task-result
xmlns="http://java.sun.com/xml/ns/jbi/management-message">
        <component-name>servicemix-cxf-bc</component-name>
        <component-task-result-details>
                <task-result-details>
                        <task-id>deploy</task-id>
                        <task-result>SUCCESS</task-result>
                </task-result-details>
        </component-task-result-details>
</component-task-result>
</jbi-task-result>
</jbi-task>

        at
org.apache.servicemix.jbi.framework.ManagementSupport.failure(ManagementSupport.java:125)
        at
org.apache.servicemix.jbi.framework.ManagementSupport.failure(ManagementSupport.java:111)
        at
org.apache.servicemix.jbi.framework.DeploymentService.deployServiceAssembly(DeploymentService.java:555)
        at
org.apache.servicemix.jbi.framework.AutoDeploymentService.checkPendingSAs(AutoDeploymentService.java:473)
        at
org.apache.servicemix.jbi.framework.AutoDeploymentService.checkPendingComponents(AutoDeploymentService.java:526)
        at
org.apache.servicemix.jbi.framework.AutoDeploymentService.updateSharedLibrary(AutoDeploymentService.java:313)
        at
org.apache.servicemix.jbi.framework.AutoDeploymentService.updateArchive(AutoDeploymentService.java:253)
        at
org.apache.servicemix.jbi.framework.AutoDeploymentService.monitorDirectory(AutoDeploymentService.java:658)
        at
org.apache.servicemix.jbi.framework.AutoDeploymentService.access$800(AutoDeploymentService.java:63)
        at
org.apache.servicemix.jbi.framework.AutoDeploymentService$1.run(AutoDeploymentService.java:622)
        at java.util.TimerThread.mainLoop(Timer.java:512)
        at java.util.TimerThread.run(Timer.java:462)

-- 
View this message in context: http://old.nabble.com/How-to-install-two-service-units-with-same-service-and-two-namespaces-tp27702181p27702181.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.