10 Replies Latest reply on Jan 16, 2014 5:46 AM by hibernator_11

    migration ear + client application from jboss 6 to to jboss eap 6.2

    hibernator_11

      Hi,

       

      I'm trying to migrate my application from jboss 6 to jboss eap 6.2. I have an EAR project with EJBs that is working on the new server. However, I have a client that connects to the remote EJBs in the same server and I get an exception:

       

      Caused by: java.lang.RuntimeException: JBAS014154: No logró organizar los parámetros EJB (failed to marshal EJB parameters)

      Caused by: java.lang.IllegalArgumentException: Can not set java.util.List field com.cervantesvirtual.dto.gestor.fatherDTO.mainAuthors to com.cervantesvirtual.dto.gestor.childDTO

      at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:146) [rt.jar:1.6.0_26]

          at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:150) [rt.jar:1.6.0_26]

          at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(UnsafeFieldAccessorImpl.java:37) [rt.jar:1.6.0_26]

          at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:57) [rt.jar:1.6.0_26]

          at java.lang.reflect.Field.set(Field.java:657) [rt.jar:1.6.0_26]

          at org.jboss.marshalling.cloner.SerializingCloner.storeFields(SerializingCloner.java:366) [jboss-marshalling-2.0.0.Beta1.jar:2.0.0.Beta1]

          at org.jboss.marshalling.cloner.SerializingCloner.initSerializableClone(SerializingCloner.java:309) [jboss-marshalling-2.0.0.Beta1.jar:2.0.0.Beta1]

          at org.jboss.marshalling.cloner.SerializingCloner.initSerializableClone(SerializingCloner.java:281) [jboss-marshalling-2.0.0.Beta1.jar:2.0.0.Beta1]

          at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:249) [jboss-marshalling-2.0.0.Beta1.jar:2.0.0.Beta1]

          at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:129) [jboss-marshalling-2.0.0.Beta1.jar:2.0.0.Beta1]

          at org.jboss.marshalling.cloner.SerializingCloner$StepObjectInput.doReadObject(SerializingCloner.java:834) [jboss-marshalling-2.0.0.Beta1.jar:2.0.0.Beta1]

          at org.jboss.marshalling.AbstractObjectInput.readObject(AbstractObjectInput.java:45) [jboss-marshalling-2.0.0.Beta1.jar:2.0.0.Beta1]

          at org.jboss.marshalling.MarshallerObjectInputStream.readObjectOverride(MarshallerObjectInputStream.java:57) [jboss-marshalling-2.0.0.Beta1.jar:2.0.0.Beta1]

          at java.io.ObjectInputStream.readObject(ObjectInputStream.java:344) [rt.jar:1.6.0_26]

          at java.util.ArrayList.readObject(ArrayList.java:593) [rt.jar:1.6.0_26]

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_26]

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_26]

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_26]

          at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_26]

          at org.jboss.marshalling.reflect.SerializableClass.callReadObject(SerializableClass.java:304) [jboss-marshalling-2.0.0.Beta1.jar:2.0.0.Beta1]

          at org.jboss.marshalling.cloner.SerializingCloner.initSerializableClone(SerializingCloner.java:299) [jboss-marshalling-2.0.0.Beta1.jar:2.0.0.Beta1]

          at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:249) [jboss-marshalling-2.0.0.Beta1.jar:2.0.0.Beta1]

          at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:129) [jboss-marshalling-2.0.0.Beta1.jar:2.0.0.Beta1]

          at org.jboss.marshalling.cloner.SerializingCloner.cloneFields(SerializingCloner.java:345) [jboss-marshalling-2.0.0.Beta1.jar:2.0.0.Beta1]

          at org.jboss.marshalling.cloner.SerializingCloner.initSerializableClone(SerializingCloner.java:305) [jboss-marshalling-2.0.0.Beta1.jar:2.0.0.Beta1]

          at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:249) [jboss-marshalling-2.0.0.Beta1.jar:2.0.0.Beta1]

          at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:129) [jboss-marshalling-2.0.0.Beta1.jar:2.0.0.Beta1]

          at org.jboss.as.ejb3.remote.LocalEjbReceiver.clone(LocalEjbReceiver.java:295) [jboss-as-ejb3-7.3.0.Final-redhat-8.jar:7.3.0.Final-redhat-8]

       

       

      childDTO inherits from fatherDTO and mainAuthors field is declared as a List. All of them are marked as Serializable.

       

      In jboss 6 everything was working fine without any problem....

       

      I've been searching on internet for a while and I haven't found the solution...

       

      However, I found something here but I'm not sure that this is doesn't work in my case [AS7-3330] Allow configuring the EJB subsystem for disabling pass by value semantics for invocations on remote interface…

       

      Any ideas?

       

      Thanks in advance!

        • 1. Re: migration ear + client application from jboss 6 to to jboss eap 6.2
          wdfink

          Where do you see the Exception and could you share the relevant code part?

          • 2. Re: migration ear + client application from jboss 6 to to jboss eap 6.2
            hibernator_11

            Hi,

             

            My client just try to look with JNDI the remote EJB as I have seen in the Jboss Quick Examples (Quickstarts: Get Started)

             

            This code is in my client:

             

            private static SearchBoEjbRemote lookupRemoteEJB() throws NamingException

            {

                    final Properties jndiProperties = new Properties();

                    jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");

                    // create the context

                    final Context context = new InitialContext(jndiProperties);

             

                    return (SearchBoEjbRemote) context.lookup("ejb:earproject/ejbproject-4.0/SearchBoEjb!com.virtual.interfaces.SearchBoEjbRemote");

            }

             

            In my server configuration standalone.xml file I have set:

            <subsystem xmlns="urn:jboss:domain:ejb3:1.4">

              .....

                         <in-vm-remote-interface-invocation pass-by-value="false"/>

                    </subsystem>

             

            I have been testing several version of marshalling libraries. Which one should I use? jboss-marshalling-river or org.jboss.marshalling?

             

            <!-- data serialization for invoking remote EJBs -->
            <dependency>

              <groupId>org.jboss.marshalling</groupId>

              <artifactId>jboss-marshalling-river</artifactId>

              <version>1.4.3.Final</version>

              <scope>runtime</scope>

            </dependency>

             

            <dependency>

              <groupId>org.jboss.marshalling</groupId>

              <artifactId>jboss-marshalling</artifactId>

              <version>2.0.0.Beta1</version>

            </dependency>

             

             

            Everything deploys well but when I try to call the EJB, i get the exception mentioned before....I'm new at Jboss AEP and I must be doing something wrong....

             

            EDITED:

             

            I have tested with jboss-marshalling-1.3.16.GA.jar included in jboss and jboss-marshalling-2.0.0.Beta1 but still the same problem:

             

            Caused by: java.lang.IllegalArgumentException: Can not set java.util.List field ... to ....

                at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:146) [rt.jar:1.6.0_26]

                at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:150) [rt.jar:1.6.0_26]

                at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(UnsafeFieldAccessorImpl.java:37) [rt.jar:1.6.0_26]

                at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:57) [rt.jar:1.6.0_26]

                at java.lang.reflect.Field.set(Field.java:657) [rt.jar:1.6.0_26]

                at org.jboss.marshalling.cloner.SerializingCloner.storeFields(SerializingCloner.java:366) [jboss-marshalling-1.3.16.GA.jar:1.3.16.GA]

                at org.jboss.marshalling.cloner.SerializingCloner.initSerializableClone(SerializingCloner.java:309) [jboss-marshalling-1.3.16.GA.jar:1.3.16.GA]

                at org.jboss.marshalling.cloner.SerializingCloner.initSerializableClone(SerializingCloner.java:281) [jboss-marshalling-1.3.16.GA.jar:1.3.16.GA]

                at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:249) [jboss-marshalling-1.3.16.GA.jar:1.3.16.GA]

                at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:129) [jboss-marshalling-1.3.16.GA.jar:1.3.16.GA]

                at org.jboss.marshalling.cloner.SerializingCloner$StepObjectInput.doReadObject(SerializingCloner.java:834) [jboss-marshalling-1.3.16.GA.jar:1.3.16.GA]

                at org.jboss.marshalling.AbstractObjectInput.readObject(AbstractObjectInput.java:45) [jboss-marshalling-1.3.16.GA.jar:1.3.16.GA]

                at org.jboss.marshalling.MarshallerObjectInputStream.readObjectOverride(MarshallerObjectInputStream.java:57) [jboss-marshalling-1.3.16.GA.jar:1.3.16.GA]

                at java.io.ObjectInputStream.readObject(ObjectInputStream.java:344) [rt.jar:1.6.0_26]

                at java.util.ArrayList.readObject(ArrayList.java:593) [rt.jar:1.6.0_26]

                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_26]

                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_26]

                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_26]

                at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_26]

                at org.jboss.marshalling.reflect.SerializableClass.callReadObject(SerializableClass.java:304) [jboss-marshalling-1.3.16.GA.jar:1.3.16.GA]

                at org.jboss.marshalling.cloner.SerializingCloner.initSerializableClone(SerializingCloner.java:299) [jboss-marshalling-1.3.16.GA.jar:1.3.16.GA]

                at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:249) [jboss-marshalling-1.3.16.GA.jar:1.3.16.GA]

                at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:129) [jboss-marshalling-1.3.16.GA.jar:1.3.16.GA]

                at org.jboss.marshalling.cloner.SerializingCloner.cloneFields(SerializingCloner.java:345) [jboss-marshalling-1.3.16.GA.jar:1.3.16.GA]

                at org.jboss.marshalling.cloner.SerializingCloner.initSerializableClone(SerializingCloner.java:305) [jboss-marshalling-1.3.16.GA.jar:1.3.16.GA]

                at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:249) [jboss-marshalling-1.3.16.GA.jar:1.3.16.GA]

                at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:129) [jboss-marshalling-1.3.16.GA.jar:1.3.16.GA]

                at org.jboss.as.ejb3.remote.LocalEjbReceiver.clone(LocalEjbReceiver.java:295) [jboss-as-ejb3-7.3.0.Final-redhat-8.jar:7.3.0.Final-redhat-8]

             

            My jdk version is java -version

            java version "1.6.0_26"

            Java(TM) SE Runtime Environment (build 1.6.0_26-b03)

            Java HotSpot(TM) Server VM (build 20.1-b02, mixed mode)

             

            I don't know what is the problem...

             

            Thanks in advance,

            • 3. Re: migration ear + client application from jboss 6 to to jboss eap 6.2
              wdfink

              the configuration "pass-by-value" take only effect if you use remote interfaces within the same server JVM.

              A standalone client is definitive a different JVM and therefor the parameter and return values must be serializable.

               

              Also I'm still not sure where you see the Exception.

              Is the server method invoked? You might check it with a log statement as first instruction in your EJB code.

              Or did the invocation failed direct?

              • 4. Re: migration ear + client application from jboss 6 to to jboss eap 6.2
                hibernator_11

                Thanks, I understand better now the pass-by-value configuration....

                 

                The invocation failed direct....

                 

                Could it be the java version?

                 

                This is my EJB declaration:

                 

                @Stateless(mappedName = "searchBo")

                @SecurityDomain("mydomain")

                @PermitAll

                @Remote(SearchBoEjbRemote.class)

                public class SearchBoEjb implements SearchBoEjbLocal, SearchBoEjbRemote, Serializable

                {

                ....

                }

                 

                In the log I can see:

                 

                14:56:29,691 DEBUG [org.jboss.security] (http-/127.0.0.1:8080-1) PBOX000291: Method: buscarPaginadoGestor, interface: Remote, required roles: Roles(<ANYBODY>,)

                14:56:29,691 TRACE [org.jboss.security.audit] (http-/127.0.0.1:8080-1) [Success]Source=org.jboss.security.plugins.javaee.EJBAuthorizationHelper;Action=authorization;Resource:=[org.jboss.security.authorization.resources.EJBResource:contextMap={policyRegistration=null}:method=public abstract com.virtual.dto.SearchResultDTO com.virtual.bo.interfaces.ISearchBo.buscarPaginadoGestor(java.lang.String,int,int,com.virtual.enums.TipoCamposBusqueda,com.virtual.enums.TipoOrdenBusqueda,com.virtual.enums.TipoResultadoED):ejbMethodInterface=Remote:ejbName=SearchBoEjb:ejbPrincipal=xxx.yyy:MethodRoles=Roles(<ANYBODY>,):securityRoleReferences=null:callerSubject=Asunto:

                    Principal: xxx.yyy

                    Principal: Roles(members:admin)

                    Principal: CallerPrincipal(members:xxx.yyy)

                :callerRunAs=null:callerRunAs=null:ejbRestrictionEnforcement=false:ejbVersion=2.0];policyRegistration=null;

                 

                Thanks in advance!

                • 5. Re: migration ear + client application from jboss 6 to to jboss eap 6.2
                  wdfink

                  The bean itself must not implement serializable.

                  But all parameters and return values for the invoked method.

                   

                  So in your case you need to check that all parameters of your invoked method are serializable. If you have complex objects you might nullify the objects to find where you have to check.

                  Remember that, if you use a collection, all objects hold by that must be serializeble.

                  1 of 1 people found this helpful
                  • 6. Re: migration ear + client application from jboss 6 to to jboss eap 6.2
                    hibernator_11

                    Hi!

                     

                    Thanks! I'm trying to solve the problem. Once I find the problem I'll let you know....:)

                     

                    EDITED:

                     

                    After removing all the attributes in my DTO classes I have a new exception:

                     

                    java.lang.ClassCastException: com.virtual.dto.gestor.SearchResultGestorDTO cannot be cast to com.virtual.dto.gestor.SearchResultGestorDTO

                     

                    Maybe I have to configure something in my client project....http://stackoverflow.com/questions/15032303/getting-started-with-embeddable-jboss-eap-6-as-7

                     

                    Hibernator,

                    • 7. Re: migration ear + client application from jboss 6 to to jboss eap 6.2
                      wdfink

                      That sounds like a class loader issue. If you pass by reference and have the same class loaded by different classloaders this Exception will be shown.

                      You should check whether you have this class in different archives.

                      1 of 1 people found this helpful
                      • 8. Re: Re: migration ear + client application from jboss 6 to to jboss eap 6.2
                        hibernator_11

                        Hi!

                         

                        I thought that was the problem...

                         

                        So how should I configure my maven projects? I have an EAR which has the EJB project. On the other hand, I have another WAR (GWT) project that use the remote interfaces in order to connect with the EJBs.

                         

                        This WAR includes the maven dependency with the DTOS and EJB interfaces. At some point, I don't know where the DTOS must be duplicated....

                         

                        I'll check class loading documentation https://access.redhat.com/site/documentation/en-US/JBoss_Enterprise_Application_Platform/6.1/html-single/Development_Guide/index.html#Overview_of_Class_Loading_and_Modules-1

                         

                        Should I use dependency configuration to jboss-deployment-structure.xml in order to load the dependency instead of using the pom in my WAR project?

                         

                        Thanks in advance!

                        • 9. Re: migration ear + client application from jboss 6 to to jboss eap 6.2
                          wdfink

                          There are two options:

                          1) use the app.jar

                              In that case you need to have remote invocation with pass-by-value=true to avoid class loading issues

                          2) use a common module with dependency in jboss-deployment-structure, or even MANIFEST which is the compatible EE way

                              In that case you can use call-by-value=false inside the JVM

                           

                          For a remote client that is no difference as you need the app.jar anyway and serialization is used.

                          • 10. Re: migration ear + client application from jboss 6 to to jboss eap 6.2
                            hibernator_11

                            Thanks!

                             

                            I'll let you know my results

                             

                            Hibernator,

                             

                            EDITED


                            Finally I made my project work. In my ear project I have to define a jboss-deployment-structure file like this one:

                             

                            <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1">

                                      <ear-subdeployments-isolated>false</ear-subdeployments-isolated>

                                      <deployment>

                                                <dependencies>

                                                      <module name="com.virtual.client" />

                                                </dependencies>

                                                <exclusions>

                                                          <module name="org.apache.log4j"/>

                                                </exclusions>

                                      </deployment>

                                       <sub-deployment name="virtual-negocio-ejb-4.0.jar">

                                                  <dependencies>

                                                      <module name="com.virtual.client" />

                                                </dependencies>

                                                <exclusions>

                                                          <module name="org.apache.log4j"/>

                                                </exclusions>

                                      </sub-deployment>

                                      <sub-deployment name="virtual-web-services-4.0.war">

                                                  <dependencies>

                                                      <module name="com.virtual.client" />

                                                      <module name="deployment.virtual-enterprise.ear.virtual-negocio-ejb-4.0.jar" />

                                                </dependencies>

                                                <exclusions>

                                                          <module name="org.apache.log4j"/>

                                                </exclusions>

                                      </sub-deployment>

                            </jboss-deployment-structure>

                             

                            In addition, in my client remote project based on GWT, I had to add another jboss-deployment-file like this one:

                             

                            <jboss-deployment-structure>

                              <deployment>

                                <dependencies>

                                  <module name="com.virtual.client" />

                                </dependencies>

                              </deployment>

                            </jboss-deployment-structure>

                             

                            In order to make the projects work, I also had to define a new module in jboss eap 6.2.0 modules folder with com.virtual.client project (it contains DTOs and intefaces). The only problem that I see if I want to change com.virtual.client project, I have to copy the file to the module folder. The com.virtual.client project is contained in my ear project. So, is there any way of doing this automatically with maven for example?

                             

                            Thanks in advance!