Announcement Announcement Module
Collapse
No announcement yet.
Plain maven builds outside of eclipse Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Plain maven builds outside of eclipse

    I expect there's a simple solution to my problem, but being quite a bit of a newbie with spring tools I'm not sure where to start looking.

    We have an app that's been developed using Spring's Eclipse, including build, deploy and test. We would like to start doing automated builds via maven instead... however the app compiles outside of eclipse, the result doesn't run properly. My question therefore is, what might eclipse be doing implicitly that we need to add configuration for?

    Below is the top of the stack in my browser, if it helps:
    javax.servlet.ServletException: Servlet.init() for servlet SpringMVCDispatcherServlet threw exception
    org.apache.catalina.authenticator.AuthenticatorBas e.invoke(AuthenticatorBase.java:472)
    org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:98)
    org.apache.catalina.valves.AccessLogValve.invoke(A ccessLogValve.java:927)
    org.apache.catalina.ha.session.JvmRouteBinderValve .invoke(JvmRouteBinderValve.java:219)
    org.apache.catalina.ha.tcp.ReplicationValve.invoke (ReplicationValve.java:333)
    org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:407)
    org.apache.coyote.http11.AbstractHttp11Processor.p rocess(AbstractHttp11Processor.java:999)
    org.apache.coyote.AbstractProtocol$AbstractConnect ionHandler.process(AbstractProtocol.java:565)
    org.apache.tomcat.util.net.JIoEndpoint$SocketProce ssor.run(JIoEndpoint.java:307)
    java.util.concurrent.ThreadPoolExecutor$Worker.run Task(ThreadPoolExecutor.java:886)
    java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:908)
    java.lang.Thread.run(Thread.java:662)

  • #2
    Hey!

    It is hard to say what exactly is going wrong here, the stack trace that you posted doesn't seem to include the underlying exception from the SpringMVCDispatcherServlet of your app. I would recommend to ask that question in the web section of this forum here with maybe the pom.xml file attached, and/or maybe sample code attached.

    STS does some extra work to make it easy to deploy and update applications to Tomcat or tc Server and therefore doesn't do exactly the same as Maven would do from the command line.

    HTH,
    Martin

    Comment


    • #3
      Thanks, I deliberately included only the top of the trace since I wasn't sure how much else was useful. I'll try asking over in the web section as you suggest.

      Comment


      • #4
        More of trace included now

        I haven't had any reply over in the other area, so will try again here... this is as much of the stack trace as I can paste in:

        HTTP Status 500 -

        --------------------------------------------------------------------------------

        type Exception report

        message

        description The server encountered an internal error () that prevented it from fulfilling this request.

        exception

        javax.servlet.ServletException: Servlet.init() for servlet SpringMVCDispatcherServlet threw exception
        org.apache.catalina.authenticator.AuthenticatorBas e.invoke(AuthenticatorBase.java:472)
        org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:98)
        org.apache.catalina.valves.AccessLogValve.invoke(A ccessLogValve.java:927)
        org.apache.catalina.ha.session.JvmRouteBinderValve .invoke(JvmRouteBinderValve.java:219)
        org.apache.catalina.ha.tcp.ReplicationValve.invoke (ReplicationValve.java:333)
        org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:407)
        org.apache.coyote.http11.AbstractHttp11Processor.p rocess(AbstractHttp11Processor.java:999)
        org.apache.coyote.AbstractProtocol$AbstractConnect ionHandler.process(AbstractProtocol.java:565)
        org.apache.tomcat.util.net.JIoEndpoint$SocketProce ssor.run(JIoEndpoint.java:307)
        java.util.concurrent.ThreadPoolExecutor$Worker.run Task(ThreadPoolExecutor.java:886)
        java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:908)
        java.lang.Thread.run(Thread.java:662)


        root cause

        org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'probeApplicationHealthServlet': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Could not autowire field: private com.esc.bob.ws.pharmacy.PharmacyWebService com.esc.bob.web.servlet.ProbeApplicationHealthServ let.pharmacyWebService; nested exception is java.lang.IllegalArgumentException: Can not set com.esc.bob.ws.pharmacy.PharmacyWebService field com.esc.bob.web.servlet.ProbeApplicationHealthServ let.pharmacyWebService to $Proxy82
        org.springframework.beans.factory.annotation.Autow iredAnnotationBeanPostProcessor.postProcessPropert yValues(AutowiredAnnotationBeanPostProcessor.java: 287)
        org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.populateBean(AbstractAu towireCapableBeanFactory.java:1106)
        org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:517)
        org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:456)
        org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 94)
        org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:225)
        org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:291 )
        org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:193)
        org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:609)
        org.springframework.context.support.AbstractApplic ationContext.finishBeanFactoryInitialization(Abstr actApplicationContext.java:918)
        org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:469)
        org.springframework.web.servlet.FrameworkServlet.c onfigureAndRefreshWebApplicationContext(FrameworkS ervlet.java:631)
        org.springframework.web.servlet.FrameworkServlet.c reateWebApplicationContext(FrameworkServlet.java:5 88)
        org.springframework.web.servlet.FrameworkServlet.c reateWebApplicationContext(FrameworkServlet.java:6 45)
        org.springframework.web.servlet.FrameworkServlet.i nitWebApplicationContext(FrameworkServlet.java:508 )
        org.springframework.web.servlet.FrameworkServlet.i nitServletBean(FrameworkServlet.java:449)
        org.springframework.web.servlet.HttpServletBean.in it(HttpServletBean.java:133)
        javax.servlet.GenericServlet.init(GenericServlet.j ava:160)
        org.apache.catalina.authenticator.AuthenticatorBas e.invoke(AuthenticatorBase.java:472)
        org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:98)
        org.apache.catalina.valves.AccessLogValve.invoke(A ccessLogValve.java:927)
        org.apache.catalina.ha.session.JvmRouteBinderValve .invoke(JvmRouteBinderValve.java:219)
        org.apache.catalina.ha.tcp.ReplicationValve.invoke (ReplicationValve.java:333)
        org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:407)
        org.apache.coyote.http11.AbstractHttp11Processor.p rocess(AbstractHttp11Processor.java:999)
        org.apache.coyote.AbstractProtocol$AbstractConnect ionHandler.process(AbstractProtocol.java:565)
        org.apache.tomcat.util.net.JIoEndpoint$SocketProce ssor.run(JIoEndpoint.java:307)
        java.util.concurrent.ThreadPoolExecutor$Worker.run Task(ThreadPoolExecutor.java:886)
        java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:908)
        java.lang.Thread.run(Thread.java:662)


        root cause

        org.springframework.beans.factory.BeanCreationExce ption: Could not autowire field: private com.esc.bob.ws.pharmacy.PharmacyWebService com.esc.bob.web.servlet.ProbeApplicationHealthServ let.pharmacyWebService; nested exception is java.lang.IllegalArgumentException: Can not set com.esc.bob.ws.pharmacy.PharmacyWebService field com.esc.bob.web.servlet.ProbeApplicationHealthServ let.pharmacyWebService to $Proxy82
        org.springframework.beans.factory.annotation.Autow iredAnnotationBeanPostProcessor$AutowiredFieldElem ent.inject(AutowiredAnnotationBeanPostProcessor.ja va:506)
        org.springframework.beans.factory.annotation.Injec tionMetadata.inject(InjectionMetadata.java:87)
        org.springframework.beans.factory.annotation.Autow iredAnnotationBeanPostProcessor.postProcessPropert yValues(AutowiredAnnotationBeanPostProcessor.java: 284)
        org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.populateBean(AbstractAu towireCapableBeanFactory.java:1106)
        org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:517)
        org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:456)
        org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 94)
        org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:225)
        org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:291 )
        org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:193)
        org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:609)
        org.springframework.context.support.AbstractApplic ationContext.finishBeanFactoryInitialization(Abstr actApplicationContext.java:918)
        org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:469)
        org.springframework.web.servlet.FrameworkServlet.c onfigureAndRefreshWebApplicationContext(FrameworkS ervlet.java:631)
        org.springframework.web.servlet.FrameworkServlet.c reateWebApplicationContext(FrameworkServlet.java:5 88)
        org.springframework.web.servlet.FrameworkServlet.c reateWebApplicationContext(FrameworkServlet.java:6 45)
        org.springframework.web.servlet.FrameworkServlet.i nitWebApplicationContext(FrameworkServlet.java:508 )
        org.springframework.web.servlet.FrameworkServlet.i nitServletBean(FrameworkServlet.java:449)
        org.springframework.web.servlet.HttpServletBean.in it(HttpServletBean.java:133)
        javax.servlet.GenericServlet.init(GenericServlet.j ava:160)
        org.apache.catalina.authenticator.AuthenticatorBas e.invoke(AuthenticatorBase.java:472)
        org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:98)
        org.apache.catalina.valves.AccessLogValve.invoke(A ccessLogValve.java:927)
        org.apache.catalina.ha.session.JvmRouteBinderValve .invoke(JvmRouteBinderValve.java:219)
        org.apache.catalina.ha.tcp.ReplicationValve.invoke (ReplicationValve.java:333)
        org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:407)
        org.apache.coyote.http11.AbstractHttp11Processor.p rocess(AbstractHttp11Processor.java:999)
        org.apache.coyote.AbstractProtocol$AbstractConnect ionHandler.process(AbstractProtocol.java:565)
        org.apache.tomcat.util.net.JIoEndpoint$SocketProce ssor.run(JIoEndpoint.java:307)
        java.util.concurrent.ThreadPoolExecutor$Worker.run Task(ThreadPoolExecutor.java:886)
        java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:908)
        java.lang.Thread.run(Thread.java:662)

        Comment


        • #5
          Hey!

          I still think the other forum is better suited for these questions, since it doesn't seem to be related to the STS tooling. But anyway, the stack trace you posted mentions:

          Originally posted by pda View Post
          root cause

          org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'probeApplicationHealthServlet': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Could not autowire field: private com.esc.bob.ws.pharmacy.PharmacyWebService com.esc.bob.web.servlet.ProbeApplicationHealthServ let.pharmacyWebService; nested exception is java.lang.IllegalArgumentException: Can not set com.esc.bob.ws.pharmacy.PharmacyWebService field com.esc.bob.web.servlet.ProbeApplicationHealthServ let.pharmacyWebService to $Proxy82
          org.springframework.beans.factory.annotation.Autow iredAnnotationBeanPostProcessor.postProcessPropert yValues(AutowiredAnnotationBeanPostProcessor.java: 287)
          Which seems to point into the right direction. Spring is not able to inject something into the autowired field for "com.esc.bob.web.servlet.ProbeApplicationHealthSer vlet.pharmacyWebService". So there seems to be something wrong with the configuration or a certain spring context is not activated/put into the build.

          HTH,
          Martin

          Comment


          • #6
            Originally posted by Martin Lippert View Post
            Hey!

            I still think the other forum is better suited for these questions, since it doesn't seem to be related to the STS tooling. But anyway, the stack trace you posted mentions:



            Which seems to point into the right direction. Spring is not able to inject something into the autowired field for "com.esc.bob.web.servlet.ProbeApplicationHealthSer vlet.pharmacyWebService". So there seems to be something wrong with the configuration or a certain spring context is not activated/put into the build.

            HTH,
            Martin
            Thanks again... but why does the build eve succeed for this then?

            The whole reason I started by asking here is that Eclipse builds behave differently, i.e. they work. Perhaps I should be asking the question a different way. Is there some way to determine what Eclipse might be doing here over and above what's configured in my POM files?

            Comment


            • #7
              Hey!

              You could take a look at the deployed application in your tc Server instance directory to see what exactly Eclipse/STS put there and compare that with the WAR file that your plain Maven build is producing. Just an idea...

              HTH,
              Martin

              Comment

              Working...
              X