i have to migrate our processes from glassfish+open esb to apache tomcat+apache ode..
in this post, i simply note down differences or additions to the above prior post.
first of all, this time, i used latest versions:
- apache ode : 1.3.4 instead of 1.3.3
- apache tomcat: 7.0.5 instead of 6.0.24
- metro: 2.0.1 instead of 2.0
CATALINA_HOME, JAVA_HOME and JRE_HOME environment variables are defined properly.While installing metro on tomcat, i used the command
ant -f metro-on-tomcat.xml installand there is luckily no problems due to version changes..
the correct arrangement of
web.xml and creation of sun-jaxws.xml under project-home/web/WEB-INF is not straightforward this time, since there is a number of web services deployed in the same .war file. so, i want to explain the details..here some links:
a small tip: after rewriting
web.xml and sun-jaxws.xml, in order to prepare the .war file under dist folder, right click and build the project in netbeans ide.. choosing clean and build results in wiping out sun-jaxws.xml and overwriting web.xml..a sample web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <description>Balistika2010Ws</description> <display-name>Balistika2010Ws</display-name> <listener> <listener-class>com.sun.xml.ws.transport.http.servlet.WSServletContextListener</listener-class> </listener> <servlet> <description>JAX-WS endpoint - Service1</description> <display-name>Service1</display-name> <servlet-name>Service1</servlet-name> <servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>Service1</servlet-name> <url-pattern>/ode/processes/Service1</url-pattern> </servlet-mapping> <servlet> <description>JAX-WS endpoint - Service2</description> <display-name>Service2</display-name> <servlet-name>Service2</servlet-name> <servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>Service2</servlet-name> <url-pattern>/ode/processes/Service2</url-pattern> </servlet-mapping> <session-config> <session-timeout>60</session-timeout> </session-config> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> </web-app>a sample corresponding sun-jaxws.xml
<?xml version="1.0" encoding="UTF-8"?>
<endpoints xmlns='http://java.sun.com/xml/ns/jax-ws/ri/runtime' version='2.0'> <endpoint name='Service1' implementation='tr.gov.tubitak.service.Service1' url-pattern='/ode/processes/Service1'/> <endpoint name='Service2' implementation='tr.gov.tubitak.service.Service2' url-pattern='/ode/processes/Service2'/></endpoints>The
url-pattern attributes in web.xml and sun-jaxws.xml should match.The
implementation attribute is the web service itself..However, tomcat throws the following error:
SEVERE: WSSERVLET11: failed to parse runtime descriptor: javax.xml.ws.WebServiceException: Unable to create JAXBContextjavax.xml.ws.WebServiceException: Unable to create JAXBContext at com.sun.xml.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:166)...Caused by: java.security.PrivilegedActionException: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptionsjavax.persistence.EntityManager is an interface, and JAXB can't handle interfaces. this problem is related to the following location: at javax.persistence.EntityManager at public javax.persistence.EntityManager tr.gov.tubitak.uzay.balistika2010.sas.service.series.jaxws.MergeAbsEvidGrpsInCase.arg1 at tr.gov.tubitak.uzay.balistika2010.sas.service.series.jaxws.MergeAbsEvidGrpsInCasejavax.persistence.EntityManager does not have a no-arg default constructor.The error is due to the fact that i pass
EntityManager between (public) method calls in order to preserve my transactions.. see this for details: http://hilaltarakci.blogspot.com/2010/12/persistence-using-jpa.htmlso, how to fix this? for now, i redesigned the code in such a way that
EntityManager passing methods are all defined as private..in fact, defining problematic methods as private solved some other weird errors as well.. i do not record them, since i did not understand their nature!!
at this point, web services are all deployed successfully and i can see wsdl s..
now the bpel part.. if you do not bind all partner links that is used in mentioned process in
deploy.xml, you get the following error: 16:52:58,729 ERROR [NStateLatch] Latch error, was releasing for state 1 but actually in -116:52:58,731 WARN [ProcessStoreImpl] Deployment failed within the engine, store undeploying process.java.lang.IllegalArgumentException: SecurityPL must be bound to an endpoint in deploy.xml at org.apache.ode.bpel.engine.BpelProcess.setRoles(BpelProcess.java:519)
deploy.xml of ode-home/examples/DynPartner is a good sample..now, it is time to test deployed processes from a java client.. i created client side artifacts from manually written wsdl in the deployed bpel module, not from the endpoint itself..
when i called the process from the client, i got the following error:
SEVERE: org.objectweb.asm.ClassWriter.(I)V java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.(I)V at net.sf.cglib.core.DebuggingClassWriter.(DebuggingClassWriter.java:47) ...at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:126) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:33) at tr.gov.tubitak.uzay.balistika2010.sas.dao.base.BlsEntityManager.getEm(BlsEntityManager.java:20) at tr.gov.tubitak.service.Service1.method1(Service1.java:116)no need to say, the process calls a web service which persists data inside a transaction.. according to http://www.myeclipseide.com/PNphpBB2-viewtopic-t-24287.html, the error was due to conflicting
asm.jar s around.. actually, i faced the same problem before in a different environment: http://hilaltarakci.blogspot.com/2010/02/javalangnosuchmethoderror.htmlin deployed web services library,
asm.jar was of version 1.5.3; upgrading it to version 3.3.1 solved the mentioned error..last update on 29.12.2010, 11:30..