12 Replies Latest reply: Jul 30, 2012 9:26 AM by swoeste RSS

[JBoss 7.1] SerializingCloner can't clone primitive data types

swoeste Newbie

Hey Guys,

 

I am still migrating our application from JBoss 4 -> JBoss 7 and have a problem again.

We have a bean in another application with the following interface:

 

public interface SchedulerFacade {
     // ...
    Ticket createTicket( double capacity, Map<String, String> attributes, long durability );
     // ...
}

 

In our application we execute that method with the following code:

 

getFacadeRemote().invokeMethod( aBeanName, aMethodName, paramTypes, aArgs, aContext );

 

Because the method is invoked on the remote bean everything is cloned by the org.jboss.marshalling.cloner.SerializingCloner.

The arguments are cloned by org.jboss.marshalling.cloner.ClassLoaderClassCloner in this Method:

 

public Class<?> clone(final Class<?> original) throws IOException, ClassNotFoundException {
        final String name = original.getName();
        if (name.startsWith("java.")) {
            return original;
        } else if (original.getClassLoader() == destClassLoader) {
            return original;
        } else {
            return Class.forName(name, true, destClassLoader);
        }
    }

 

My problem are the primitive data types, as you see in the interface, double and long.

The above method is called with clone("double") which causes an exception ...

 

So my question is:

Are we doing wrong by using primitive data types at that location or is this a problem in the ClassLoaderClassCloner?

I think it would be difficult to do the trick in the ClassLoaderClassCloner so the problem is house made by us ... isn't it?

 

best regards

