Announcement Announcement Module
Collapse
No announcement yet.
Something wrong with TransactionProxyFactoryBean Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Something wrong with TransactionProxyFactoryBean

    Hi I pretty new to spring and I've already made some small things.
    Yesterday I wanted to extend my project a bit but I did 2 things at the same time (I know step by step, but evil is done now).

    So what I did:
    1) Because is was following a books instructions I used an older version of Hibernate (I'm new to this also). So I swiched to Hibernate3 (shouldn't make much difference I guess).This can be a cause of my troubles perhaps?

    2) I added a new mapping for a new table with associations in my database. Maybe I did something wrong here with the associations...

    All this results in a big error (Tomcat refusing to start the application and he gives me a list with the argumetens why he is refusing but I don't understand the errors )

    So one of my main concerns is the next one (the other errors I will try and resolve on my own... emphasis on try )

    here it comes:
    The error:
    Code:
    ERROR - ContextLoader.initWebApplicationContext(172) | Context initialization failed
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name
    'employeeManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]:
    Instantiation of bean failed; nested exception is
    org.springframework.beans.FatalBeanException: Could not instantiate class
    [org.springframework.transaction.interceptor.TransactionProxyFactoryBean]; constructor
    threw exception; nested exception is java.lang.NoClassDefFoundError: null
    org.springframework.beans.FatalBeanException: Could not instantiate class
    [org.springframework.transaction.interceptor.TransactionProxyFactoryBean]; constructor
    threw exception; nested exception is java.lang.NoClassDefFoundError: null
    java.lang.NoClassDefFoundError
    	at java.lang.Class.forName0(Native Method)
    	at java.lang.Class.forName(Unknown Source)
    	at org.springframework.aop.framework.DefaultAopProxyFactory.<clinit>(DefaultAopProxyFactory.java:57)
    	at org.springframework.aop.framework.ProxyConfig.<init>(ProxyConfig.java:72)
    	at org.springframework.transaction.interceptor.TransactionProxyFactoryBean.<init>(TransactionProxyFactoryBean.java:83)
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    	at java.lang.reflect.Constructor.newInstance(Unknown Source)
    	at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:78)
    	at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:55)
    	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:48)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:315)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:256)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:222)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:146)
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:285)
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:317)
    	at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:131)
    	at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:224)
    	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:150)
    	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:48)
    	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3692)
    	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4127)
    	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
    	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
    	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
    	at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:910)
    	at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:873)
    	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:474)
    	at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1118)
    	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:310)
    	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1020)
    	at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
    	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012)
    	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
    	at org.apache.catalina.core.StandardService.start(StandardService.java:450)
    	at org.apache.catalina.core.StandardServer.start(StandardServer.java:680)
    	at org.apache.catalina.startup.Catalina.start(Catalina.java:536)
    	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:275)
    	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413
    Part of my applicationContext
    PtI
    Code:
    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">    
            <property name="dataSource">
            	<ref local="dataSource"/>
            </property>        
            <property name="mappingResources">
                <list>
                	<value>org/myemployees/model/Department.hbm.xml</value>
                    <value>org/myemployees/model/Employee.hbm.xml</value>                
                </list>
            </property>        
            <property name="hibernateProperties">
    	        <props>
    	            <prop key="hibernate.dialect">
    	            	org.hibernate.dialect.MySQLDialect
    	            </prop>
    	            <prop key="hibernate.hbm2ddl.auto">create</prop>
    	        </props>
            </property>        
        </bean>
    
        <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
            <property name="sessionFactory"><ref local="sessionFactory"/></property>
        </bean>
    I hope someone can help me
    Thanks in advance
    E

  • #2
    The error message is somewhat inconclusive.
    Maybe you need cglib-nodep-2.1_3.jar on your classpath.

    Regards,
    Andreas

    Comment


    • #3
      Nope, no change. Thanks anyway...

      I didn't expect this error, what I did was some complaints about my hibernate mappings (which is also the case...)
      Could it be related somehow, that my mappings are complety wrong and results in this error?
      Where would you start to look?

      Thnx

      Comment


      • #4
        Well, I started to check the location where the exception arises which pointed to CGLIB but now I think that is the wrong way.

        Just found this thread. Guess it is the same problem that you have. Maybe it helps.

        Perhaps indeed a class referred to in a mapping is missing.

        Regards,
        Andreas

        Comment


        • #5
          Another thread that might be helpful.

          Regards,
          Andreas

          Comment


          • #6
            Hmm, ok that didn't help either.
            I saw that my tables are created with the right associations. So I guess there is nothing wrong with my mappings since it's creating them... Hibernate sould be working fine I think.

            Some other suggestions (we're getting close I feel it )

            Comment


            • #7
              It's running after importing the required jars... those jars again (when will I learn...)

              Well thanks again for your help

              Comment


              • #8
                Originally posted by Emerxill View Post
                It's running after importing the required jars... those jars again (when will I learn...)

                Well thanks again for your help
                Can you tell me exactly what jars? I'm having the same problem!

                Comment


                • #9
                  Man, that's ages ago
                  So, no, I can't you exactly tell you which jars I added.
                  However, I suggest that you have a look at the "ReadMe.txt" in the lib-folder of the distribution file that contains the Spring framework (so not the lib in your application). That ReadMe.txt will tell you which jar(s) you'll need. If you've dowloaded the distribution with dependencies, that contains all the jars you need so you don't have to look for them one by one on the internet.

                  Btw, if you were using maven2 you wouldn't have had this problem

                  Comment

                  Working...
                  X