Archive

Articles taggués ‘PEtALS’

JSR181 Tip#1

26/11/2008 Aucun commentaire

Here is a tip on the PEtALS JSR181 Service Engine (which is also available for all JSR181 annotated classes outside of PEtALS).

Today, I spent some time on a customer bug which was not really a bug… I was quite surprising when he said me that he was unable to get its annotated class working on the component. The error was at instantiation time (first JBI message handling) :

org.apache.axis2.AxisFault: The service is unable to load the foo.bar.Service service implementation class. at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430) at org.apache.axis2.jaxws.server.JAXWSMessageReceiver.receive(JAXWSMessageReceiver.java:220) at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:176) at org.ow2.petals.se.jsr181.JBIListener.onJBIMessage(JBIListener.java:120) at org.ow2.petals.component.framework.listener.MessageExchangeProcessor.processInOutAsProvider(MessageExchangeProcessor.java:524) at org.ow2.petals.component.framework.listener.MessageExchangeProcessor.processAsProvider(MessageExchangeProcessor.java:421) at org.ow2.petals.component.framework.listener.MessageExchangeProcessor.process(MessageExchangeProcessor.java:308) at org.ow2.petals.component.framework.listener.MessageExchangeProcessor.run(MessageExchangeProcessor.java:145) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) at java.lang.Thread.run(Thread.java:619) Caused by: javax.xml.ws.WebServiceException: The service is unable to load the org.ow2.petals.usecase.jsr181.TestService service implementation class. at org.apache.axis2.jaxws.ExceptionFactory.createWebServiceException(ExceptionFactory.java:173) at org.apache.axis2.jaxws.ExceptionFactory.makeWebServiceException(ExceptionFactory.java:70) at org.apache.axis2.jaxws.ExceptionFactory.makeWebServiceException(ExceptionFactory.java:118) at org.apache.axis2.jaxws.server.endpoint.lifecycle.impl.EndpointLifecycleManagerImpl.createServiceInstance(EndpointLifecycleManagerImpl.java:242) at org.apache.axis2.jaxws.server.endpoint.lifecycle.impl.EndpointLifecycleManagerImpl.createServiceInstance(EndpointLifecycleManagerImpl.java:94) at org.apache.axis2.jaxws.server.ServiceInstanceFactoryImpl.createServiceInstance(ServiceInstanceFactoryImpl.java:49) at org.apache.axis2.jaxws.server.EndpointController.handleRequest(EndpointController.java:253) at org.apache.axis2.jaxws.server.EndpointController.invoke(EndpointController.java:98) at org.apache.axis2.jaxws.server.JAXWSMessageReceiver.receive(JAXWSMessageReceiver.java:159) … 9 more

So what? I launched PEtALS in debug mode, and going step by step until the foo.bar.Service class instantiation. ‘Hey what’s up InstanciationException?’.
This is simply because the foo.bar.Service class contains constructors and not the empty one!

The solution is to remove all the constructors which are not very usefull here (since they can not be used), or add an empty constructor. Now it works!

Creating a JBI Component with PEtALS CDK (Part 1)

24/10/2008 un commentaire

Here is a series of articles about how to create a JBI Component with the PEtALS Component Development Kit (CDK).
The current one describes how to create the project structure with the PEtALS Maven archetypes, how to use it in Eclipse and how to package it as a JBI component.

Create the project structure

(I assume that Maven is installed and is in the path, if not please refer to the Apache Maven website).

mvn archetype:create
-DarchetypeGroupId=org.ow2.petals
-DarchetypeArtifactId=maven-archetype-petals-jbi-service-engine
-DarchetypeVersion=1.3.0-SNAPSHOT
-DgroupId=com.ebmws.petals
-DartifactId=petals-se-sample
-Dversion=1.0-SNAPSHOT

This will create the standard component structure.
You can check the JBI descriptor in petals-se-sample/src/main/jbi. Note that some fields such as the classpath are automatically filled during the packaging phase from the dependencies specified in your POM descriptor.

Create the Eclipse project

cd petals-se-sample
mvn eclipse:eclipse

In Eclipse, import the project and you will get

Do your business code

Now in the JBIListener class, you can implement the business logic which will be called when a JBI message is received in the activated JBI Endpoind (How to activate endpoint will come in the next article).

For example, just say hello to the world in the JBIListener like this :

Package the component

Simply package it with
mvn install

You will get a ZIP archive in the target directory which is the component you can deploy in PEtALS container

The source of this component are available here http://christophe.hamerling.free.fr/ebm/blog/tuto/cdk/petals-se-sample.zip

Categories: PEtALS Tags: , ,