users@glassfish.java.net

Re: ClassCastException

From: Soe Moe Kyaw _at_ Stephen Wang <swmk.stephen_at_gmail.com>
Date: Sat, 11 Nov 2006 10:39:08 +0630

Hi, I think the problem is with my Collection. Please see two attached files.

If I put like this;

                user._setPrincipals(null);
                user.setCredential(null);

                user.getRealm()._setUsers(null);

I was OK. Is there something wrong?

On 11/10/06, Soe Moe Kyaw @ Stephen Wang <swmk.stephen_at_gmail.com> wrote:
> Hi, Marina
> This doesn't solve the problem.
>
>
> --
> Regards;
> Stephen Wang
>
> On 11/9/06, Marina Vatkina wrote:
>
> Hi Stephen,
>
> I think that the problem is in the classes on the client side that were not
> processed by the TopLink code. Can you check that marking all ToOne
> relationships with fetch type EAGER solves the problem?
>
> thanks,
> -marina
>
> Soe Moe Kyaw @ Stephen Wang wrote:
> > java.lang.ClassCastException:
> > com.rayx.presentation.security.GetUserWSResponse
> > at
> > com.sun.corba.ee.impl.copyobject.ORBStreamObjectCopierImpl.copy(
> ORBStreamObjectCopierImpl.java:43)
> > at
> > com.sun.corba.ee.impl.copyobject.ORBStreamObjectCopierImpl.copy
> > (ORBStreamObjectCopierImpl.java:32)
> > at
> > com.sun.corba.ee.impl.copyobject.FallbackObjectCopierImpl.copy(
> FallbackObjectCopierImpl.java:39)
> > at
> > com.sun.corba.ee.impl.copyobject.FallbackObjectCopierImpl.copy
> > (FallbackObjectCopierImpl.java:30)
> > at
> > com.sun.corba.ee.impl.javax.rmi.CORBA.Util.copyObject(Util.java:745)
> > at
> > com.sun.corba.ee.impl.presentation.rmi.DynamicMethodMarshall
> erImpl.copyResult(DynamicMethodMarshallerImpl.java
> > :414)
> > at
> > com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandler
> Impl.privateInvoke(StubInvocationHandlerImpl.java:202)
> > at
> > com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(
> > StubInvocationHandlerImpl.java:119)
> > at
> > com.sun.corba.ee.impl.presentation.rmi.bcel.BCELStubBase.invoke(
> BCELStubBase.java:197)
> > at
> > com.rayx.session.security.__SecurityContextRemote_Remote
> _DynamicStub.getUserByNameAndRealm
> > (__SecurityContextRemote_Remote_DynamicStub.java)
> > at
> > com.rayx.session.security._SecurityContextRemote_Wrapper
> .getUserByNameAndRealm(com.rayx.session.security.
> _SecurityContextRemote_Wrapper.java)
> > at
> > com.rayx.webservices.security.GetUserByNameAndRealmWS
> .getUserByNameAndRealm
> > (GetUserByNameAndRealmWS.java:72)
> > 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:585)
> > at
> > com.sun.enterprise.security.application.EJBSecurityManager.runMethod(
> EJBSecurityManager.java:1050)
> > at
> > com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:165)
> > at
> > com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(
> BaseContainer.java:2766)
> > at com.sun.ejb.containers.BaseContainer.intercept
> > (BaseContainer.java:3847)
> > at
> > com.sun.ejb.containers.WebServiceInvocationHandler.invoke
> (WebServiceInvocationHandler.java:147)
> > at $Proxy47.getUserByNameAndRealm(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:585)
> > at com.sun.xml.ws.server.PeptTie._invoke(PeptTie.java:61)
> > at
> > com.sun.xml.ws.protocol.soap.server.SOAPMessageDispatcher.invokeEndpoint(
> SOAPMessageDispatcher.java
> > :280)
> > at
> > com.sun.xml.ws.protocol.soap.server.SOAPMessageDispatcher
> $SoapInvoker.invoke(SOAPMessageDispatcher.java:588)
> > at
> > com.sun.xml.ws.protocol.soap.server.SOAPMessageDispatcher.receive(
> SOAPMessageDispatcher.java
> > :147)
> > at com.sun.xml.ws.server.Tie.handle(Tie.java:90)
> > at
> > com.sun.enterprise.webservice.Ejb3MessageDispatcher.handlePost(
> Ejb3MessageDispatcher.java:160)
> > at com.sun.enterprise.webservice.Ejb3MessageDispatcher.invoke
> > (Ejb3MessageDispatcher.java:89)
> > at
> > com.sun.enterprise.webservice.EjbWebServiceServlet.dispatchToEjbEndpoint(
> EjbWebServiceServlet.java:186)
> > at com.sun.enterprise.webservice.EjbWebServiceServlet.service
> > (EjbWebServiceServlet.java:117)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
> > at
> > com.sun.enterprise.web.AdHocContextValve.invoke(AdHocContextValve.java
> :101)
> > at org.apache.catalina.core.StandardPipeline.doInvoke
> > (StandardPipeline.java:566)
> > at
> > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java
> :536)
> > at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:71)
> > at org.apache.catalina.core.StandardHostValve.invoke
> > (StandardHostValve.java:182)
> > at
> > org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java
> :566)
> > at
> > com.sun.enterprise.web.VirtualServerPipeline.invoke(
> VirtualServerPipeline.java:120)
> > at
> > org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
> > at
> > org.apache.catalina.core.StandardEngineValve.invoke(
> StandardEngineValve.java:137)
> > at org.apache.catalina.core.StandardPipeline.doInvoke
> > (StandardPipeline.java:566)
> > at
> > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java
> :536)
> > at
> > org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
> > at org.apache.coyote.tomcat5.CoyoteAdapter.service
> > (CoyoteAdapter.java:239)
> > at
> > com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(
> ProcessorTask.java:667)
> > at
> > com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(
> ProcessorTask.java
> > :574)
> > at
> > com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(
> ProcessorTask.java:844)
> > at
> > com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(
> ReadTask.java:287)
> > at
> > com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java
> :212)
> > at
> > com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
> > at com.sun.enterprise.web.connector.grizzly.WorkerThread.run
> > (WorkerThread.java:75)
> >
> > --
> > Regards;
> > Stephen Wang
> >
> > On 11/9/06, Marina Vatkina wrote:
> >
> > What is the exact exception text?
> >
> > thanks,
> > -marina
> >
> > Soe Moe Kyaw @ Stephen Wang wrote:
> >> I do have two toplinks jar in my SDKlib but not in my domain lib.
> >> Sure, I can give you more on what you wanna know. What shall I give?
> >>
> >> --
> >> Regards;
> >> Soe Moe Kyaw @ Stephen Wang
> >>
> >> On 11/8/06, Marina Vatkina wrote:
> >>
> >> Hi,
> >>
> >> Do you have toplink-essentials.jar on the web side of your
> > app? If not,
> >> please try to add it and check if it solves the problem. If
> > you do,
> >> we need
> >> more details to be able to help.
> >>
> >> thanks,
> >> -marina
> >>
> >> Soe Moe Kyaw @ Stephen Wang wrote:
> >> > This happens like this;
> >> >
> >> > I have Entities namly User, Realm, Credential and Principal.
> >> >
> >> > User is associated with Realm (Many-to-One), Credential
> >> (One-to-One),
> >> > Principal (One-to-Many).
> >> >
> >> > I have a web service called getUserByNameAndRealm which takes user
> >> name
> >> > and realm name. That web method delegate to a method from Session
> >> > Bean. The result is wrapped by a Class which includes User and
> >> Status
> >> > of the operation. It works well when the session returns the
> > response
> >> > which User object is null. But when the session found the User and
> >> > returns it, the Exception occured. So I tried to set the principal,
> >> > credential and realm of User to null. It works well then. Why
> >> does it
> >> > happen like that and any solution to that?
> >> >
> >>
> >>
> > ---------------------------------------------------------------------
> >> To unsubscribe, e-mail:
> > users-unsubscribe_at_glassfish.dev.java.net
> > <mailto:users-unsubscribe_at_glassfish.dev.java.net>
> > > <mailto:users-unsubscribe_at_glassfish.dev.java.net
> > <mailto:users-unsubscribe_at_glassfish.dev.java.net>>
> >> For additional commands, e-mail: users-help_at_glassfish.dev.java
> > .net <mailto:users-help_at_glassfish.dev.java.net>
> > > <mailto:users-help_at_glassfish.dev.java.net
> > <mailto:users-help_at_glassfish.dev.java.net>>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> > <mailto:users-unsubscribe_at_glassfish.dev.java.net>
> > For additional commands, e-mail: users-help_at_glassfish.dev.java.net
> > <mailto:users-help_at_glassfish.dev.java.net>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>


-- 
Regards;
Soe Moe Kyaw @ Stephen Wang