1 2 Previous Next 19 Replies Latest reply on Aug 6, 2013 6:18 AM by beepeers

    Move ear from Jboss AS 6.1.0 to Jboss AS 7.1.1

    beepeers

      hi everyone !

       

      i tried now for some days to migrate my project from jboss AS 6 to jboss AS 7

      with some tutorials like https://docs.jboss.org/author/display/AS7/How+do+I+migrate+my+application+from+AS5+or+AS6+to+AS7 , searching solutions but nothings works !

      (i have updated the standalone.xml for the datasource i use and the test is good)

       

      Im using maven, hibernate, EJB ...

       

      So here's my project structure:

       

      ear.ear

      |-- api.war

      |-- lib/

      |-- lib/data.jar

      |-- logic.jar

      |-- web.war

       

      You can find on my serverear.zip all the pom.xml from maven, orm and persistence.xml from the folder data and an errorlog.txt from the output i got from the eclipse logs.

       

      if someone could help me it would be awesome !

        • 1. Re: Move ear from Jboss AS 6.1.0 to Jboss AS 7.1.1
          sfcoy

          You have quite a few issues here.

           

          Are you using only the JPA interfaces, or are you using Hibernate ORM interfaces as well?

           

          Which of these modules actually contain EJBs?

           

          What are you trying to achieve with the common-ro jar?

          • 2. Re: Move ear from Jboss AS 6.1.0 to Jboss AS 7.1.1
            beepeers

            Hi Stephen,

            (sorry im a rookie with application server dev')

            i guess i'm using the Hibernate ORM interface, there is only the logic module wich contain EJBs

            and the common-ro jar is only here to translate the entities from data into json objects.

            • 3. Re: Move ear from Jboss AS 6.1.0 to Jboss AS 7.1.1
              sfcoy

              To begin with, here's a crack at sorting out your maven build .

               

              It currently assumes that common-ro is something separate, but they may not be correct because it's still not clear why you segregated it the way you did:

               

              {code:xml}<module>../../COMMON/r-o</module>{code}

               

              If you're using the JavaEE 6 compatible JAX-RS apis then you probably don't need any of the resteasy dependencies.

              1 of 1 people found this helpful
              • 4. Re: Move ear from Jboss AS 6.1.0 to Jboss AS 7.1.1
                beepeers

                Here i am Stephen !

                 

                First off all thanks for your attention its very helpfull !

                 

                Now the deployement works perfectly well but now when i try to request my server with my litle restClient i get these errors:

                 

                18:09:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) java.lang.ClassCastException: com.beepeers.server.logic.operation.AdminFacade$$$view1367 cannot be cast to com.beepeers.server.logic.operation.AdminFacade

                18:09:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at com.beepeers.server.api.resources.v2.admin.impl.RestResource.<init>(RestResource.java:17)

                18:09:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at com.beepeers.server.api.resources.v2.admin.impl.FeedResource.<init>(FeedResource.java:14)

                18:09:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

                18:09:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)

                18:09:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

                18:09:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at java.lang.reflect.Constructor.newInstance(Constructor.java:526)

                18:09:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at org.jboss.resteasy.core.ConstructorInjectorImpl.construct(ConstructorInjectorImpl.java:82)

                18:09:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at org.jboss.resteasy.plugins.server.resourcefactory.POJOResourceFactory.createResource(POJOResourceFactory.java:43)

                18:09:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:210)

                18:09:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:525)

                18:09:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:502)

                18:09:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:119)

                18:09:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)

                18:09:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)

                18:09:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)

                18:09:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)

                18:09:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)

                18:09:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)

                18:09:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)

                18:09:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)

                18:09:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50)

                18:09:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)

                18:09:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)

                18:09:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

                18:09:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

                18:09:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)

                18:09:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)

                18:09:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)

                18:09:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)

                18:09:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at java.lang.Thread.run(Thread.java:724)

                 

                plus, i have 2 errors eclipse is telling that the project facet EAR cant be changed to 6.0 and data cant be changed to EJB 3.0

                • 5. Re: Move ear from Jboss AS 6.1.0 to Jboss AS 7.1.1
                  sfcoy

                  The ClassCastException means that you probably have two copies of the com.beepeers.server.logic.operation.AdminFacade class in your ear. Maybe a copy of the EJB jar made its way into your WAR component.

                   

                  Make sure you're using Eclipse Kepler with JBoss Tools installed. This works great, but you may need to recreate your workspace. Do a

                   

                       mvn eclipse:clean

                   

                  from the command line before importing your maven projects back in.

                  1 of 1 people found this helpful
                  • 6. Re: Move ear from Jboss AS 6.1.0 to Jboss AS 7.1.1
                    beepeers

                    Hi stephen !

                     

                    i saw something strange yesterday cause in my jboss 6 with my old maven config

                    when i deployed my ear, it looks like:

                    ear

                    |-api

                    |-config

                    |-data

                    |-logic

                    |-r-o

                    |web

                     

                    and now in the jboss 7 with the new maven config:

                    ear

                    |--api

                       |--logic

                       |--config

                       |--data

                    |--config

                    |--data

                    |--logic

                    |--r-o

                    |--web

                       |--logic

                       |--config

                       |--data

                       |--r-o

                     

                    maybe you know why ?

                    • 7. Re: Move ear from Jboss AS 6.1.0 to Jboss AS 7.1.1
                      sfcoy

                      How are you deploying your application?

                       

                      What does the application structure look like if you build it from the command line?

                       

                      It's important that your maven-ear-plugin is at least version 2.8, which was specified in the pluginManagement section of the parent pom.xml.

                       

                      In additition, it's important that it contains the configuration element:

                      {code:xml}<skinnyWars>true</skinnyWars>{code}

                      • 8. Re: Move ear from Jboss AS 6.1.0 to Jboss AS 7.1.1
                        beepeers

                        Hi Stephen,

                         

                        i didn't modified your pom

                        i deployed my ear in eclipse without maven build... well now i run a maven build with clean install package, i use the web interface to deploy the ear and at first call to the server with my rest client i get:

                         

                        16:13:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) java.lang.NullPointerException

                        16:13:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at com.beepeers.server.api.resources.v2.admin.impl.ContextResource.getContextRO(ContextResource.java:16)

                        16:13:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                        16:13:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

                        16:13:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                        16:13:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at java.lang.reflect.Method.invoke(Method.java:597)

                        16:13:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:155)

                        16:13:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:257)

                        16:13:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:222)

                        16:13:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:211)

                        16:13:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:525)

                        16:13:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:502)

                        16:13:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:119)

                        16:13:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)

                        16:13:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)

                        16:13:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)

                        16:13:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)

                        16:13:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)

                        16:13:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)

                        16:13:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)

                        16:13:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)

                        16:13:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50)

                        16:13:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)

                        16:13:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)

                        16:13:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

                        16:13:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

                        16:13:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)

                        16:13:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)

                        16:13:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)

                        16:13:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)

                        16:13:31 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)           at java.lang.Thread.run(Thread.java:662)

                         

                        maybe i missed to tell you something ?

                        i call services resources in api (like ContextResource) which call a facade then the manager (in logic), the dao, the manager transform in RO then the Response in api is sent in Json to the client.

                        • 9. Re: Move ear from Jboss AS 6.1.0 to Jboss AS 7.1.1
                          sfcoy

                          What happens in line 16 of com.beepeers.server.api.resources.v2.admin.impl.ContextResource?

                          • 10. Re: Move ear from Jboss AS 6.1.0 to Jboss AS 7.1.1
                            beepeers

                            here my IContextResource

                             

                            @Path("v2/admin/context")

                            public interface IContextResource {

                             

                                      @GET

                                      @Produces("application/json; charset=UTF-8")

                                      public Response getContextRO(@HeaderParam("Authorization") String token) throws BadParametersException, BadRequestException, Exception;

                             

                             

                             

                            public class ContextResource extends RestResource implements IContextResource {

                             

                             

                                                     public Response getContextRO(String token) throws BadParametersException, BadRequestException, Exception {

                            line 16 ->            ContextRO contextRO = this.adminFacade.getContextRO(token);

                                                                         return this.success(contextRO);

                                                  }

                             

                             

                            and here my RestResource

                             

                            protected RestResource() {

                                                InitialContext ic;

                                                try {

                                                          ic = new InitialContext();

                                                          this.adminFacade = (AdminFacade) ic.lookup("java:global/ear/logic/AdminFacade");

                                                } catch (NamingException e) {

                                                }

                                      }

                            • 11. Re: Move ear from Jboss AS 6.1.0 to Jboss AS 7.1.1
                              sfcoy

                              It looks like your JNDI lookup is failing (swallowing exceptions is evil). Are you sure you have the correct lookup name?

                               

                              Incidentally, you should be able to inject the reference:

                              {code:java}@EJB protected AdminFacade adminFacade;{code}

                              instead of the JNDI lookup.

                              • 12. Re: Move ear from Jboss AS 6.1.0 to Jboss AS 7.1.1
                                beepeers

                                "(swallowing exceptions is evil)" yeah i know, this guy does not work anymore with us...

                                i removed  the try catch in the constructor and added the @EJB for the AdminFacade but get the same result.

                                i guess i need to learn something more cause the project works great on the jboss 6 and it's like hell to move to jboss 7..

                                it's time to learn more about jboss / maven / ejb / hiberate i guess

                                • 13. Re: Move ear from Jboss AS 6.1.0 to Jboss AS 7.1.1
                                  beepeers

                                  Hi Stephen !

                                   

                                  I found this post: http://howtojboss.com/2012/04/30/jboss-trading-java-ee-5-to-java-ee-6-migration-part-i-cdi-1-0-jax-rs-1-1/

                                  maybe it could help me, what do you think of it ?

                                  • 14. Re: Move ear from Jboss AS 6.1.0 to Jboss AS 7.1.1
                                    beepeers

                                    Hi Stephen !

                                     

                                    I found the solution, the project is now working as well ! thanks for your help !

                                    1 2 Previous Next