openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <cob...@windstream.net>
Subject Can't weave entity in Spring
Date Thu, 01 Jan 1970 00:00:00 GMT
No one has any ideas or feedback?

> 
> From: <cobbra@windstream.net>
> Date: 2008/02/11 Mon AM 09:35:30 CST
> To: <users@openjpa.apache.org>
> Subject: Can't weave entity in Spring
> 
> Hello all,
> 
> I'm having a small problem with entities while deploying OpenJPA 1.0.1 on a Spring 2.5.1
based Tomcat 6 server using an embedded Derby database.
> 
> The exception I'm getting is:
> SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
> java.lang.IllegalStateException: Could not weave class [org/whitetail/sawhorse/model/Configuration]
> 	at org.springframework.orm.jpa.persistenceunit.ClassFileTransformerAdapter.transform(ClassFileTransformerAdapter.java:76)
> 	at org.springframework.instrument.classloading.WeavingTransformer.transformIfNecessary(WeavingTransformer.java:95)
> 	at org.springframework.instrument.classloading.WeavingTransformer.transformIfNecessary(WeavingTransformer.java:78)
> 	at org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader.findResourceInternal(TomcatInstrumentableClassLoader.java:114)
> 	at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1757)
> 	at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:872)
> 	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1325)
> 	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
> 	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
> 	at java.lang.Class.getDeclaredMethods0(Native Method)
> 	at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
> 	at java.lang.Class.getDeclaredMethods(Class.java:1791)
> 	at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:396)
> 	at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:379)
> 	at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findPersistenceMetadata(PersistenceAnnotationBeanPostProcessor.java:364)
> 	at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(PersistenceAnnotationBeanPostProcessor.java:295)
> 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:678)
> 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:419)
> 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:383)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:353)
> 	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:245)
> 	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:169)
> 	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:242)
> 	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
> 	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:400)
> 	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:736)
> 	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:369)
> 	at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:261)
> 	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:3830)
> 	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4337)
> 	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
> 	at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
> 	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
> 	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
> 	at org.apache.catalina.core.StandardService.start(StandardService.java:516)
> 	at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
> 	at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
> 	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
> Caused by: <openjpa-1.0.1-r420667:592145 fatal user error> org.apache.openjpa.util.MetaDataException:
Fields "org.whitetail.sawhorse.model.Configuration.expires, org.whitetail.sawhorse.model.Configuration.id,
org.whitetail.sawhorse.model.Configuration.oplock, org.whitetail.sawhorse.model.Configuration.registrationCode,
org.whitetail.sawhorse.model.Configuration.serviceUrl" are not a default persistent type,
and do not have any annotations indicating their persistence strategy.  If you do not want
these fields to be persisted, annotate them with @Transient.
> 	at org.apache.openjpa.persistence.PersistenceMetaDataFactory.validateStrategies(PersistenceMetaDataFactory.java:399)
> 	at org.apache.openjpa.persistence.PersistenceMetaDataFactory.load(PersistenceMetaDataFactory.java:205)
> 	at org.apache.openjpa.meta.MetaDataRepository.getMetaDataInternal(MetaDataRepository.java:433)
> 	at org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:288)
> 	at org.apache.openjpa.enhance.PCEnhancer.<init>(PCEnhancer.java:240)
> 	at org.apache.openjpa.enhance.PCEnhancer.<init>(PCEnhancer.java:211)
> 	at org.apache.openjpa.enhance.PCClassFileTransformer.transform(PCClassFileTransformer.java:127)
> 	at org.apache.openjpa.persistence.PersistenceProviderImpl$ClassTransformerImpl.transform(PersistenceProviderImpl.java:176)
> 	at org.springframework.orm.jpa.persistenceunit.ClassFileTransformerAdapter.transform(ClassFileTransformerAdapter.java:56)
> 	... 45 more
> 
> Here's my Spring appicationContext.xml file
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xmlns:p="http://www.springframework.org/schema/p"
> 	xmlns:aop="http://www.springframework.org/schema/aop"
> 	xmlns:context="http://www.springframework.org/schema/context"
> 	xmlns:jee="http://www.springframework.org/schema/jee"
> 	xmlns:tx="http://www.springframework.org/schema/tx"
> 	xsi:schemaLocation="http://www.springframework.org/schema/aop
> 			http://www.springframework.org/schema/aop/spring-aop.2.5.xsd
> 			http://www.springframework.org/schema/beans
> 			http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
> 			http://www.springframework.org/schema/context
> 			http://www.springframework.org/schema/context/spring-context-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/tx
> 			http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
> 
> 	<!--  Resource definitions -->
> 	
> 	<bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"
/>
> 	
> 	<context:property-placeholder location="classpath:jdbc.properties"/>
> 
> 	<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"
> 		p:driverClassName="${jdbc.driverClassName}" p:url="${jdbc.url}"/>
> 	
> 	<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
> 		p:dataSource-ref="dataSource">
> 			<property name="loadTimeWeaver">
> 				<bean class="org.springframework.instrument.classloading.ReflectiveLoadTimeWeaver"></bean>
> 			</property>
> 	</bean>
> 	
> 	<tx:annotation-driven transaction-manager="transactionManager"/>
> 	
> 	<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"
> 		p:entityManagerFactory-ref="entityManagerFactory" autowire="byName"/>
> 		
> 	<bean id="sawhorse-setup" autowire="byName" class="org.whitetail.sawhorse.dao.impl.ConfigurationDaoImpl"/>
> </beans>
> 
> My persistence.xml
> <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="sawhorse-setup" transaction-type="JTA">
> 		<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
> 	</persistence-unit>
> </persistence>
> 
> My web.xml
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
>   <display-name>sawhorse-setup</display-name>
>   <welcome-file-list>
>     <welcome-file>/index.jsp</welcome-file>
>   </welcome-file-list>
>   <listener>
> 	<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
>   </listener>
>   <persistence-unit-ref>
>   	<persistence-unit-ref-name>persistence/sawhorse-setup</persistence-unit-ref-name>
>   	<persistence-unit-name>sawhorse-setup</persistence-unit-name>
>   </persistence-unit-ref>
>   <context-param>
> 	<param-name>contextConfigLocation</param-name>
> 	<param-value>/WEB-INF/applicationContext-dao.xml</param-value>
>   </context-param>  
>   <servlet>
>   	<servlet-name>action</servlet-name>
>   	<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
>   	<load-on-startup>1</load-on-startup>
>   </servlet>
>   <servlet-mapping>
>   	<servlet-name>action</servlet-name>
>   	<url-pattern>*.html</url-pattern>
>   </servlet-mapping>
>   <jsp-config>
>   	<taglib>
>   		<taglib-uri>http://www.springframework.org/tags</taglib-uri>
>   		<taglib-location>/WEB-INF/tld/spring.tld</taglib-location>
>   	</taglib>
>   	<taglib>
>   		<taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri>
>   		<taglib-location>/WEB-INF/tld/c.tld</taglib-location>
>   	</taglib>
>   	<taglib>
>   		<taglib-uri>http://java.sun.com/jsp/jstl/fmt</taglib-uri>
>   		<taglib-location>/WEB-INF/tld/fmt.tld</taglib-location>
>   	</taglib>
>   </jsp-config>
> </web-app>
> 
> And finally, my entity bean:
> package org.whitetail.sawhorse.model;
> 
> import java.io.Serializable;
> import java.util.Date;
> 
> import javax.persistence.Column;
> import javax.persistence.Entity;
> import javax.persistence.GeneratedValue;
> import javax.persistence.Id;
> import javax.persistence.Table;
> import javax.persistence.Version;
> 
> @Entity
> @Table(name="CONFIG")
> @SuppressWarnings("serial")
> public class Configuration implements Serializable {
> 
> 	@Id @GeneratedValue
> 	@Column(name="ID")
> 	private Integer id;
> 
> 	@SuppressWarnings("unused")
> 	@Version
> 	private int oplock;
> 	
> 	@Column(name="REGISTRATION_CODE")
> 	private String registrationCode;
> 	
> 	@Column(name="SERvICE_URL")
> 	private String serviceUrl;
> 	
> 	@Column(name="EXPIRES")
> 	private Date expires;
> 
> 	public Integer getId() {
> 		return id;
> 	}
> 
> 	public String getRegistrationCode() {
> 		return registrationCode;
> 	}
> 
> 	public String getServiceUrl() {
> 		return serviceUrl;
> 	}
> 
> 	public Date getExpires() {
> 		return expires;
> 	}
> 
> 	public void setId(Integer id) {
> 		this.id = id;
> 	}
> 
> 	public void setRegistrationCode(String registrationCode) {
> 		this.registrationCode = registrationCode;
> 	}
> 
> 	public void setServiceUrl(String serviceUrl) {
> 		this.serviceUrl = serviceUrl;
> 	}
> 
> 	public void setExpires(Date expires) {
> 		this.expires = expires;
> 	}
> }
> 
> 
> Any clues where I have made a mistake?
> 
> Thanks in advance for the help getting this resolved!
> 
> Cheers!
> 
> 


Mime
View raw message