2
votes

I am trying to deploy my application and web service to weblogic using the following versions:

  • Weblogic 10.3.5
  • Hibernate 4.1.1
  • Hibernate JPA API 2.0
  • EJB 2.0
  • Java 6

When I call my web service I get the error

<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
   <S:Body>
      <ns2:Fault xmlns:ns2="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns3="http://www.w3.org/2003/05/soap-envelope">
         <faultcode>ns2:Server</faultcode>
         <faultstring>javax/persistence/OneToMany.orphanRemoval()Z</faultstring>
        <detail>
           <ns2:exception class="java.lang.NoSuchMethodError" note="To disable this feature, set com.sun.xml.ws.fault.SOAPFaultBuilder.disableCaptureStackTrace system property to false" xmlns:ns2="http://jax-ws.dev.java.net/">
               <message>javax/persistence/OneToMany.orphanRemoval()Z</message>
               <ns2:stackTrace>
                  <ns2:frame class="org.hibernate.cfg.AnnotationBinder" file="AnnotationBinder.java" line="1868" method="processElementAnnotations"/>
                  <ns2:frame class="org.hibernate.cfg.AnnotationBinder" file="AnnotationBinder.java" line="768" method="processIdPropertiesIfNotAlready"/>
...

I have checked and there is no other persistence api jars included.

My external jar list is:

  • ant-jakarta-oro-1.6.jar
  • antlr-2.7.2.jar
  • aspectjrt-1.5.3.jar
  • cactus.core.framework.uberjar.javaEE.14-1.8.1.jar
  • cactus.integration.maven2-1.8.1.jar
  • commons-beanutils-1.8.0.jar
  • commons-chain-1.2.jar
  • commons-codec-1.3.jar
  • commons-collections-3.2.1.jar
  • commons-digester-1.8.jar
  • commons-fileupload-1.1.1.jar
  • commons-httpclient-2.0-rc2.jar
  • commons-lang3-3.0.1.jar
  • commons-logging-1.1.1.jar
  • commons-validator-1.3.1.jar
  • dom4j-1.6.1.jar
  • generic-web-service-schema-4.0.jar
  • hibernate-commons-annotations-4.0.1.Final.jar
  • hibernate-core-4.1.1.Final.jar
  • hibernate-jpa-2.0-api-1.0.1.Final.jar
  • httpunit-1.6.jar
  • javassist-3.15.0-GA.jar
  • jboss-logging-3.1.0.GA.jar
  • jboss-transaction-api_1.1_spec-1.0.0.Final.jar
  • js-1.5R4.1.jar
  • jstl-1.0.2.jar
  • jtidy-4aug2000r7-dev.jar
  • junit-3.8.2.jar
  • nekohtml-1.9.6.jar
  • oracle.webservices.standalone.client-11.1.1.jar
  • oro-2.0.8.jar
  • standard-1.0.6.jar
  • struts-core-1.3.10.jar
  • struts-el-1.3.10.jar
  • struts-taglib-1.3.10.jar
  • struts-tiles-1.3.10.jar
  • weblogic-webservices-api-1.1.0.0.jar
  • xercesImpl-2.8.1.jar
  • xml-apis-1.3.03.jar
  • xmlParserAPIs-2.2.1.jar

I have checked these and the Hibernate JPA is the only one with the OneToMany class. I know the problem is a conflict between JPA 1.0 and JPA 2.0 so I just want to know if there is a way around the conflict.

Thanks

2

2 Answers

1
votes

Do you have to use Hibernate JPA API 2.0?

As mentioned in WebLogic doc, WebLogic 10.3.5 seems to roughly support for only one JPA 2.0 provider, which is called TopLink.

Maybe you could just remove the hibernate-jpa-2.0-api-1.0.1.Final.jar from your classpath and try use TopLink as described in the above mentioned WebLogic documentation.

I'll just give a little note given the docs: by default WebLogic 10.3.5 uses JPA 1.0 in order to maintain Java EE 5 compatibility. Since JPA 2.0 is part of Java EE 6, you have to explicitly enable it.

4
votes

WebLogic 10.3.5 can support JPA 2, but only after applying a patch as described in this page: (At least, this is how I got it to work for me.)

It boiled down to editing setDomainEnv.cmd and adding javax.persistence_1.0.0.0_2-0-0.jar and com.oracle.jpa2support_1.0.0.0_2-0.jar to the PRE_CLASSPATH environment variable.

For my Windows XP WebLogic installation I added these lines:

REM Add JARs for JPA 2.0 at the front of the class path.
set WLS_MODULES=%WL_HOME%\..\modules
set PRE_CLASSPATH=%WLS_MODULES%\javax.persistence_1.0.0.0_2-0-0.jar;%WLS_MODULES%\com.oracle.jpa2support_1.0.0.0_2-0.jar

Good Luck,
Randy