本文介绍了jpa - 添加@Transient后,应用程序无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我几乎受伤了。帮助我。
我在我的hbm类中使用了@Transient。 @Transient在我的本地和测试服务器上正常工作。
然而,当我转移到生产时,我得到错误。
(请参阅下面的详细堆栈跟踪) p>
SEVERE:将上下文初始化事件发送给类org.springframework.web.context.ContextLoaderListener的监听器实例
org.springframework .beans.factory.BeanCreationException:创建名为'companyController'的bean时出错:注入资源依赖关系失败;嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'companyService'的bean时出错:注入资源依赖性失败;嵌套的异常是org.springframework.beans.factory.BeanCreationException:在ServletContext资源[/WEB-INF/hibernate-context.xml]中定义名称为'sessionFactory'的Bean时创建错误:调用init方法失败;嵌套异常是org.hibernate.MappingException:无法在org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues加载从类路径
注释类在org.springframework.beans(CommonAnnotationBeanPostProcessor.java:306)
。在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
在org.springframework.beans处的
。 factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
在org.springframework.beans.factory.support.AbstractBeanFactory $ 1.getObject(AbstractBeanFactory.java:294)
在org.springframework.beans .factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support。 AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
处org.springframework.beans.factory.support org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
。 DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
at org.springframework.context.support.AbstractApplicationContext.refresh( AbstractApplicationContext.java:464)
在org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:384)
在org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java: 283)
在org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
在org.apache.catalina.core.StandardContext.listenerStart(Standa rdContext.java:4723)
在org.apache.catalina.core.StandardContext $ 1.call(StandardContext.java:5226)
在org.apache.catalina.core.StandardContext $ 1.call(StandardContext。 java:5221)
在java.util.concurrent.FutureTask $ Sync.innerRun(未知源)
在java.util.concurrent.FutureTask.run(未知源)
在java.util .concurrent.ThreadPoolExecutor.runWorker(未知源)
在java.util.concurrent.ThreadPoolExecutor $ Worker.run(未知源)$ b $在java.lang.Thread.run(未知源)
引起:org.springframework.beans.factory.BeanCreationException:创建名为'companyService'的bean时出错:注入资源依赖关系失败;嵌套的异常是org.springframework.beans.factory.BeanCreationException:在ServletContext资源[/WEB-INF/hibernate-context.xml]中定义名称为'sessionFactory'的Bean时创建错误:调用init方法失败;嵌套异常是org.hibernate.MappingException:无法在org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues加载从类路径
注释类在org.springframework.beans(CommonAnnotationBeanPostProcessor.java:306)
。在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
在org.springframework.beans处的
。 factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
在org.springframework.beans.factory.support.AbstractBeanFactory $ 1.getObject(AbstractBeanFactory.java:294)
在org.springframework.beans .factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support。 AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
处org.springframework.context.annotation.CommonAnnotationBeanPostProcessor org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
。 autowireResource(CommonAnnotationBeanPostProcessor.java:442)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:416)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor $ ResourceElement.getResourceToInject( CommonAnnotationBeanPostProcessor.java:549)
处org.springframework.beans.factory.annotation.InjectionMetadata org.springframework.beans.factory.annotation.InjectionMetadata $ InjectedElement.inject(InjectionMetadata.java:150)
。注入(InjectionMetadata.java:87)
在org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProces sor.java:303)
... 21 more
导致:org.springframework.beans.factory.BeanCreationException:在ServletContext资源中定义的名为'sessionFactory'的bean创建错误[/ WEB-INF / hibernate-context.xml]:调用init方法失败;嵌套异常是org.hibernate.MappingException:无法在org.springframework在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455)
加载从类路径
注解的类。在org.springframework上
。org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
在org.springframework。
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework。 beans.factory.support.AbstractBeanFactory $ 1.getObject(AbstractBeanFactory.java:294)
在org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
在org.springframework .beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
在org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBea在org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:$) 416)
处org.springframework.beans.factory.annotation.InjectionMetadata $ InjectedElement.inject(InjectionMetadata org.springframework.context.annotation.CommonAnnotationBeanPostProcessor $ ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:549)
。的java:150)$在org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87 b $ b)
。在org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java: 303)
... 34 more
由org.hibernate.MappingException导致:无法从类路径中加载注释类
在org.spring在org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean.postProcessMappings framework.orm.hibernate3.annotation.AnnotationSessionFactoryBean.scanPackages(AnnotationSessionFactoryBean.java:205)
(AnnotationSessionFactoryBean.java:175)
。在组织。 springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:716)
at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
at org.springframework.beans。
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
... 46 more
导致:java.lang.ClassNotFoundException:com.turborep.turbotracker.company.dao.RxJournal
at org.apache.catalina.loader.WebappClassLoader.loa dClass(WebappClassLoader.java:1678)
在org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1523)
在org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean.scanPackages( AnnotationSessionFactoryBean.java:195)
... 51 more
我想我错过了一些jar或与其他的冲突。
我的pom.xml中有persistance-api.1.0.jar和hibernate-core.3.6.10.final.jar(请检查我的pom.xml)
< project xmlns =http://maven.apache.org/POM/4.0.0 xmlns:xsi =http://www.w3.org/2001/XMLSchema-instancexsi:schemaLocation =http://maven.apache.org/POM/4.0.0 http://maven.apache。组织/行家-v4_0_0.xsd>
< modelVersion> 4.0.0< / modelVersion>
< groupId> com.turborep.turbotracker< / groupId>
< artifactId> turbotracker< / artifactId>
<包装>战争< / packaging>
< version> 1.0.0-SNAPSHOT< / version>
< name> turbotracker Maven Webapp< / name>
< url> http://maven.apache.org< / url>
<依赖关系>
< dependency>
< groupId> junit< / groupId>
< artifactId> junit< / artifactId>
< version> 4.8.1< / version>
< type> jar< / type>
< scope> test< / scope>
< /依赖关系>
<! - log4j - >
< dependency>
< groupId> log4j< / groupId>
< artifactId> log4j< / artifactId>
< version> 1.2.14< / version>
< type> jar< / type>
< scope>编译< / scope>
< /依赖关系>
<! - Spring框架依赖关系 - >
< dependency>
< groupId> org.springframework< / groupId>
< artifactId> spring-web< / artifactId>
< version> 3.1.0.RELEASE< / version>
< type> jar< / type>
< scope>编译< / scope>
< /依赖关系>
< dependency>
< groupId> org.springframework< / groupId>
< artifactId> spring-core< / artifactId>
< version> 3.1.0.RELEASE< / version>
< type> jar< / type>
< scope>编译< / scope>
< /依赖关系>
< dependency>
< groupId> org.springframework< / groupId>
< artifactId> spring-tx< / artifactId>
< version> 3.1.0.RELEASE< / version>
< type> jar< / type>
< scope>编译< / scope>
< /依赖关系>
< dependency>
< groupId> org.springframework< / groupId>
< artifactId> spring-webmvc< / artifactId>
< version> 3.1.0.RELEASE< / version>
< type> jar< / type>
< scope>编译< / scope>
< /依赖关系>
< dependency>
< groupId> org.springframework< / groupId>
< artifactId> spring-aop< / artifactId>
< version> 3.1.0.RELEASE< / version>
< type> jar< / type>
< scope>编译< / scope>
< /依赖关系>
< dependency>
< groupId> org.springframework< / groupId>
< artifactId> spring-orm< / artifactId>
< version> 3.1.0.RELEASE< / version>
< type> jar< / type>
< scope>编译< / scope>
< /依赖关系>
< dependency>
< groupId> org.codehaus.jackson< / groupId>
< artifactId> jackson-core-asl< / artifactId>
< version> 1.6.3< / version>
< type> jar< / type>
< scope>编译< / scope>
< /依赖关系>
< dependency>
< groupId> javax.servlet< / groupId>
< artifactId> jstl< / artifactId>
< version> 1.2< / version>
< /依赖关系>
< dependency>
< groupId> org.codehaus.jackson< / groupId>
< artifactId> jackson-jaxrs< / artifactId>
< version> 1.6.3< / version>
< type> jar< / type>
< scope>编译< / scope>
< /依赖关系>
< dependency>
< groupId> javax.persistence< / groupId>
< artifactId> persistence-api< / artifactId>
< version> 1.0< / version>
< type> jar< / type>
< scope>编译< / scope>
< /依赖关系>
< dependency>
< groupId> org.hibernate< / groupId>
< artifactId> hibernate-core< / artifactId>
< version> 3.6.10.Final< / version>
< type> jar< / type>
< scope>编译< / scope>
< /依赖关系>
< dependency>
< groupId> c3p0< / groupId>
< artifactId> c3p0< / artifactId>
< version> 0.9.1.2< / version>
< type> jar< / type>
< scope>编译< / scope>
< /依赖关系>
< dependency>
< groupId> org.slf4j< / groupId>
< artifactId> slf4j-api< / artifactId>
< version> 1.6.1< / version>
< type> jar< / type>
< scope>编译< / scope>
< /依赖关系>
< dependency>
< groupId> org.slf4j< / groupId>
< artifactId> slf4j-log4j12< / artifactId>
< version> 1.6.1< / version>
< type> jar< / type>
< scope>编译< / scope>
< /依赖关系>
< dependency>
< groupId> cglib< / groupId>
< artifactId> cglib-nodep< / artifactId>
< version> 2.2< / version>
< type> jar< / type>
< scope>编译< / scope>
< /依赖关系>
< dependency>
< groupId> jboss< / groupId>
< artifactId> javassist< / artifactId>
< version> 3.7.ga< / version>
< type> jar< / type>
< scope>编译< / scope>
< /依赖关系>
<! - Mysql connector jar - >
< dependency>
< groupId> mysql< / groupId>
< artifactId> mysql-connector-java< / artifactId>
< version> 5.1.14< / version>
< type> jar< / type>
< scope>编译< / scope>
< /依赖关系>
< dependency>
< groupId> com.metaparadigm< / groupId>
< artifactId> json-rpc< / artifactId>
< version> 1.0< / version>
< /依赖关系>
< dependency>
< groupId> com.google.code.gson< / groupId>
< artifactId> gson< / artifactId>
< version> 2.1< / version>
< /依赖关系>
< dependency>
< groupId> commons-lang< / groupId>
< artifactId> commons-lang< / artifactId>
< version> 2.6< / version>
< /依赖关系>
< /依赖关系>
< build>
< finalName> turbotracker< / finalName>
< plugins>
< plugin>
< groupId> org.apache.maven.plugins< / groupId>
< artifactId> maven-compiler-plugin< / artifactId>
<配置>
< source> 1.5< / source>
< target> 1.5< / target>
< / configuration>
< / plugin>
< / plugins>
< / build>
< / project>
编辑:
RxJournal.java
@Entity
@Table(name =rxJournal ,catalog =Company)
public class RxJournal implements java.io.Serializable {
private Integer rxJournalId;
私人字符串entryMemo;
私人字符串名称;
....
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name =rxJournalID,unique = true,可空= FALSE)
公共整数getRxJournalId(){返回this.rxJournalId;}
公共无效setRxJournalId(整数rxJournalId){this.rxJournalId = rxJournalId;}
@Column( NAME = entryMemo)
公共字符串getEntryMemo(){返回this.entryMemo;}
公共无效setEntryMemo(字符串entryMemo){this.entryMemo = entryMemo;}
@Transient
public String getName(){return name;}
public void setName(String name){this.name = name;}
}
请建议如果我遗失任何东西。
Edit2:
FYI:我的本地系统是ubuntu,生产是windows XP。
解决方案刚才我解决了这个问题。实际上我只是将 Rxjournal.java
重命名为 RxJournal.java
。(Capital J)。
但是在构建时,我的maven并没有完全清理应用程序,仍然在类目录中存在 Rxjournal.class
。
然而,在启动应用程序时,上下文加载器正在寻找 RxJournal.class
。
因此,当我尝试在生产环境中部署应用程序时,应用程序崩溃。
现在我已经手动删除了.class文件,并运行了一个新的干净版本。
Workig很好。
我不确定它在本地和测试服务器上的工作方式。
(如果有人有想法,就引导我)
I am almost struck. help me.
I am using @Transient in my hbm class. "@Transient" is working fine in my local and testing servers.
However when I move to production I am getting error.
(Please refer the Detailed stack trace bellow)
SEVERE: 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 'companyController': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'companyService': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/hibernate-context.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: Failed to load annotated classes from classpath
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:306)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1106)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:384)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4723)
at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5226)
at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5221)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'companyService': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/hibernate-context.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: Failed to load annotated classes from classpath
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:306)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1106)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.autowireResource(CommonAnnotationBeanPostProcessor.java:442)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:416)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:549)
at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:150)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:303)
... 21 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/hibernate-context.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: Failed to load annotated classes from classpath
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.autowireResource(CommonAnnotationBeanPostProcessor.java:442)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:416)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:549)
at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:150)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:303)
... 34 more
Caused by: org.hibernate.MappingException: Failed to load annotated classes from classpath
at org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean.scanPackages(AnnotationSessionFactoryBean.java:205)
at org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean.postProcessMappings(AnnotationSessionFactoryBean.java:175)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:716)
at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
... 46 more
Caused by: java.lang.ClassNotFoundException: com.turborep.turbotracker.company.dao.RxJournal
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1678)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1523)
at org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean.scanPackages(AnnotationSessionFactoryBean.java:195)
... 51 more
I guess I am missing some jar or conflicting with other.
I am having "persistance-api.1.0.jar" and "hibernate-core.3.6.10.final.jar" in my "pom.xml".(Please check my pom.xml)
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.turborep.turbotracker</groupId>
<artifactId>turbotracker</artifactId>
<packaging>war</packaging>
<version>1.0.0-SNAPSHOT</version>
<name>turbotracker Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
<type>jar</type>
<scope>test</scope>
</dependency>
<!-- log4j -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<!-- Spring framework dependencies -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>3.1.0.RELEASE</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>3.1.0.RELEASE</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>3.1.0.RELEASE</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>3.1.0.RELEASE</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>3.1.0.RELEASE</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>3.1.0.RELEASE</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>1.6.3</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-jaxrs</artifactId>
<version>1.6.3</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<!-- Java persistance -->
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
<version>1.0</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<!-- hibernate -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>3.6.10.Final</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>c3p0</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.1.2</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.1</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.1</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
<version>2.2</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>jboss</groupId>
<artifactId>javassist</artifactId>
<version>3.7.ga</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<!-- Mysql connector jar -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.14</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.metaparadigm</groupId>
<artifactId>json-rpc</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
</dependencies>
<build>
<finalName>turbotracker</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
EDIT:
RxJournal.java
@Entity
@Table(name = "rxJournal", catalog = "Company")
public class RxJournal implements java.io.Serializable {
private Integer rxJournalId;
private String entryMemo;
private String name;
....
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "rxJournalID", unique = true, nullable = false)
public Integer getRxJournalId() {return this.rxJournalId;}
public void setRxJournalId(Integer rxJournalId) {this.rxJournalId = rxJournalId;}
@Column(name = "EntryMemo")
public String getEntryMemo() {return this.entryMemo;}
public void setEntryMemo(String entryMemo) {this.entryMemo = entryMemo;}
@Transient
public String getName() {return name;}
public void setName(String name) {this.name = name;}
}
Please suggest If I am missing any thing.
Edit2:
FYI: my local system is ubuntu, and production is windows XP.
解决方案
Just now I address the problem. actually I just renamed the Rxjournal.java
to RxJournal.java
.(Capital J).
But while taking build my maven is not fully cleaning the application and still Rxjournal.class
is there in classes directory.
However while starting the application, context loader is looking for RxJournal.class
.
So application getting crashed while I am trying to deploy in production.
Now I have deleted the .class file manually and ran a fresh clean build.
Workig fine now.
I am not sure How it is worked in Local and testing servers.
(If any one have Idea, just guide me)
这篇关于jpa - 添加@Transient后,应用程序无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!