Announcement Announcement Module
Collapse
No announcement yet.
Error creating bean Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Error creating bean

    I want to insert data into db.
    my application-config
    <bean id="transactionManagerMS" class="org.springframework.jdbc.datasource.DataSou rceTransactionManager">
    <property name="dataSource">
    <ref local="dataSourceMS"/>
    </property>
    </bean>

    <bean id="selldocsManager"
    class="org.springframework.transaction.interceptor .TransactionProxyFactoryBean">
    <property name="transactionManager">
    <ref bean="transactionManagerMS"/>
    </property>
    <property name="target">
    <ref local="selldocsModel"/>
    </property>
    <property name="transactionAttributes">
    <props>
    <prop key="insert*">PROPAGATION_REQUIRED</prop>
    <prop key="update*">PROPAGATION_REQUIRED</prop>
    <prop key="*">PROPAGATION_REQUIRED,readOnly</prop>
    </props>
    </property>
    </bean>

    <bean id="selldocsModel" class="goods.com.konus.model.SelldocsModel">
    <constructor-arg index="0" ref="selldocsDao"/>
    </bean>

    model
    public class SelldocsModel extends baseDataAccess {

    private SqlMapSelldocsDAO dao ;
    public SelldocsModel ( SqlMapSelldocsDAO dao ) {
    this.dao = dao ;
    }

    public void insertSelldoc( ShoppingCart cart ) {
    dao.insert( cart ) ;
    }

    }


    I get an error . what's wrong ?

    ERROR [main] org.springframework.web.struts.ContextLoaderPlugIn init- Context initialization failed
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'selldocsManager' defined in class path resource [com/portal/daoconf/applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.FatalBeanException: Could not instantiate class [org.springframework.transaction.interceptor.Transa ctionProxyFactoryBean]; constructor threw exception; nested exception is java.lang.NoClassDefFoundError: null
    org.springframework.beans.FatalBeanException: Could not instantiate class [org.springframework.transaction.interceptor.Transa ctionProxyFactoryBean]; constructor threw exception; nested exception is java.lang.NoClassDefFoundError: null
    java.lang.NoClassDefFoundError
    at net.sf.cglib.proxy.Enhancer.<clinit>(Enhancer.java :69)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:155)
    at org.springframework.aop.framework.DefaultAopProxyF actory.<clinit>(DefaultAopProxyFactory.java:57)

  • #2
    Have you solved this one yet?
    Last edited by karldmoore; Aug 27th, 2007, 03:54 PM.

    Comment


    • #3
      not yet. Help me please.

      Comment


      • #4
        Is it possible you can post your code, configuration and stacktrace in [code] [ /code] tags. It would also be worth just checking you don't have duplicate JARs on your classpath.
        Last edited by karldmoore; Aug 27th, 2007, 03:54 PM.

        Comment


        • #5
          error creating bean

          Hi Karl, thank you a lot for answer.

          I looked at jar files. There are no repetitive ones.
          Looked at jPetStore sample (spring + ibatis).
          Based on it, created mine, but for the moment it's not working.
          Could you please help me. I will soon be commissioning my project, but for the moment got stuck with inserting orders.
          The attachment contains files.
          Thanks in advance!

          Comment


          • #6
            There has to be a missing jar in your classpath. Look at the complete stack trace, meaning get the class and code line where that exception occurs and take a look at the source code.

            Comment


            • #7
              Andrei, thank you a lot,
              the error occur when Tomcat start up.

              Comment


              • #8
                Which versions of Spring and Tomcat are you using?

                Comment


                • #9
                  Did you include the asm-*.jar in your application?

                  Comment


                  • #10
                    thank you for answer,
                    Tomcat - 5.5.9
                    Spring 1.2.6
                    asm-*.jar didn't include. I downloaded spring .jar
                    and cglib2.1_3.jar and copy jars to WEB-INF/lib .

                    Comment


                    • #11
                      Hi Karl,
                      I downloaded the recent version of spring.jar and my Error changed. Could you please tell me what it means?
                      ( cglib in classpath. )

                      Caused by:
                      org.springframework.beans.factory.BeanCreationExce ption:
                      Error creating bean with name 'insertorderModel' defined in class path resource [com/portal/daoconf/applicationContext.xml]
                      Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError
                      Caused by: java.lang.NoClassDefFoundError
                      at net.sf.cglib.proxy.Enhancer.<clinit>(Enhancer.java :69)
                      at org.springframework.aop.framework.Cglib2AopProxy.c reateEnhancer (Cglib2AopProxy.java:224)
                      at org.springframework.aop.framework.Cglib2AopProxy.g etProxy (Cglib2AopProxy.java:151)
                      at org.springframework.aop.framework.ProxyFactory.get Proxy (ProxyFactory.java:110)

                      Comment


                      • #12
                        Download spring-framework-x.x.x-with-dependencies.zip and add the asm-*.jar files from the lib/asm dir to your app.
                        You need asm for cglib.
                        Last edited by mzeibig; Aug 2nd, 2007, 06:59 AM.

                        Comment


                        • #13
                          Thank you,
                          I downloaded spring-framework-2.0.6-with-dependencies,
                          copy cglib-nodep-2.1.3.jar and asm, asm-commons, asm-util to WEB-INF/lib and after Tomcat start up get the following Error
                          [ nested exception is java.lang.NoClassDefFoundError: org/objectweb/asm/CodeVisitor ]

                          ps.
                          I find CodeVisitor object at net.sf.cglib.asm package ...

                          Comment


                          • #14
                            Did you add jars into the classpath of your tomcat?
                            Don't do it.
                            All additional jars have to bin inside of your app (war file), in the 'WEB-INF/lib' directory. Otherwise you will get strange classloading errors.

                            Comment


                            • #15
                              all additional jars I copy to WEB-INF/lib .

                              Comment

                              Working...
                              X