Announcement Announcement Module
Collapse
No announcement yet.
Spring/JPA on Websphere Community Edition (WASCE) 2.1 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring/JPA on Websphere Community Edition (WASCE) 2.1

    Hi everyone,

    I'm curious if anyone succeeded in deploying a Spring powered app to Websphere Application Server Community Edition 2.1.
    I added a JPA DAO implementation to this example to try out if this can be done, with no result so far.
    Everything works with simple JDBC, problem comes with JPA...

    I get the following exception when trying to deploy the web module.
    Code:
    2009-06-01 19:42:50,609 ERROR [[/contact]] Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contactDAO' defined in ServletContext resource [/WEB-INF/contact-data.xml]: Cannot resolve reference to bean 'entityManagerFactory' while setting bean property 'entityManagerFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/contact-data.xml]: Cannot create inner bean 'org.springframework.instrument.classloading.ReflectiveLoadTimeWeaver#14be93a' of type [org.springframework.instrument.classloading.ReflectiveLoadTimeWeaver] while setting bean property 'loadTimeWeaver'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.instrument.classloading.ReflectiveLoadTimeWeaver#14be93a' defined in ServletContext resource [/WEB-INF/contact-data.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.instrument.classloading.ReflectiveLoadTimeWeaver]: Constructor threw exception; nested exception is java.lang.IllegalStateException: ClassLoader [org.apache.geronimo.kernel.classloader.JarFileClassLoader] does NOT provide an 'addTransformer(ClassFileTransformer)' method.
    	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275)
    	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1245)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
    	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
    	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
    	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)
    	at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
    	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
    	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
    	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3839)
    	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4332)
    	at org.apache.geronimo.tomcat.GeronimoStandardContext.access$201(GeronimoStandardContext.java:63)
    	at org.apache.geronimo.tomcat.GeronimoStandardContext$SystemMethodValve.invoke(GeronimoStandardContext.java:398)
    	at org.apache.geronimo.tomcat.valve.GeronimoBeforeAfterValve.invoke(GeronimoBeforeAfterValve.java:47)
    	at org.apache.geronimo.tomcat.GeronimoStandardContext.start(GeronimoStandardContext.java:251)
    	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
    	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
    	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
    	at org.apache.geronimo.tomcat.TomcatContainer.addContext(TomcatContainer.java:364)
    	at org.apache.geronimo.tomcat.TomcatWebAppContext.doStart(TomcatWebAppContext.java:512)
    	at org.apache.geronimo.gbean.runtime.GBeanInstance.createInstance(GBeanInstance.java:998)
    	at org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStart(GBeanInstanceState.java:267)
    	at org.apache.geronimo.gbean.runtime.GBeanInstanceState.start(GBeanInstanceState.java:101)
    	at org.apache.geronimo.gbean.runtime.GBeanInstance.start(GBeanInstance.java:541)
    	at org.apache.geronimo.gbean.runtime.GBeanDependency.attemptFullStart(GBeanDependency.java:111)
    	at org.apache.geronimo.gbean.runtime.GBeanDependency.addTarget(GBeanDependency.java:146)
    	at org.apache.geronimo.gbean.runtime.GBeanDependency$1.running(GBeanDependency.java:120)
    	at org.apache.geronimo.kernel.basic.BasicLifecycleMonitor.fireRunningEvent(BasicLifecycleMonitor.java:176)
    	at org.apache.geronimo.kernel.basic.BasicLifecycleMonitor.access$300(BasicLifecycleMonitor.java:44)
    	at org.apache.geronimo.kernel.basic.BasicLifecycleMonitor$RawLifecycleBroadcaster.fireRunningEvent(BasicLifecycleMonitor.java:254)
    	at org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStart(GBeanInstanceState.java:293)
    	at org.apache.geronimo.gbean.runtime.GBeanInstanceState.start(GBeanInstanceState.java:101)
    	at org.apache.geronimo.gbean.runtime.GBeanInstanceState.startRecursive(GBeanInstanceState.java:123)
    
    etc..
    Here is my spring config for the data layer:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    	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.xsd">
    
    	<bean id="contactDAO" class="com.sample.dao.ContactDAOJPA">
    		<property name="entityManagerFactory" ref="entityManagerFactory" />
    	</bean>
    	
    	<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
    		<property name="dataSource" ref="dataSourceWASCE" />
    		<property name="jpaVendorAdapter">
    			<bean class="org.springframework.orm.jpa.vendor.TopLinkJpaVendorAdapter">
    				<property name="showSql" value="true" />
    				<property name="generateDdl" value="true" />
    				<property name="databasePlatform" value="oracle.toplink.essentials.platform.database.MySQL4Platform" />
    			</bean>
    		</property>
    
    		<property name="loadTimeWeaver">
    			<bean class="org.springframework.instrument.classloading.ReflectiveLoadTimeWeaver" />
    		</property>
    
    	</bean>
    	
    	<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
    		<property name="entityManagerFactory" ref="entityManagerFactory" />
    		<property name="dataSource" ref="dataSourceWASCE" />
    	</bean>
    
    	<bean id="dataSourceWASCE" class="org.springframework.jndi.JndiObjectFactoryBean">
    		<property name="jndiName" value="java:comp/env/jdbc/ContactDataSource" />
    		<property name="lookupOnStartup" value="false" />
    		<property name="cache" value="true" />
    		<property name="proxyInterface" value="javax.sql.DataSource" />
    	</bean>
    	
    </beans>
    I have the spring-tomcat-weaver importer in shared repository (as org.springframework/spring-tomcat-weaver/2.5.6/jar).

    Am I missing something, or is this a WASCE issue?
    Thanks for any info

  • #2
    Spring and WASCE

    There are a lot of libraries in the WASCE repository and many of them may conflict with the libraries that you would like to use and that are included in your WEB-INF/lib directory. If you are depending on libraries in your WEB-INF/lib, you may want to add the following to the geronimo-web.xml file to ignore WASCE's library packages and load your application's libraries first.

    Code:
    <hidden-classes>
      <filter>javax.persitence</filter>
      <filter>javax.xml.transform</filter>
      <filter>org.springframework</filter>
    </hidden-classes>
    <inverse-classloading/>
    I understand the ideas behind the extra Geronimo XML files for your Web application deployment, module definition and dependencies, but we do not need another XML file in our Java projects, in my opinion.

    Comment

    Working...
    X