-3

I spent 14 days or more to get this application running.

My java version is jdk1.6.0_39, tomcat is 6.0 and Spring is 2.5.4.

When I import it to Eclipse and run the application on the server I get this:

INFO: Initializing Spring root WebApplicationContext
ERROR [main] ContextLoader.initWebApplicationContext(215) | Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name '_filterChainProxyPostProcessor': BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.config.internalTransactionAdvisor': Cannot create inner bean '(inner bean)' of type [org.springframework.transaction.interceptor.TransactionInterceptor] while setting bean property 'transactionInterceptor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#1': Cannot resolve reference to bean 'transactionManager' while setting bean property 'transactionManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in class path resource [applicationContext-dao.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext-dao.xml]: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: @OneToOne or @ManyToOne on com.itfuture.okapi.model.CrmEmail.crmContactPerson references an unknown entity: com.itfuture.okapi.model.CrmContactPerson
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:405)
    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:220)
    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.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:881)
    at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:606)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:366)
    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:4206)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
    at org.apache.catalina.core.StandardService.start(StandardService.java:525)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.config.internalTransactionAdvisor': Cannot create inner bean '(inner bean)' of type [org.springframework.transaction.interceptor.TransactionInterceptor] while setting bean property 'transactionInterceptor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#1': Cannot resolve reference to bean 'transactionManager' while setting bean property 'transactionManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in class path resource [applicationContext-dao.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext-dao.xml]: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: @OneToOne or @ManyToOne on com.itfuture.okapi.model.CrmEmail.crmContactPerson references an unknown entity: com.itfuture.okapi.model.CrmContactPerson
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:230)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:122)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1244)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1008)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:470)
    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:220)
    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.aop.framework.autoproxy.BeanFactoryAdvisorRetrievalHelper.findAdvisorBeans(BeanFactoryAdvisorRetrievalHelper.java:87)
    at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findCandidateAdvisors(AbstractAdvisorAutoProxyCreator.java:98)
    at org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator.findCandidateAdvisors(AnnotationAwareAspectJAutoProxyCreator.java:83)
    at org.springframework.aop.aspectj.autoproxy.AspectJAwareAdvisorAutoProxyCreator.shouldSkip(AspectJAwareAdvisorAutoProxyCreator.java:105)
    at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessBeforeInstantiation(AbstractAutoProxyCreator.java:266)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInstantiation(AbstractAutowireCapableBeanFactory.java:789)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.resolveBeforeInstantiation(AbstractAutowireCapableBeanFactory.java:760)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:399)
    ... 28 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#1': Cannot resolve reference to bean 'transactionManager' while setting bean property 'transactionManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in class path resource [applicationContext-dao.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext-dao.xml]: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: @OneToOne or @ManyToOne on com.itfuture.okapi.model.CrmEmail.crmContactPerson references an unknown entity: com.itfuture.okapi.model.CrmContactPerson
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275)
devrys
  • 1,571
  • 3
  • 27
  • 43
cykcykacz
  • 1
  • 3

4 Answers4

2

Just leave it here:

org.hibernate.AnnotationException: @OneToOne or @ManyToOne on com.itfuture.okapi.model.CrmEmail.crmContactPerson references an unknown entity: com.itfuture.okapi.model.CrmContactPerson
michael nesterenko
  • 14,222
  • 25
  • 114
  • 182
  • Sory i now it simple. But how i can fix this? – cykcykacz Feb 24 '13 at 10:47
  • @cykcykacz, just try to search a bit. Most of the problems are already described somewhere. For example here http://stackoverflow.com/questions/3983135/hibernate-manytoone-references-an-unknown-entity – michael nesterenko Feb 24 '13 at 10:51
0

Do you have @Entity annotation on top of CrmContactPerson class? Because it looks like CrmContactPerson is not a valid Entity candidate.

nbanic
  • 1,270
  • 1
  • 8
  • 11
spiritwalker
  • 2,257
  • 14
  • 9
  • Yes i have @Entity @Table(name = "crm_contact_person", schema = "public") public class CrmContactPerson extends BaseObject implements java.io.Serializable { – cykcykacz Feb 24 '13 at 11:24
  • are you using JPA with hibernate implementation or traditional hibernate? Please attache the source code of class CrmContactPerson. – spiritwalker Feb 24 '13 at 12:06
  • I delete and import again project now i got diffrent error http://jyf3e7434b3d.nazwa.pl/consol/consola.txt – cykcykacz Feb 24 '13 at 12:55
0

The problem is you did not added your class com.itfuture.okapi.model.CrmContactPerson in your sessionFactory bean's list property. Just add the line like bellow:

     <bean class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean" id="sessionFactory">
    <property name="dataSource" ref="dataSource"/>
    <property name="annotatedClasses">
        <list>
            <value>com.itfuture.okapi.model.CrmContactPerson</value> // add this line
            .
            .
            .
        </list>
    </property>
    .
    .
    .
</bean>

And you are done!

Sazzadur Rahaman
  • 6,938
  • 1
  • 30
  • 52
  • When i import project too my eclipse i got this error Description Resource Path Location Type Source folder 'src/main/java' in project 'xxx' cannot output to distinct source folder 'target/classes' okapi Build path Build Path Problem And when i fix this errors my appliction work correctly? what you think about it? Sory that i don't show this in first post!!! – cykcykacz Feb 24 '13 at 16:22
  • Yes I think so... when you fix the problems with the building procedure and reflect like mentioned above, things should go right! – Sazzadur Rahaman Feb 24 '13 at 16:27
  • When you are building your source code with maven you should put your packages in `src/main/java` folder and you can create new project in eclipse and then add the existing code there as there is problem with import. – Sazzadur Rahaman Feb 24 '13 at 17:05
  • I don't buld maven a just import Eclipse project too my Eclipse. – cykcykacz Feb 24 '13 at 20:03
  • This is structure my project befor import project http://jyf3e7434b3d.nazwa.pl/images/structure.jpg when i import porject too Eclipse http://jyf3e7434b3d.nazwa.pl/images/eclipse.jpg – cykcykacz Feb 24 '13 at 20:27
0

but when i fight with this all errors and warrnigs and run project by tomcat or jetty i got this exceptions.

http://jyf3e7434b3d.nazwa.pl/consol/jetty-conole.txt

What do u think where is the problem?

It is possible that i have no correct lib jar?

Sorry for the mess in this post but i don't now Java. This is my first time run project.

cykcykacz
  • 1
  • 3