Hi Rajjaz

Linkage error happens when the same class is  being loaded by more than one
classloader.


Thanks
Thusitha

On Thu, Nov 26, 2015 at 11:20 AM, Rajjaz Mohammed <[email protected]> wrote:

> Hi,
> i Resolved that issue through Delete some classes inside the jar but its
> produce new error[1]. its seems to be like classloader issue[2]. and guide
> me on editing the jar file. is it OK for the development?
>
> [1]
> [2015-11-26 11:07:03,109] ERROR - EJBConnector Error calling EJB Service
> from EJBConnector
> javax.naming.NamingException: Lookup failed for
> 'java:global/org.wso2.carbon.custom.ejb-1.0-SNAPSHOT/HelloBean' in
> SerialContext[myEnv={org.omg.CORBA.ORBInitialPort=3700,
> java.naming.factory.initial=com.sun.enterprise.naming.SerialInitContextFactory,
> org.omg.CORBA.ORBInitialHost=localhost,
> java.naming.factory.url.pkgs=com.sun.enterprise.naming,
> java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl}
> [Root exception is javax.naming.NamingException: ejb ref resolution error
> for remote business interfaceorg.wso2.carbon.custom.ejb.HelloIF [Root
> exception is java.lang.RuntimeException: Could not invoke defineClass!]]
>     at
> com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:518)
>     at
> com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:455)
>     at javax.naming.InitialContext.lookup(InitialContext.java:411)
>     at javax.naming.InitialContext.lookup(InitialContext.java:411)
>     at
> org.wso2.carbon.custom.connector.EJBConnector.callEJB(EJBConnector.java:66)
>     at
> org.wso2.carbon.custom.connector.EJBConnector.connect(EJBConnector.java:44)
>     at
> org.wso2.carbon.connector.core.AbstractConnector.mediate(AbstractConnector.java:32)
>     at
> org.apache.synapse.mediators.ext.ClassMediator.mediate(ClassMediator.java:78)
>     at
> org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:81)
>     at
> org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:48)
>     at
> org.apache.synapse.mediators.template.TemplateMediator.mediate(TemplateMediator.java:97)
>     at
> org.apache.synapse.mediators.template.InvokeMediator.mediate(InvokeMediator.java:129)
>     at
> org.apache.synapse.mediators.template.InvokeMediator.mediate(InvokeMediator.java:78)
>     at
> org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:81)
>     at
> org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:48)
>     at
> org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:149)
>     at
> org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:185)
>     at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
>     at
> org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:317)
>     at
> org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:149)
>     at
> org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
>     at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>     at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>     at java.lang.Thread.run(Thread.java:745)
> Caused by: javax.naming.NamingException: ejb ref resolution error for
> remote business interfaceorg.wso2.carbon.custom.ejb.HelloIF [Root
> exception is java.lang.RuntimeException: Could not invoke defineClass!]
>     at com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:433)
>     at
> com.sun.ejb.containers.RemoteBusinessObjectFactory.getObjectInstance(RemoteBusinessObjectFactory.java:75)
>     at
> javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
>     at
> com.sun.enterprise.naming.impl.SerialContext.getObjectInstance(SerialContext.java:556)
>     at
> com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:514)
>     ... 23 more
> Caused by: java.lang.RuntimeException: Could not invoke defineClass!
>     at
> com.sun.corba.ee.impl.orbutil.codegen.CodeGeneratorUtil.makeClass(CodeGeneratorUtil.java:102)
>     at
> com.sun.corba.ee.spi.orbutil.codegen.Wrapper._generate(Wrapper.java:1106)
>     at
> com.sun.corba.ee.spi.orbutil.codegen.Wrapper._generate(Wrapper.java:1090)
>     at com.sun.ejb.EJBUtils.generateAndLoad(EJBUtils.java:595)
>     at
> com.sun.ejb.EJBUtils.loadGeneratedGenericEJBHomeClass(EJBUtils.java:547)
>     at com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:402)
>     ... 27 more
> Caused by: java.lang.reflect.InvocationTargetException
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>     at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>     at java.lang.reflect.Method.invoke(Method.java:606)
>     at
> com.sun.corba.ee.impl.orbutil.codegen.CodeGeneratorUtil.makeClass(CodeGeneratorUtil.java:99)
>     ... 32 more
> Caused by: java.lang.LinkageError: loader (instance of
> org/eclipse/core/runtime/internal/adaptor/ContextFinder): attempted
> duplicate class definition for name:
> "com/sun/ejb/codegen/GenericEJBHome_Generated"
>     at java.lang.ClassLoader.defineClass1(Native Method)
>     at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
>     ... 37 more
>
>
> [2] https://java.net/jira/browse/GLASSFISH-11505
>
>
> On Thu, Nov 26, 2015 at 10:24 AM, Dinusha Boteju <[email protected]>
> wrote:
>
>> Hi Rajjaz,
>>
>> One reason for this class cast exception could be because these 2 classes
>> are getting loaded from 2 different class loaders.
>>
>> -Dinusha
>>
>> On Wed, Nov 25, 2015 at 12:21 AM, Rajjaz Mohammed <[email protected]>
>> wrote:
>>
>>>
>>> Seems like a jar version mismatch. Better verify if we are using client
>>>> jars of the same server version?
>>>>
>>>
>>> yes malaka,
>>>  i accept with you its because of library version mismatch but if i add
>>> the same jar file inside the connector as Dependency then its work fine. so
>>> the issue may be some existing library affecting this library.
>>>
>>>
>>>> Check [1] May be it'll help
>>>>
>>>> [1]
>>>> http://www.coderanch.com/t/454071/java-EJB-SCBCD/certification/javax-naming-Reference-cast-org
>>>>
>>>>
>>> i checked but same issue repeating  again and again.
>>>
>>>
>>> --
>>> Thank you
>>> Best Regards
>>>
>>> *Rajjaz HM*
>>> Associate Software Engineer
>>> WSO2 Inc. <http://wso2.com/>
>>> lean | enterprise | middleware
>>> Mobile | +94752833834
>>> Email   | [email protected]
>>> LinkedIn | Blogger | WSO2 Profile
>>> <http://wso2.com/about/team/mohammer_rajjaz/>
>>>
>>> _______________________________________________
>>> Dev mailing list
>>> [email protected]
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>> *Dinusha Boteju*
>> *WSO2, Inc. http://wso2.com <http://wso2.com/> *
>> *lean.enterprise.middleware.*
>>
>> email: [email protected] <[email protected]>
>> phone:(+94) 776640275 <%28%2B94%29%20777739736>
>>
>
>
>
> --
> Thank you
> Best Regards
>
> *Rajjaz HM*
> Associate Software Engineer
> WSO2 Inc. <http://wso2.com/>
> lean | enterprise | middleware
> Mobile | +94752833834
> Email   | [email protected]
> LinkedIn | Blogger | WSO2 Profile
> <http://wso2.com/about/team/mohammer_rajjaz/>
>
> _______________________________________________
> Dev mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Thusitha Dayaratne
Software Engineer
WSO2 Inc. - lean . enterprise . middleware |  wso2.com

Mobile  +94712756809
Blog      alokayasoya.blogspot.com
About    http://about.me/thusithathilina
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to