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

  • Transactions and MethodNotFoundException

    Hello guys,

    I'm facing a problem with annotation based transactions. I'm using a JDBC datasource. First of all I included the namespace aop and tx as well as the spring-aop-2.0xsd and spring-tx-2.0.xsd schema into the XML configuration file.

    Code:
    <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    	<property name="driverClassName" value="org.postgresql.Driver" />
    	<property name="url" value="jdbc:postgresql://localhost/postgres" />
    	<property name="username" value="" />
    	<property name="password" value="" />
    </bean>
    Then I defined a proper transaction manager

    Code:
    <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
    	<property name="dataSource" ref="dataSource" />
    </bean>
    As well as

    Code:
    <tx:annotation-driven transaction-manager="transactionManager"/>
    and

    Code:
    <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
    	<property name="dataSource" ref="dataSource" />
    </bean>

    Now, if I got it right, the only thing that has to be additionaly done, is to "mark" every Method, that should be executed as a transaction, or am I wrong?

    Code:
    @Transactional(propagation=Propagation.REQUIRED, readOnly=false)

    I am using Apache (Tomcat 6.0, MyFaces, Trinidad, Tomahawk), PostgreSQL 8.3, JDBC driver type 4 for PostgreSQL (Version 8.3-603), Spring 2.0.0.RC1 (WebFlow, Security, Faces, JDBCTemplate, and well now the transaction stuff too).

    The Problem:
    The authentication works fine, but the method, that is first executed (in webflow defined at the top), causes the problem:

    ....
    ....
    root cause
    Code:
    javax.el.MethodNotFoundException: Method not found: [email protected](java.lang.String)
    	org.jboss.el.util.ReflectionUtil.findMethod(ReflectionUtil.java:211)
    	org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:269)
    	org.jboss.el.parser.AstMethodSuffix.getValue(AstMethodSuffix.java:59)
    	org.jboss.el.parser.AstValue.getValue(AstValue.java:67)
    	org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
    	org.springframework.binding.expression.el.ELExpression.getValue(ELExpression.java:60)
    	org.springframework.webflow.action.EvaluateAction.doExecute(EvaluateAction.java:75)
    	org.springframework.webflow.action.AbstractAction.execute(AbstractAction.java:188)
    	org.springframework.webflow.engine.AnnotatedAction.execute(AnnotatedAction.java:145)
    	org.springframework.webflow.engine.ActionExecutor.execute(ActionExecutor.java:47)
    	org.springframework.webflow.engine.ActionList.execute(ActionList.java:153)
    	org.springframework.webflow.engine.Flow.start(Flow.java:500)
    	org.springframework.webflow.engine.impl.FlowExecutionImpl.start(FlowExecutionImpl.java:360)
    	org.springframework.webflow.engine.impl.FlowExecutionImpl.start(FlowExecutionImpl.java:245)
    	org.springframework.webflow.executor.FlowExecutorImpl.launchExecution(FlowExecutorImpl.java:133)
    	org.springframework.webflow.mvc.servlet.FlowController.handleRequestInternal(FlowController.java:164)
    	org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
    	org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
    	org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)
    	org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:809)
    	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:523)
    	org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:453)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    	org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378)
    	org.springframework.security.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
    	org.springframework.security.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
    	org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
    	org.springframework.security.ui.SessionFixationProtectionFilter.doFilterHttp(SessionFixationProtectionFilter.java:67)
    	org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    	org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
    	org.springframework.security.ui.ExceptionTranslationFilter.doFilterHttp(ExceptionTranslationFilter.java:101)
    	org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    	org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
    	org.springframework.security.providers.anonymous.AnonymousProcessingFilter.doFilterHttp(AnonymousProcessingFilter.java:105)
    	org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    	org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
    	org.springframework.security.ui.rememberme.RememberMeProcessingFilter.doFilterHttp(RememberMeProcessingFilter.java:116)
    	org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    	org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
    	org.springframework.security.wrapper.SecurityContextHolderAwareRequestFilter.doFilterHttp(SecurityContextHolderAwareRequestFilter.java:91)
    	org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    	org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
    	org.springframework.security.ui.basicauth.BasicProcessingFilter.doFilterHttp(BasicProcessingFilter.java:174)
    	org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    	org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
    	org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:277)
    	org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    	org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
    	org.springframework.security.ui.logout.LogoutFilter.doFilterHttp(LogoutFilter.java:89)
    	org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    	org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
    	org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
    	org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    	org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
    	org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)
    	org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:183)
    	org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:138)

    Do I need to define the aop and tx namespaces in every XML file? What else could the problem be?

    Greetings from Germany
    Last edited by hypersound; Jul 31st, 2009, 09:48 AM.

  • #2
    Maybe someone can help? Any suggestions appreciated.
    Thanks in advance.

    Comment


    • #3
      Hello it's me again,

      I'm still facing the same problem. Is it possible, that the usage of expression language causes the problem?
      The method

      Code:
      public void GetUserData(String username)
      is called through expression language out of webflow.

      Code:
      <on-start>
           <evaluate expression="userBean.GetUserData(currentUser.name)" />
      </on-start>
      I use jboss-el-2.0.0.jar
      Is it problematic to call annotated methods through expression language?

      I'm going insane with that problem....


      Here the tomcat error log

      Code:
      SCHWERWIEGEND: Servlet.service() for servlet Spring MVC Dispatcher Servlet threw exception
      javax.el.MethodNotFoundException: Method not found: [email protected](java.lang.String)
      	at org.jboss.el.util.ReflectionUtil.findMethod(ReflectionUtil.java:214)
      	at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:272)
      	at org.jboss.el.parser.AstMethodSuffix.getValue(AstMethodSuffix.java:59)
      	at org.jboss.el.parser.AstValue.getValue(AstValue.java:67)
      	at org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
      	at org.springframework.binding.expression.el.BindingValueExpression.getValue(BindingValueExpression.java:54)
      	at org.springframework.binding.expression.el.ELExpression.getValue(ELExpression.java:54)
      	at org.springframework.webflow.action.EvaluateAction.doExecute(EvaluateAction.java:77)
      	at org.springframework.webflow.action.AbstractAction.execute(AbstractAction.java:188)
      	at org.springframework.webflow.execution.AnnotatedAction.execute(AnnotatedAction.java:145)
      	at org.springframework.webflow.execution.ActionExecutor.execute(ActionExecutor.java:51)
      	at org.springframework.webflow.engine.ActionList.execute(ActionList.java:155)
      	at org.springframework.webflow.engine.Flow.start(Flow.java:534)
      	at org.springframework.webflow.engine.impl.FlowExecutionImpl.start(FlowExecutionImpl.java:364)
      	at org.springframework.webflow.engine.impl.FlowExecutionImpl.start(FlowExecutionImpl.java:222)
      	at org.springframework.webflow.executor.FlowExecutorImpl.launchExecution(FlowExecutorImpl.java:140)
      	at org.springframework.webflow.mvc.servlet.FlowHandlerAdapter.handle(FlowHandlerAdapter.java:193)
      	at org.springframework.webflow.mvc.servlet.FlowController.handleRequest(FlowController.java:174)
      	at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
      	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)
      	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:807)
      	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
      	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378)
      	at org.springframework.security.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
      	at org.springframework.security.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
      	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
      	at org.springframework.security.ui.SessionFixationProtectionFilter.doFilterHttp(SessionFixationProtectionFilter.java:67)
      	at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
      	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
      	at org.springframework.security.ui.ExceptionTranslationFilter.doFilterHttp(ExceptionTranslationFilter.java:101)
      	at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
      	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
      	at org.springframework.security.providers.anonymous.AnonymousProcessingFilter.doFilterHttp(AnonymousProcessingFilter.java:105)
      	at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
      	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
      	at org.springframework.security.ui.rememberme.RememberMeProcessingFilter.doFilterHttp(RememberMeProcessingFilter.java:116)
      	at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
      	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
      	at org.springframework.security.wrapper.SecurityContextHolderAwareRequestFilter.doFilterHttp(SecurityContextHolderAwareRequestFilter.java:91)
      	at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
      	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
      	at org.springframework.security.ui.basicauth.BasicProcessingFilter.doFilterHttp(BasicProcessingFilter.java:174)
      	at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
      	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
      	at org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:278)
      	at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
      	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
      	at org.springframework.security.ui.logout.LogoutFilter.doFilterHttp(LogoutFilter.java:89)
      	at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
      	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
      	at org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
      	at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
      	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
      	at org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)
      	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)
      	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
      	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
      	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
      	at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:857)
      	at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:565)
      	at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1509)
      	at java.lang.Thread.run(Unknown Source)

      Comment


      • #4
        So guys. I had some problem using Spring+JSF in Tomcat 6.0.
        I solved changing the default JDK proxy to CGLIB.
        I included the proxy-target-class in tx:annotation-driven tag.
        Code:
        <tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true" />
        I believe there is some incompatibility between Spring+JSF+Tomcat+JDK default proxy.

        However you must include the cglib library in you classpath. http://cglib.sourceforge.net

        Greetings from Brazil!!!

        Comment

        Working...
        X