6 Mart 2010 Cumartesi

migration from open esb + glassfish to apache tomcat + ode

In our project, we develop web services using jax-ws and deploy them to glassfish v2 coming with netbeans 6.5 ide. btw, we installed netbeans 6.5 with open esb selected, since we use it for our bpel s. Bpels are also deployed to the same glassfish as web services. Development and deployment are quite easy and fast. However, when we ran all the bpels one after the other during unit tests, the server seems to be very slow and after a few runs out of memory error comes up.. we tried to configure glassfish, but it did not work as we expected.. (the database is postgresql, but currently this is irrelevant.)

So, now i want to deploy web services and bpels to apache-tomcat-6.0.24 + apache-ode-war-1.3.3 just to see what happens.. (in order to deploy ode to tomcat, just download the zip files, extract them and copy ode.war under webapps folder of tomcat and start tomcat..)
Now, lets follow the migration step by step..

The first step is deploying war of web services generated by netbeans (under dist folder of the project) to tomcat. So, i just copied the war file under tomcat-home/webapps and restarted the server. As i expected, the deployment seemed successful in terms of a regular web application, however it can not process the web services since no wsit runtime is installed on tomcat. (in other words, i can not see the wsdl..) In order to fix this, we have to install metro on tomcat.. a helpful link is http://blog.theunical.com/webservers/tomcat/installation-and-configuration-of-jax-ws-metro-on-tomcat-6/
following the link,
  • i downloaded and unzipped metro 2.0,
  • edited tomcat-home/conf/catalina.properties by replacing shared.loader= line with shared.loader=metro-home/lib/*.jar,
  • set CATALINA_HOME environment variable with the command export CATALINA_HOME=path to tomcat-home and chech with echo $CATALINA_HOME
  • run the command ant -f metro-on-tomcat.xml from metro-home
changes in web service project (generated in netbeans ide as netbeans project):
we have to modify web.xml and add sun-jaxws.xml under project-home/web/WEB-INF in netbeans project. actually, i got help from fromjava example of metro samples package for figuring out how to change the configuration files.
  • in web.xml, add servlet definitions and in sun-jaxws.xml modify endpoint definitions accordingly..
  • build the project in netbeans and copy the war under project-home/dist folder to tomcat-home/webapps folder for deployment.
now, you should see the wsdl at the endpoint you specified in sun-jaxws.xml.

At this point, we have deployed web services successfully, and now is the time to deploy the bpels..

Bpel files and the corresponding wsdl are collected under a bpel module of netbeans ide.
The major necessity is a deploy.xml. Get one from ode-home/examples folder and copy under bpel-module-home. i used the one from sample HelloWorld2.
here is some info about ode deployment descriptor: http://ode.apache.org/creating-a-process.html

After modifying deploy.xml, clean and build the netbeans bpel module.
Before deploying your actual bpel module under tomcat-home/webapps/ode/WEB-INF/processes folder, you may want to try one of the samples coming with ode package just to see if it is working on its own samples.. It is good to note that the bpels i am about to deploy are using the above deployed web services..

Now, lets try to note down what i have to change:
  • some minor namespace errors come up, but they were easy to solve, just read the error log in tomcat-come/logs/catalina.out file.
  • the major restriction is it forced all endpoint addreses to format http://hostname:port/ode/processes/myProcessEndpointName for example http://localhost:8080/Balistika2010Ws/ode/processes/SeriesServiceService?wsdl and http://localhost:8080/ode/processes/AddParameter?wsdl are both valid endpoints..
now, build the bpel module in netbeans and make sure thedeploy.xml is under build folder, if it is not, copy it manually and copy the build folder under tomcat-home/webapps/ode/processes . you may want to rename the folder build with a more meaningful name.
now, check http://localhost:8080/ode/processes.html. If successful, the process must be seen at that address..
An important point is the wsdls for bpels are generated with axis2 anymore because of ode, not jaxws..

Some errors due to the differtence between bpel engines might arise.. For instance i got the following error from my previosly working bpel:

javax.xml.ws.soap.SOAPFaultException: axis2ns62:selectionFailure
at com.sun.xml.internal.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:178)
at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:111)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:108)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78)
at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:107)
at $Proxy33.lightLoginWsdlOperation(Unknown Source)
at odebpelclient.Main.main(Main.java:28)

Here is a discussion about the problem: http://mail-archives.apache.org/mod_mbox/ode-user/200810.mbox/%3Cfbdc6a970810200738i75692ac6qb47d3263e9aefe1c@mail.gmail.com%3E
Ode does not automatically initialize the variables, since this is not part of the standard.. This might be an extension provided by Open Esb.. So, lets initialize all the variables and redeploy..

i end this post here, i think the point is clear..

Note: btw, x-home in italics means the location where x is installed.

Edit on 8/3/2010, 14:08:
i get the following error when i called one of the bpels from client:

from server log:
DEBUG - GeronimoLog.debug(66) | Fault response message: {http://docs.oasis-open.org/wsbpel/2.0/process/executable}uninitializedPartnerRole

from client log:
javax.xml.ws.soap.SOAPFaultException: axis2ns6:uninitializedPartnerRole
at com.sun.xml.internal.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:178)
at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:111)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:108)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78)
at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:107)
at $Proxy33.lightLoginWsdlOperation(Unknown Source)
at odebpelclient.Main.main(Main.java:28)

himm, that error was due to a mistake in deploy.xml of bpels.. i had to use keyword invoke instead of provide for invoked web services. So, for writing deploy.xml file, ode-home/examples/DynPartner maybe a better example than HelloWorld2.
and besides, check the existence of initializePartnerRole=yes attribute, when partnerRole exists in partner link.
That solution worked for me :)

Edit on 10/3/2010, 11:37:
in our case, we want to write bpel s that works both with ode and open esb. Here is an example variable initialization that works with both:

<copy>
<from>
<literal>
<ns1:authorizeUserResponse>
<ns1:return> </ns1:return>
</ns1:authorizeUserResponse>
</literal>
</from>
<to variable="AuthorizeUserOut" part="parameters"/>
</copy>

btw, the empty string between returns is necessary..