Announcement Announcement Module
Collapse
No announcement yet.
spring JNDI datasource tomcat Problem please help me. Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    There should be a PaymentDao but there isn't (as stated by the stack trace). Add that bean to your configuration.

    Comment


    • #17
      Hi Thanks,

      i have added PaymentDaoImpl class to my bean configuration file

      but still getting error , could you please suggest me

      Code:
      [ERROR:main] [2011-09-12 12:42:55,981] (DispatcherServlet:290) - Context initialization failed
      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'autoMapping' defined in ServletContext resource 
      [/WEB-INF/PrepaidBasics-servlet.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean 
      with name 'noBillController': Injection of resource fields failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with
      name 'thresholdReloadService': Injection of resource fields failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean
      with name 'thresholdReload': Injection of resource fields failed; nested exception is java.lang.NoClassDefFoundError: Loracle/toplink/essentials/ejb/cmp3/EntityManager;

      Comment


      • #18
        Sigh... I suggest instead of posting each and every stack trace you start reading those stack traces... I get more and more the idea you are clueless in what you are doing...

        Code:
        java.lang.NoClassDefFoundError: Loracle/toplink/essentials/ejb/cmp3/EntityManager;
        Apparently you want to use oracle toplink, add it to your class path.

        Comment


        • #19
          Hi Marten,

          I am reading actually i am new to spring

          i have inlcuded already in pom.xml still giving the

          Code:
          Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean 
          with name 'thresholdReload': Injection of resource fields failed; nested exception is
           java.lang.NoClassDefFoundError: Loracle/toplink/essentials/ejb/cmp3/EntityManager;
          in pom.xml

          Code:
           
                  <dependency>
          		<groupId>toplink.essentials</groupId>
          		<artifactId>toplink-essentials</artifactId>
          		<version>2.1-59</version>
          		<scope>provided</scope>
          	</dependency>

          Comment


          • #20
            Make sure you have to correct jar.. Also scope provided means it doesn't get packaged in your application because it is already expected to be on the class path ...

            Comment


            • #21
              hi

              now i am getting the below error

              Code:
               
              org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type 
              [javax.persistence.EntityManagerFactory] is defined: expected single bean but found 0
              and in pom.xml

              Code:
                  <dependency>
              		<groupId>toplink.essentials</groupId>
              		<artifactId>toplink-essentials</artifactId>
              		<version>2.1-26</version>
              		<scope>compile</scope>
              	</dependency>
              My application is not showing any errors in myeclipse project packages folders.

              below imports i am using

              Code:
              import oracle.toplink.essentials.ejb.cmp3.EntityManager;
              import org.springframework.stereotype.Repository;
              import org.springframework.transaction.annotation.Transactional;
              Last edited by aleddullas; Sep 12th, 2011, 04:07 AM.

              Comment


              • #22
                Again (I feel I'm repeating myself over and over) read the stack trace...

                You haven't specified or loaded the EntityManagerFactory...

                Also you shouldn't use the toplink api directly but you should use the api (javax.persitence.EntityManager)....

                Comment


                • #23
                  i have loaded EntityManagerFactory in applicationContext.xml

                  Code:
                      <context:load-time-weaver/>
                       <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
                        <property name="dataSource" ref="dataSource"/>      
                        <property name="persistenceXmlLocation" value="META-INF/persistence.xml" />      
                        <property name="loadTimeWeaver">
                              <bean class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver"/>
                        </property> 
                  	  <property name="jpaVendorAdapter">
                            <bean class="org.springframework.orm.jpa.vendor.TopLinkJpaVendorAdapter">
                              <property name="showSql" value="false"/>                
                      		<property name="databasePlatform" value="oracle.toplink.essentials.platform.database.oracle.OraclePlatform"/>
                            </bean>
                        </property>
                      </bean>
                   <bean id="MydataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
                  	      <property name="jndiName" value="java:comp/env/jdbc/Prepaid_user"/>    
                        <property name="resourceRef" value="true" /> 
                  	</bean>
                  	
                      <!-- Transaction manager for a single JPA EntityManagerFactory (alternative to JTA) -->
                      <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"
                            p:entityManagerFactory-ref="entityManagerFactory"/>
                      <context:annotation-config/>

                  Comment


                  • #24
                    Please find the below stack trace and please tell me why i am getting the errors

                    [INFO] [talledLocalContainer] SEVERE: StandardWrapper.Throwable
                    [INFO] [talledLocalContainer] org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'autoMapping' defined in ServletContext resource [/WEB-INF/PrepaidBasics-servlet.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'noBillController': Injection of resource fields failed; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'thresholdReloadService': Injection of resource fields failed; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'thresholdReload': Injection of resource fields failed; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'paymentDao': Injection of persistence fields failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefini tionException: No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single bean but found 0
                    [INFO] [talledLocalContainer] at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:478)
                    [INFO] [talledLocalContainer] at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory$1.run(AbstractAutowireC apableBeanFactory.java:409)
                    [INFO] [talledLocalContainer] at java.security.AccessController.doPrivileged(Native Method)
                    [INFO] [talledLocalContainer] at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:380)
                    [INFO] [talledLocalContainer] at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 64)
                    [INFO] [talledLocalContainer] at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:220)
                    [INFO] [talledLocalContainer] at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:261 )
                    [INFO] [talledLocalContainer] at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:185)
                    [INFO] [talledLocalContainer] at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:164)
                    [INFO] [talledLocalContainer] at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:429)
                    [INFO] [talledLocalContainer] at org.springframework.context.support.AbstractApplic ationContext.finishBeanFactoryInitialization(Abstr actApplicationContext.java:729)
                    [INFO] [talledLocalContainer] at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:381)
                    [INFO] [talledLocalContainer] at org.springframework.web.servlet.FrameworkServlet.c reateWebApplicationContext(FrameworkServlet.java:4 02)
                    [INFO] [talledLocalContainer] at org.springframework.web.servlet.FrameworkServlet.i nitWebApplicationContext(FrameworkServlet.java:316 )
                    [INFO] [talledLocalContainer] at org.springframework.web.servlet.FrameworkServlet.i nitServletBean(FrameworkServlet.java:282)
                    [INFO] [talledLocalContainer] at org.springframework.web.servlet.HttpServletBean.in it(HttpServletBean.java:126)
                    [INFO] [talledLocalContainer] at javax.servlet.GenericServlet.init(GenericServlet.j ava:212)
                    [INFO] [talledLocalContainer] at org.apache.catalina.core.StandardWrapper.loadServl et(StandardWrapper.java:1172)
                    [INFO] [talledLocalContainer] at org.apache.catalina.core.StandardWrapper.load(Stan dardWrapper.java:992)
                    [INFO] [talledLocalContainer] at org.apache.catalina.core.StandardContext.loadOnSta rtup(StandardContext.java:4058)
                    [INFO] [talledLocalContainer] at org.apache.catalina.core.StandardContext.start(Sta ndardContext.java:4371)
                    [INFO] [talledLocalContainer] at org.apache.catalina.core.ContainerBase.addChildInt ernal(ContainerBase.java:791)
                    [INFO] [talledLocalContainer] at org.apache.catalina.core.ContainerBase.addChild(Co ntainerBase.java:771)
                    [INFO] [talledLocalContainer] at org.apache.catalina.core.StandardHost.addChild(Sta ndardHost.java:525)
                    [INFO] [talledLocalContainer] at org.apache.catalina.startup.HostConfig.deployWAR(H ostConfig.java:830)
                    [INFO] [talledLocalContainer] at org.apache.catalina.startup.HostConfig.deployWARs( HostConfig.java:719)
                    [INFO] [talledLocalContainer] at org.apache.catalina.startup.HostConfig.deployApps( HostConfig.java:490)
                    [INFO] [talledLocalContainer] at org.apache.catalina.startup.HostConfig.start(HostC onfig.java:1149)
                    [INFO] [talledLocalContainer] at org.apache.catalina.startup.HostConfig.lifecycleEv ent(HostConfig.java:311)
                    [INFO] [talledLocalContainer] at org.apache.catalina.util.LifecycleSupport.fireLife cycleEvent(LifecycleSupport.java:117)
                    [INFO] [talledLocalContainer] at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1053)
                    [INFO] [talledLocalContainer] at org.apache.catalina.core.StandardHost.start(Standa rdHost.java:719)
                    [INFO] [talledLocalContainer] at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1045)
                    [INFO] [talledLocalContainer] at org.apache.catalina.core.StandardEngine.start(Stan dardEngine.java:443)
                    [INFO] [talledLocalContainer] at org.apache.catalina.core.StandardService.start(Sta ndardService.java:516)
                    [INFO] [talledLocalContainer] at org.apache.catalina.core.StandardServer.start(Stan dardServer.java:710)
                    [INFO] [talledLocalContainer] at org.apache.catalina.startup.Catalina.start(Catalin a.java:578)
                    [INFO] [talledLocalContainer] at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
                    [INFO] [talledLocalContainer] at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
                    [INFO] [talledLocalContainer] at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
                    [INFO] [talledLocalContainer] at java.lang.reflect.Method.invoke(Method.java:597)
                    [INFO] [talledLocalContainer] at org.apache.catalina.startup.Bootstrap.start(Bootst rap.java:288)
                    [INFO] [talledLocalContainer] at org.apache.catalina.startup.Bootstrap.main(Bootstr ap.java:413)
                    [INFO] [talledLocalContainer] Caused by: org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'noBillController': Injection of resource fields failed; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'thresholdReloadService': Injection of resource fields failed; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'thresholdReload': Injection of resource fields failed; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'paymentDao': Injection of persistence fields failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefini tionException: No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single bean but found 0
                    [INFO] [talledLocalContainer] at org.springframework.context.annotation.CommonAnnot ationBeanPostProcessor.postProcessAfterInstantiati on(CommonAnnotationBeanPostProcessor.java:293)

                    Comment


                    • #25
                      For some reason I get the feeling I'm doing YOUR (home)work...

                      As I stated there is no EntityManagerFactory defined or available. The fact that it is in an xml file doesn't mean it is getting loaded make sure all xml files are loaded correctly.

                      Next time use [ code][/code ] tags when posting code

                      Comment


                      • #26
                        Sorry Marten,

                        Could you please tell me how to load EntityManagerFactory or how to solve my problem.

                        Thanks in advance

                        Comment


                        • #27
                          I already did that, load the xml file the same way you load the other files. I suggest a read of chapter 3 of the reference guide or maybe buy/read a book like Spring in Action.

                          Comment


                          • #28
                            .........The message you have entered is too short. Please lengthen your message to at least 10 characters.The message you have entered is too short. Please lengthen your message to at least 10 characters.The message you have entered is too short. Please lengthen your message to at least 10 characters.The message you have entered is too short. Please lengthen your message to at least 10 characters.The message you have entered is too short. Please lengthen your message to at least 10 characters.The message you have entered is too short. Please lengthen your message to at least 10 characters.
                            Last edited by aleddullas; Sep 12th, 2011, 09:14 AM.

                            Comment


                            • #29
                              I already gave you pointers and I suggest start reading the reference guide, you seem to miss the understanding on how spring works and what it does and how to configure it. So start with the reference guide (and take a look at the petstore sample app).

                              Also your code is flawed don't extend AbstractController and add @Controller either extend AbstractController or use @Controller not both...

                              The errors you get indicate that you are using beans that aren't loaded as I stated before make sure all the xml files are loaded...

                              Comment


                              • #30
                                thanks Marten

                                now the beans are get loaded but still the problem

                                in web.xml i am loading applicationContext.xml like below

                                Code:
                                 <context-param>
                                        <param-name>contextConfigLocation</param-name>
                                        <param-value>classpath:/WEB-INF/applicationContext.xml,/WEB-INF/PrepaidBasics-servlet.xml</param-value>
                                    </context-param>
                                    <listener>
                                        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
                                    </listener>
                                Please see the below stack trace
                                Code:
                                [ERROR:main] [2011-09-12 19:41:19,789] (DispatcherServlet:290) - Context initialization failed
                                org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'noBillController': Injection of resource fields failed; 
                                nested exception is 
                                org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'thresholdReloadService': Injection of resource fields failed; 
                                nested exception is
                                org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'thresholdReload': Injection of resource fields failed; 
                                nested exception is
                                org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'paymentDao': Injection of persistence fields failed; 
                                nested exception is 
                                org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [javax.persistence.EntityManagerFactory] is defined: 
                                expected single bean but found 0
                                Last edited by aleddullas; Sep 13th, 2011, 01:30 AM.

                                Comment

                                Working...
                                X