Hi,
We want to use JPA as Persistence Layer (EclipseLink as Persistence Provider) in a Spring managed Bean in a SOA Composite (SCA).
We configured our persistence.xml and spring configuration as described below.
We are using JDeveloper 11.1.1.3 and WLS 10.3.3 with SOA Suite 11.1.1.3.
The Deployment fails with the following Exception
+Could not instantiate bean class [org.springframework.instrument.classloading.weblogic.WebLogicLoadTimeWeaver]: Constructor threw exception; nested exception is java.lang.IllegalStateException: Could not initialize WebLogic ClassLoader because WebLogic 10 API classes are not available+
We are not sure how to deal with the "WebLogic 10 API classes are not available" message. Is there a lib we have to add to the SCA composite or do we have to change the WLS configuration somehow?
We already tried a lot of configurations of persistence.xml and spring but nothing worked so far.
Exception
Caused By: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'loadTimeWeaver' defined in URL [oramds:/deployed-composites/default/ProjectBServiceSCA_rev1.0/ProjectBServiceSCA.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.instrument.classloading.weblogic.WebLogicLoadTimeWeaver]: Constructor threw exception; nested exception is java.lang.IllegalStateException: Could not initialize WebLogic ClassLoader because WebLogic 10 API classes are not available
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:883)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:839)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
Truncated. see log file for complete stacktrace
Caused By: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.instrument.classloading.weblogic.WebLogicLoadTimeWeaver]: Constructor threw exception; nested exception is java.lang.IllegalStateException: Could not initialize WebLogic ClassLoader because WebLogic 10 API classes are not available
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:115)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:61)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:877)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:839)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)
Truncated. see log file for complete stacktrace
Caused By: java.lang.IllegalStateException: Could not initialize WebLogic ClassLoader because WebLogic 10 API classes are not available
at org.springframework.instrument.classloading.weblogic.WebLogicClassLoader.<init>(WebLogicClassLoader.java:70)
at org.springframework.instrument.classloading.weblogic.WebLogicLoadTimeWeaver.<init>(WebLogicLoadTimeWeaver.java:57)
at org.springframework.instrument.classloading.weblogic.WebLogicLoadTimeWeaver.<init>(WebLogicLoadTimeWeaver.java:46)
at sun.reflect.GeneratedConstructorAccessor768.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
Truncated. see log file for complete stacktrace
Caused By: java.lang.NoSuchMethodException: oracle.classloader.PolicyClassLoader.addInstanceClassPreProcessor(weblogic.utils.classloaders.ClassPreProcessor)
at java.lang.Class.getMethod(Class.java:1605)
at org.springframework.instrument.classloading.weblogic.WebLogicClassLoader.<init>(WebLogicClassLoader.java:62)
at org.springframework.instrument.classloading.weblogic.WebLogicLoadTimeWeaver.<init>(WebLogicLoadTimeWeaver.java:57)
at org.springframework.instrument.classloading.weblogic.WebLogicLoadTimeWeaver.<init>(WebLogicLoadTimeWeaver.java:46)
at sun.reflect.GeneratedConstructorAccessor768.newInstance(Unknown Source)
Truncated. see log file for complete stacktrace
persistence.xml
<?xml version="1.0" encoding="Cp1252" ?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
<persistence-unit name="SCASpringJPATest">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>performanceTestDS</jta-data-source>
<class>de.prototype.entities.Mainproject</class>
<class>de.prototype.entities.Project</class>
<properties>
<property name="eclipselink.target-server" value="WebLogic_10"/>
<property name="javax.persistence.jtaDataSource"
value="performanceTestDS"/>
</properties>
</persistence-unit>
</persistence>
spring.xml
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:lang="http://www.springframework.org/schema/lang"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:sca="http://xmlns.oracle.com/weblogic/weblogic-sca"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-2.5.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd http://www.springframework.org/schema/tool http://www.springframework.org/schema/tool/spring-tool-2.5.xsd http://xmlns.oracle.com/weblogic/weblogic-sca META-INF/weblogic-sca.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
<!--Spring Bean definitions go here-->
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceUnitName" value="ProjectBServiceSCA"/>
<property name="loadTimeWeaver">
<bean class="org.springframework.instrument.classloading.weblogic.WebLogicLoadTimeWeaver"/>
</property>
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter">
<property name="showSql" value="true"/>
<property name="generateDdl" value="true"/>
<property name="database" value="ORACLE"/>
</bean>
</property>
</bean>
<bean class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor"/>
<bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"/>
<tx:annotation-driven transaction-manager="txManager"/>
<bean id="txManager"
class="org.springframework.transaction.jta.WebLogicJtaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory"/>
</bean>
<bean class="de.prototype.service.ProjectBServiceSCAImpl"
id="projectBService">
<property name="entityManagerFactory" ref="entityManagerFactory"/>
</bean>
<sca:service target="projectBService" name="projectBServiceSCA"
type="de.prototype.service.IProjectBServiceSCA"/>
</beans>