• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Object is not of remote type error in GlassFish v3

 
Ranch Hand
Posts: 35
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good day,

After using GlassFish v2 and JEE 5 I have decided to give GlassFish V3 and JEE 6 a go. I am using Eclipse V3.4 and have configured the GlassFish v3 JEE 6 Server Adapter. My server and client side apps are referencing the new libraries and I am ready to go. I have deployed my EJB 3 application successfully to the server, however I will be a son-of-a-gun if my client is having problems connecting via JNDI. The stacktrace indicates I am trying to grab an object that is not Remote, but that seems rather odd to me as this has not changed and it is in fact my @Remote interface to my session bean.

Quick view of the implementation code:



Now the remote interface:


Now the client (this is JUnit)



And here is the error I get when attempting to run the JUnit (again, this same code worked find under GlassFish v2)

javax.naming.CommunicationException: Can't find SerialContextProvider [Root exception is java.lang.ClassCastException]
at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:164)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:409)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at com.quintessential.ub3.bam.IUB3Session_Physical_MeterReadPostingTest.setUp(IUB3Session_Physical_MeterReadPostingTest.java:46)
at junit.framework.TestCase.runBare(TestCase.java:128)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:120)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: java.lang.ClassCastException
at com.sun.corba.ee.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:258)
at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137)
at com.sun.enterprise.naming.SerialContext.narrowProvider(SerialContext.java:136)
at com.sun.enterprise.naming.SerialContext.getCachedProvider(SerialContext.java:259)
at com.sun.enterprise.naming.SerialContext.getRemoteProvider(SerialContext.java:204)
at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:159)
... 14 more
Caused by: java.lang.ClassCastException: Object is not of remote type com.sun.enterprise.naming.SerialContextProvider
at com.sun.corba.ee.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:250)
... 19 more


Thanks for any clues here,
Stu
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If I understood your client correctly, you are trying to access EJB via JNDI looktup thorough JUnit test case. But JUnit runs out of container. Are you using Cactus or something or is this plain out of container JUnit client ?
If this is out of container JUnit you will not be able to access EJB vis JNDI lookup. No Initial context would be available in that case.
 
Stu Quinn
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Prasad,

I regularly test this way from JUnit running in Eclipse. Below are samples that are working just fine in JBOSS and GlassFish V2. The problem seems to be when attempting to narrow the remote object, but I am away from the laptop where I am having the problem at the moment. I need to see what it is trying to return.

Samples that work:


Thanks,
Stu
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Stu-
I know its been a old post.
But just wanted to check if you were able to find a solution for the issue?

Because I just migrated application from Glassfish 2.1 to Glassfish 3.1.1 and am facing the exact same issue where the remote ejb invocation fails with the exception:

Caused by: java.lang.ClassCastException
at com.sun.corba.ee.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:258)
at javax.rmi.PortableRemoteObject.narrow(Unknown Source)
at com.sun.enterprise.naming.SerialContext.narrowProvider(SerialContext.java:136)
at com.sun.enterprise.naming.SerialContext.getRemoteProvider(SerialContext.java:220)
at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:159)
... 17 more
Caused by: java.lang.ClassCastException: Object is not of remote type com.sun.enterprise.naming.SerialContextProvider
at com.sun.corba.ee.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:250)
... 21 more

Any help on this is appreciated
 
reply
    Bookmark Topic Watch Topic
  • New Topic