4 Replies Latest reply on Nov 13, 2014 10:57 AM by kenundrum

    Spring 3.2 w/ JBoss 6.3 EAP NullPointerException

    kenundrum

      I have a fairly basic EAR structure, containing one EJB project and one WAR project, that I am attempting to deploy in a JBoss 6.3 EAP environment. I have already successfully deployed it in a 5.1.0 Community and 5.2 EAP environment, however while migrating to 6.3 EAP I am running into a pretty major and undescriptive issue. Upon attempted deployment of the EAR, I get a NullPointerException that is thrown on the WAR. In an attempt to determine exactly what was going on I extracted the WAR by itself and tried deploying it with just the EJB module along side it (for dependencies). The following is the exception that is thrown:

       

      15:09:27,013 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7) MSC000001: Failed to start service jboss.deployment.unit."Example-WS.war".DEPENDENCIES: org.jboss.msc.service.StartException in service jboss.deployment.unit."Example-WS.war".DEPENDENCIES: JBAS018733: Failed to process phase DEPENDENCIES of deployment "Example-WS.war"
        at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:166) [jboss-as-server-7.4.0.Final-redhat-19.jar:7.4.0.Final-redhat-19]
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1980) [jboss-msc-1.1.5.Final-redhat-1.jar:1.1.5.Final-redhat-1]
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1913) [jboss-msc-1.1.5.Final-redhat-1.jar:1.1.5.Final-redhat-1]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_67]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_67]
        at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_67]
      Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: org.jboss.as.server.deployment.DeploymentUnitProcessingException: java.lang.NullPointerException
        at org.jboss.as.jaxrs.deployment.JaxrsSpringProcessor.deploy(JaxrsSpringProcessor.java:207)
        at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:159) [jboss-as-server-7.4.0.Final-redhat-19.jar:7.4.0.Final-redhat-19]
        ... 5 more
      Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: java.lang.NullPointerException
        at org.jboss.as.jaxrs.deployment.JaxrsSpringProcessor.getResteasySpringVirtualFile(JaxrsSpringProcessor.java:137)
        at org.jboss.as.jaxrs.deployment.JaxrsSpringProcessor.deploy(JaxrsSpringProcessor.java:203)
        ... 6 more
      Caused by: java.lang.NullPointerException
        at org.jboss.as.jaxrs.deployment.JaxrsSpringProcessor.getResteasySpringVirtualFile(JaxrsSpringProcessor.java:106)
        ... 7 more
      

       

      I have gone through the pain stacking process of adding things in one at a time until I get this exception thrown and I have narrowed it down to when my web.xml file is added to the project. I had found a link through one of the many Google searches I did trying to solve this stating that a similar issue was because of the servlet tags in the web.xml file. I have copied in my web.xml file below:

      <?xml version="1.0" encoding="UTF-8"?>
      <web-app id="Example_WS" version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
        <display-name>Example-WS</display-name>
        <servlet>
        <servlet-name>Example-WS</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
        </servlet>
        <servlet-mapping>
        <servlet-name>Example-WS</servlet-name>
        <url-pattern>/</url-pattern>
        </servlet-mapping>
        <jsp-config>
        <taglib>
        <taglib-uri>http://www.springframework.org/tags/form</taglib-uri>
        <taglib-location>/WEB-INF/tld/spring-form.tld</taglib-location>
        </taglib>
        <taglib>
        <taglib-uri>http://www.springframework.org/tags/spring</taglib-uri>
        <taglib-location>/WEB-INF/tld/spring.tld</taglib-location>
        </taglib>
        </jsp-config>
      </web-app>
      

       

      I have tried everything I could think of and anything that seemed like it had a chance of working however none of this gave me any positive results. I hope that whatever is causing this error is something that is just glaringly obvious that I am just overlooking and it is a simple fix. Anything you all can contribute to this would be much appreciated!

        • 1. Re: Spring 3.2 w/ JBoss 6.3 EAP NullPointerException
          swapnesh

          You can try to move the taglib-uri for all taglib-uri as below. Make sure the .tld files are there, and all spring libraries are in /WEB-INF/lib folder.

          Please provide full stack trace.

           

          <taglib> 

          <taglib-uri>/WEB-INF/tld/spring-form.tld</taglib-uri> 

          <taglib-location>/WEB-INF/tld/spring-form.tld</taglib-location> 

          </taglib> 

          <taglib> 

          <taglib-uri>/WEB-INF/tld/spring.tld</taglib-uri> 

          <taglib-location>/WEB-INF/tld/spring.tld</taglib-location> 

          </taglib> 

          </jsp-config> 

          • 2. Re: Spring 3.2 w/ JBoss 6.3 EAP NullPointerException
            kenundrum

            The above stacktrace is the entire thing. Anything else is just boiler plate JBoss startup material. I also went ahead and attempted to modify my web.xml file as you mentioned above however I am still getting the same stacktrace on deployment. Is there a flag that I can use to maybe grant more information from the stacktrace that I could then share for proper debugging? I feel like this shouldn't be as difficult as it seems to be to get Spring working with JBoss. Any additional help is still greatly appreciated.

            • 3. Re: Spring 3.2 w/ JBoss 6.3 EAP NullPointerException
              jaysensharma

              Hello,

              In my case It was due to a WAR which i was testing with the following context-param.  as a test case i used http://www.mkyong.com/wp-content/uploads/2011/07/RESTEasyt-Spring-Integration-Example.zip

               

              <context-param>
              <param-name>org.jboss.as.jaxrs.enableSpringIntegration</param-name>
              <param-value>true</param-value>
              </context-param>

               

              I can also reproduce this issue on EAP 6.3.0 by deploying above application, if the EAP installation path contains some space in it  Like "/home/program files/jboss-eap-6.3.0"

              • 4. Re: Spring 3.2 w/ JBoss 6.3 EAP NullPointerException
                kenundrum

                Thanks Jay, that was what did it. I have a space in a folder between the words EAP and 6.3. Once the space was removed and my Eclipse references were fixed it deployed fine. The end result for our team though is not this. We decided to go the route of programmatic configuration rather than using the XML files for servlets and web configuration. A link to how we did this is here for reference of anyone else that stumbles upon this forum is below. Thanks again for the assistance!

                 

                http://javahash.com/spring-4-mvc-hello-world-tutorial-full-example/

                1 of 1 people found this helpful