Sebastian

  • 1. Re: [JBoss 7.1] SerializingCloner can't clone primitive data types
    jaikiran pai Master

    swoeste wrote:

     

    So my question is:

    Are we doing wrong by using primitive data types at that location

    No, there's nothing wrong in using primitives.

     

     

    swoeste wrote:

     

    or is this a problem in the ClassLoaderClassCloner?

    Can you please post the entire exception stacktrace?

  • 2. Re: [JBoss 7.1] SerializingCloner can't clone primitive data types
    swoeste Newbie

    Hi,

     

    here is the stack trace:

     

    Caused by: org.springframework.binding.expression.EvaluationException: An ELException occurred getting the value for expression 'fw_pl_desktop_navigationManager.process(flowExecutor)' on con

    text [class org.springframework.webflow.engine.impl.RequestControlContextImpl]

            at org.springframework.binding.expression.el.ELExpression.getValue(ELExpression.java:69)

            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)

            ... 79 more

    Caused by: javax.el.ELException: java.lang.RuntimeException: ClassNotFoundException marshaling EJB parameters

            at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:333)

            at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:274)

            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)

            ... 83 more

    Caused by: java.lang.RuntimeException: ClassNotFoundException marshaling EJB parameters

            at org.jboss.as.ejb3.remote.LocalEjbReceiver.clone(LocalEjbReceiver.java:226)

            at org.jboss.as.ejb3.remote.LocalEjbReceiver.clone(LocalEjbReceiver.java:213)

            at org.jboss.as.ejb3.remote.LocalEjbReceiver.processInvocation(LocalEjbReceiver.java:133)

            at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:173)

            at org.jboss.ejb.client.TransactionInterceptor.handleInvocation(TransactionInterceptor.java:43)

            at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:175)

            at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:92)

            at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:175)

            at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:136)

            at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:121)

            at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:104)

            at $Proxy299.invokeMethod(Unknown Source)

            at de.zeb.control.fw.bl.internal.layerabstraction.GenericBusinessFacadeAdapter.invokeMethod(GenericBusinessFacadeAdapter.java:45)

            at de.zeb.control.fw.bl.internal.layerabstraction.InterceptorProxyFactoryBean.delegateMethodInvocation(InterceptorProxyFactoryBean.java:144)

            at de.zeb.control.fw.bl.internal.layerabstraction.InterceptorProxyFactoryBean.delegateMethodInvocationUnwrappingTargetException(InterceptorProxyFactoryBean.java:136)

            at de.zeb.control.fw.bl.internal.layerabstraction.InterceptorProxyFactoryBean.delegateMethodInvocationWithLogging(InterceptorProxyFactoryBean.java:116)

            at de.zeb.control.fw.bl.internal.layerabstraction.InterceptorProxyFactoryBean.invoke(InterceptorProxyFactoryBean.java:95)

            at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)

            at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)

            at $Proxy300.createTicket(Unknown Source)

            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

            at java.lang.reflect.Method.invoke(Method.java:597)

            at de.zeb.control.fw.bl.layerabstraction.MethodInvokerUtil.invokeMethodUnwrappingException(MethodInvokerUtil.java:89)

            at de.zeb.control.fw.bl.internal.layerabstraction.MediatorInterceptorProxyFactoryBean.invoke(MediatorInterceptorProxyFactoryBean.java:60)

            at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)

            at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)

            at $Proxy300.createTicket(Unknown Source)

            at de.zeb.control.fw.pl.desktop.navigation.PresentationNavigationManager.processGate(PresentationNavigationManager.java:403)

            at de.zeb.control.fw.pl.desktop.navigation.PresentationNavigationManager.process(PresentationNavigationManager.java:257)

            at de.zeb.control.fw.pl.desktop.navigation.PresentationNavigationManager.process(PresentationNavigationManager.java:194)

            at de.zeb.control.fw.pl.desktop.navigation.PresentationNavigationManager.process(PresentationNavigationManager.java:207)

            at de.zeb.control.fw.pl.desktop.navigation.PresentationNavigationManager.process(PresentationNavigationManager.java:173)

            at de.zeb.control.fw.pl.desktop.navigation.PresentationNavigationManager$$FastClassByCGLIB$$deed99a1.invoke(<generated>)

            at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)

            at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:688)

            at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)

            at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)

            at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)

            at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)

            at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:621)

            at de.zeb.control.fw.pl.desktop.navigation.PresentationNavigationManager$$EnhancerByCGLIB$$a1373cab.process(<generated>)

            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

            at java.lang.reflect.Method.invoke(Method.java:597)

            at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:329)

            ... 89 more

    Caused by: java.lang.ClassNotFoundException: double from [Module "deployment.centralservice-2.4.1.ear.fw.core.bl.layerabstraction.server-1.15.1.jar:main" from Service Module Loader]

            at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)

            at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)

            at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)

            at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)

            at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)

            at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)

            at java.lang.Class.forName0(Native Method)

            at java.lang.Class.forName(Class.java:247)

            at org.jboss.marshalling.cloner.ClassLoaderClassCloner.clone(ClassLoaderClassCloner.java:46)

            at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:158)

            at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:135)

            at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:219)

            at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:135)

            at org.jboss.as.ejb3.remote.LocalEjbReceiver.clone(LocalEjbReceiver.java:222)

            ... 136 more

     

    The problem occurs in the clone("double") method of ClassLoaderClassCloner:

    He tries to execute

     

    // ...
    } else {
         return Class.forName("double", true, destClassLoader);
    }
    // ..
    

     

    but that wont work.

  • 3. Re: [JBoss 7.1] SerializingCloner can't clone primitive data types
    jaikiran pai Master

    That's a bug. Please create a JIRA here https://issues.jboss.org/browse/AS7 and mark it for EJB component.

  • 4. Re: [JBoss 7.1] SerializingCloner can't clone primitive data types
    swoeste Newbie

    Created a ticket and added it to this thread.

  • 5. Re: [JBoss 7.1] SerializingCloner can't clone primitive data types
    jaikiran pai Master

    The fix for this will be available in the next nightly build https://community.jboss.org/thread/167590

  • 6. Re: [JBoss 7.1] SerializingCloner can't clone primitive data types
    swoeste Newbie

    Today i had some time to test our application on JBoss 7.1.1.FINAL.

    The ticket AS7-3959 did not solve our problem.

    But i was able to create a small application that re-produces the exception, which occours in our application.

     

    Could you have a look at it?

    Just deploy the ear, open http://localhost:8080/ejb3.war/  ...

     

    best regards

    Sebastian

  • 7. Re: [JBoss 7.1] SerializingCloner can't clone primitive data types
    jaikiran pai Master

    Okay, I see what's going on, thanks for reporting.

  • 9. Re: [JBoss 7.1] SerializingCloner can't clone primitive data types
    jaikiran pai Master

    Yes a pull request has been sent https://github.com/jaikiran/jboss-marshalling/commit/09b7b7b945d745d51caf1a7706c60bfbe2d3d701. I'll update this thread once it's available in the nightly builds.

  • 10. Re: [JBoss 7.1] SerializingCloner can't clone primitive data types
    metallist Newbie

    So, has the fix made it to the GA builds? 'Cause I seem to stumble upon the very same exception but for the int primitive type. I'm using jboss 7.1.1, do I have to get the latest nightly build instead?

  • 11. Re: [JBoss 7.1] SerializingCloner can't clone primitive data types
    Thomas Szadel Newbie

    Apparently it doesn't take part of the released code

    I still have the same exception & have to patch the code to get it working... it's very annoying for a Final version...

     

    Does anyone know when an official patch will be released ?

  • 12. Re: [JBoss 7.1] SerializingCloner can't clone primitive data types
    swoeste Newbie

    Im not 100% sure but i think it was not in the last jboss 7 release.

    But its inclouded in the jboss-marshalling release 1.3.12, the last release of jboss only contains 1.3.11.

     

    We have patched that manually here and it runs perfectly

     

    Edit:

    I have looked up the situation to be sure.

    Jboss 7.1.1-Final contains jboss-marshalling:1.3.11 so it wont work because its not fixed in that version.

    You could find the module at modules\org\jboss\marshalling\main.