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

  • #16
    While it is likely not related to your problem, may you elaborate on it some more?
    Originally posted by springnewbie View Post
    common.xml and context.xml are named as applicationContext-common.xml
    and applicationContext-context.xml.

    The reason I am using Beanfactory is the consumer is web service which interacts with different spring based service.

    Comment


    • #17
      BTW, have you noticed that exception is not the same - yes, it still is NPE, but obtained much earlier, not in the HibernateTransactionManager, but directly in your MyWebServiceImpl.createOrUpdate?
      Originally posted by springnewbie View Post
      common.xml

      Code:
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
      
      <beans>
      
          <!-- JND DataSource for J2EE environments -->
         	  <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
      		<property name="driverClass" value="oracle.jdbc.driver.OracleDriver"/>
      		<property name="jdbcUrl" value="jdbc:oracle:thin:@lost:1521:sid"/>
      		<property name="user" value="USER"/>
      		<property name="password" value="PASS"/>
      		<property name="minPoolSize" value="15"/>
      		<property name="maxPoolSize" value="200"/>
      		<property name="maxStatements" value="100"/>
      		<property name="checkoutTimeout" value="3000"/>
      		<property name="idleConnectionTestPeriod" value="60"/>
      	</bean>
         
        
          <!-- nativeJdbcExatractor and oracleLobHandler are needed for Lob support (Clob, Blob) -->
          <bean id="nativeJdbcExtractor" class="org.springframework.jdbc.support.nativejdbc.SimpleNativeJdbcExtractor"/>
      
            <bean id="oracleLobHandler" class="org.springframework.jdbc.support.lob.OracleLobHandler">
                <property name="nativeJdbcExtractor">
                    <ref local="nativeJdbcExtractor"/>
                </property>
            </bean>
      
          <!-- Hibernate SessionFactory -->
          <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
              <property name="lobHandler">
                  <ref bean="oracleLobHandler"/>
              </property>
              <property name="dataSource"><ref local="dataSource"/></property>
             <property name="mappingDirectoryLocations">
                  <list><value>/WEB-INF/classes</value></list>
              </property>
      
              <property name="hibernateProperties">
              <props>
                  <prop key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop>
                  <prop key="hibernate.max_fetch_depth">3</prop>
                  <prop key="hibernate.show_sql">true</prop>
                  <prop key="hibernate.jdbc.use_scrollable_resultset">false</prop>
                  <prop key="hibernate.connection.release_mode">auto</prop>
              </props>
              </property>
          </bean>
      
          <!-- Transaction manager for a single Hibernate SessionFactory (alternative to JTA) -->
          <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
              <property name="sessionFactory"><ref local="sessionFactory"/></property>
          </bean>
      
          <bean id="txProxyTemplate" abstract="true" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
              <property name="transactionManager"><ref local="transactionManager"/></property>
              <property name="proxyTargetClass"><value>true</value></property> 
              <property name="transactionAttributes">
                  <props>
                      <prop key="save*">PROPAGATION_REQUIRED</prop>
                      <prop key="delete*">PROPAGATION_REQUIRED</prop>
                      <prop key="remove*">PROPAGATION_REQUIRED</prop>
                      <prop key="*">PROPAGATION_SUPPORTS</prop>
                  </props>
              </property>
          </bean>
          
          <!-- bean locator service -->
          <bean id="beanConfigFactory" class="com.my.common.BeanConfigFactory" factory-method="getInstance">
          </bean>
                  
          <!-- File Upload Resolver -->
          <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
              <property name="maxUploadSize"><value>681574400</value></property>
          </bean>
          
          <!-- View Resolver for JSPs -->
          <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
              <property name="requestContextAttribute"><value>rc</value></property>
              <property name="viewClass"><value>org.springframework.web.servlet.view.JstlView</value></property>
              <property name="prefix"><value></value></property>
              <property name="suffix"><value>.jsp</value></property>
          </bean>
      
      </beans>
      Error log
      Code:
      DEBUG - transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!
      INFO - successfully passed the generate productmovement
      ERROR - Error creating/updating product movement:- 
      java.lang.NullPointerException
      	at com.my.ws.MyWebServiceImpl.createOrUpdate(Unknown Source)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:585)
      	at com.sun.xml.ws.api.server.InstanceResolver$1.invoke(InstanceResolver.java:246)
      	at com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:146)
      	at com.sun.xml.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethodHandler.java:257)
      	at com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:93)
      	at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:595)
      	at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:554)
      	at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:539)
      	at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:436)
      	at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:243)
      	at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:444)
      	at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:244)
      	at com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:135)
      	at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doGet(WSServletDelegate.java:129)
      	at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(WSServletDelegate.java:160)
      	at com.sun.xml.ws.transport.http.servlet.WSServlet.doPost(WSServlet.java:75)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
      	at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
      	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
      	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
      	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
      	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
      	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
      	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
      	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
      	at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
      	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
      	at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
      	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
      	at java.lang.Thread.run(Thread.java:595)

      Comment


      • #18
        This is the line where it throws exception
        MyService service = BeanConfigFactory.getBean("myService");
        service.saveOperation(); //error here

        Comment


        • #19
          Originally posted by springnewbie View Post
          This is the line where it throws exception
          MyService service = BeanConfigFactory.getBean("myService");
          service.saveOperation(); //error here
          It looks as if getBean returns null.
          Why it is hard to say without seeing it.

          Comment


          • #20
            MyService service = BeanConfigFactory.getBean("myService");
            service.saveOperation(); //error here

            When I debug I can see service class with some proxy thing but when it starts executing saveOperation() for which it needs hibernateTemplate and sessionfactory - and it being null.

            Comment


            • #21
              Does this class inherits from HibernateTemplate?
              Or ServiceHibernateDAOImpl does?

              As I can see latter is a wrapper around some individual DAOs, do they use HibernateTemplate as well? And, if so, how SessionFactory comes to them?
              Originally posted by springnewbie View Post
              MyService service = BeanConfigFactory.getBean("myService");
              service.saveOperation(); //error here

              When I debug I can see service class with some proxy thing but when it starts
              executing saveOperation() for which it needs hibernateTemplate and sessionfactory - and it being null.

              Comment


              • #22
                DAO class extends HibernateDaoSupport and we inject SessionFactory to it.

                Comment


                • #23
                  I removed the OSIFV from web.xml and things are fine. But still I am not able to use applicationContext.

                  How do we make web service class applicationconextaware?

                  Comment

                  Working...
                  X