I get a ClassCastException when narrow

InitialContext ctx = new InitialContext();
Object objref = ctx.lookup("hosp");
homehospfile = (hospfileHome)PortableRemoteObject.narrow(objref,hospfileHome.class);
My code is above.
If I wrote it in a servlet, it works fine, but if I wrote it in an application, it throw a ClassCastException on the line of narrow.
So I think it's not a problem of deployment.
I see some people encounter this problem in the Forum, but no solution is useful for me.
Could anyone help?
error message:
java.lang.ClassCastException
at com.sun.corba.ee.internal.javax.rmi.PortableRemoteObject.narrow(Porta
bleRemoteObject.java:296)
at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137)
at NewFile.init(newFile.java:32)
at JFrame1.JButton5_actionPerformed(JFrame1.java:587)
at JFrame1$SymAction.actionPerformed(JFrame1.java:539)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:14
50)
at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Abstra
ctButton.java:1504)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel
.java:378)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:250
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonL
istener.java:216)
at java.awt.Component.processMouseEvent(Component.java:3717)
at java.awt.Component.processEvent(Component.java:3546)
at java.awt.Container.processEvent(Container.java:1164)
at java.awt.Component.dispatchEventImpl(Component.java:2595)
at java.awt.Container.dispatchEventImpl(Container.java:1213)
at java.awt.Component.dispatchEvent(Component.java:2499)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:2451
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:2216)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2125)
at java.awt.Container.dispatchEventImpl(Container.java:1200)
at java.awt.Window.dispatchEventImpl(Window.java:912)
at java.awt.Component.dispatchEvent(Component.java:2499)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:319)
at java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java:10
3)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:84)

Hi all,
I am very new to java, having the same problem specified above, as the sol u suggested to put the stub into clients classpath then pls also tell what's this stub is?

Similar Messages

  • Java.lang.ClassCastException: Cannot narrow remote object weblogic.rmi.inte

    Hi,
    I am trying to deploy ejb3.0 on weblogic 10 server. I am able to find the JNDI name of the stateless session bean correctly, but getting an exception while narrowing it down. My ejb3.0 client is a standalone java client. I am trying to access the stateless session ejb3.0 bean.Please help me. i have been trying it for many days.
    thanks in advance,
    Sanjeev
    [sanpraka@localhost certEjb]$ java -cp ./:/usr/weblogic/bea/wlserver_10.0/server/lib/weblogic.jar:/usr/weblogic/bea/wlserver_10.0/server/lib/wlclient.jar com.titan.clients.Client
    Object is weblogic.rmi.internal.BasicRemoteRef - hostID: '5337880647112897730S:127.0.0.1:[7001,7001,-1,-1,-1,-1,-1]:wl_server:examplesServer', oid: '302', channel: 'null'
    java.lang.ClassCastException: Cannot narrow remote object weblogic.rmi.internal.BasicRemoteRef - hostID: '5337880647112897730S:127.0.0.1:[7001,7001,-1,-1,-1,-1,-1]:wl_server:examplesServer', oid: '302', channel: 'null' to com.titan.travelagent.TravelAgentRemote
    at weblogic.corba.server.naming.ReferenceHelperImpl.narrow(ReferenceHelperImpl.java:206)
    at weblogic.rmi.extensions.PortableRemoteObject.narrow(PortableRemoteObject.java:88)
    at weblogic.iiop.PortableRemoteObjectDelegateImpl.narrow(PortableRemoteObjectDelegateImpl.java:32)
    at javax.rmi.PortableRemoteObject.narrow(Unknown Source)
    at com.titan.clients.Client.main(Client.java:24)
    [sanpraka@localhost certEjb]$

    We have a similar problem. We have a web application (on server A) that invokes an EJB on a remote server (server B). This works fine, until we deploy another web application to server A at which point the existing web application starts to throw java.lang.ClassCastException when narrowing the remote EJB interface. The exception starts to be thrown at the moment the latter web application is deployed - start is not required.
    The latter web application contains (actually in APP-INF/lib) the old version of the EJB remote interface, that somehow gets to be loaded into the classpath of the existing web application. The solution is to delete the old version of the EJB remote interface from APP-INF/lib of the latter web application (we didn't need it anyway), but it would be interesting to know in which circumstances classes can get mixed between enterprise applications.
    I failed to reproduce the error in simple scenario, so this does not happen always.

  • ClassCastException when using javax.xml.soap.DetailEntry

    I am using the Java Web Services development pack and I'm getting a ClassCastException when trying to use a DetailEntry object.
    My code is basically as follows:
    SOAPFault fault = responseSoapBody.getFault();
    Detail detail = fault.getDetail();
    Iterator iterator = detail.getDetailEntries();
    DetailEntry entry = (DetailEntry)iterator.next(); //exception!!
    Exception:
    java.lang.ClassCastException: com.sun.xml.messaging.saaj.soap.dom4j.TextImpl
    The object being returned from the Iterator seems to be a TextImpl. In my CLASSPATH are the jars in the lib directory under <JWSDP>\jwsdp-1_0_01\common\lib.
    Any idea why I'm getting this Exception? Is this a bug in the JWSDP, or in my code?
    Thanks...

    You post has been forwarded to the SAAJ person as it seems
    like a SAAJ exception ... u should be hearing from the
    individual soon
    asengup

  • Why do I get a ClassCastException?

    Hello!
    I'm playing around with hibernate, axis2 and Weblogic 8.1.6 and I got I really tricky problem.
    My Weblogic 8.1.6 got consist of 3 servers.
    1 Adminserver (myserver)
    1 Managedserver (ejbserver)
    1 Managedserver (webserviceserver)
    My play_around_example is built around a database called names in a mysql-databas.
    To access data I got a package called nameshibernate.jar, that works fine used from an standalone application called namesjavaapplication.jar.
    (namesjavaapplication->nameshibernate->database)
    I also got an ejb in a packaged called namesejb.jar that uses the nameshibernate.jar. The namesejb.jar is deployed under "Ejb Modules" and the target is "ejbserver". If I call the ejb from my standalone application called namesjavaapplication.jar it works fine.
    (namesjavaapplication->namesejb->nameshibernate->database)
    I also got an webserviceapplication that uses axis2 in a aar-file called nameswebservice.aar. This application uses the namesejb.jar. The Axis2-server is deployed in the server under "Web Application Modules" and the target is "webserviceserver". In this Axis2-server the nameswebservice.aar is deployed. This i supposed to work like:
    (namesjavaapplication->nameswebservice->namesejb->nameshibernate->database)
    If I call the webservice from my standalone application called namesjavaapplication.jar I get a calsscast exception:
    java.lang.ClassCastException: Cannot narrow remote object to namesejb.client.NameManagerEJBHome
    I really can not find out the problem since it works fine if I go directly to the ejb like:
    (namesjavaapplication->namesejb->nameshibernate->database)
    Below is the method inside my standalone application that calls the ejb directly.
    This is the code that works:
    (namesjavaapplication->namesejb->nameshibernate->database)
         public void getNamesEJB() throws Exception
              try
                   System.out.println("getNamesEJB start");
                   Context context = getWebLogicInitialContext();
                   Object object = context.lookup("namesejb/client/NameManagerEJBHome");
                   System.out.println("\t1: " + object.getClass().getName());
                   Class c = Class.forName("namesejb.client.NameManagerEJBHome");
                   System.out.println("\t2: " + c.getName());
                   System.out.println("\t3: " + NameManagerEJBHome.class.getName());
                   System.out.println("\t4: " + (object instanceof NameManagerEJBHome));
                   System.out.println("\tjava.class.version: " + System.getProperty("java.class.version"));
                   System.out.println("\tjava.class.path: " + System.getProperty("java.class.path"));
                   System.out.println("\tjava.library.path: " + System.getProperty("java.library.path"));
                   System.out.println("\tjava.compiler: " + System.getProperty("java.compiler"));
                   System.out.println("\tjava.ext.dirs: " + System.getProperty("java.ext.dirs"));
                   System.out.println("\tuser.dir: " + System.getProperty("user.dir"));
                   System.out.println("\tjava.home: " + System.getProperty("java.home"));
                   if(object instanceof namesejb.server.NameManagerSessionBean)
                        System.out.println("\t"+ ((namesejb.server.NameManagerSessionBean)object).getSerialVersionUID() );
                   else
                        System.out.println("\tNOT instanceof NameManagerSessionBean");
                   NameManagerEJBHome nameManagerEJBHome = (NameManagerEJBHome)PortableRemoteObject.narrow(object, NameManagerEJBHome.class);
                   NameManangerEJBObject nameManangerEJBObject = nameManagerEJBHome.create();
         String nameString = "";
                   List names = nameManangerEJBObject.getNames();
         for (int i = 0; i < names.size(); i++)
         Name theName = (Name) names.get(i);
         nameString = nameString + "\n" + theName.getName();
         textAreaEJB.setText(nameString);
              catch(RemoteException e)
                   e.printStackTrace();
              catch(NamingException e)
                   e.printStackTrace();
              catch(Exception e)
                   e.printStackTrace();
    From this I get this output:
    getNamesEJB start
    1: namesejb.server.NameManagerSessionBean_o0oo54_HomeImpl_816_WLStub
    2: namesejb.client.NameManagerEJBHome
    3: namesejb.client.NameManagerEJBHome
    4: true
    java.class.version: 50.0
    java.class.path: namesjavaapplication.jar
    java.library.path: /home/fredrik/Applications/Java/Java_ee_sdk_5-04/jd k/jre/lib/i386/server:/home/fredrik/Applications/Java/Java_ee_sdk_5-04 /jdk/jre/lib/i386:/home/fredrik/Applications/Java/Java_ee_sdk_5-04/jdk /jre/../lib/i386:/usr/java/packages/lib/i386:/lib:/usr/lib
    java.compiler: null
    java.ext.dirs: /home/fredrik/Applications/Java/Java_ee_sdk_5-04/jdk/jr e/lib/ext:/usr/java/packages/lib/ext
    user.dir: /home/fredrik/eclipse_workspace/namesjavaapplication
    java.home: /home/fredrik/Applications/Java/Java_ee_sdk_5-04/jdk/jre
    NOT instanceof NameManagerSessionBean
    Below is my methods inside the ejb:
         public void ejbCreate()
              try
                   Class c = Class.forName("namesejb.client.NameManagerEJBHome");
                   System.out.println("1: " + c.getName());
                   System.out.println("2: " + NameManagerEJBHome.class.getName());
                   System.out.println("java.class.version: " + System.getProperty("java.class.version"));
                   System.out.println("java.class.path: " + System.getProperty("java.class.path"));
                   System.out.println("java.library.path: " + System.getProperty("java.library.path"));
                   System.out.println("java.compiler: " + System.getProperty("java.compiler"));
                   System.out.println("java.ext.dirs: " + System.getProperty("java.ext.dirs"));
                   System.out.println("user.dir: " + System.getProperty("user.dir"));
              catch(Exception e)
                   System.out.println(e.getMessage());
                   e.printStackTrace();
         public ArrayList getNames() throws Exception {
              Class c = Class.forName("namesejb.client.NameManagerEJBHome");
              System.out.println("4 " + c.getName());
              NameManager nameManager = new NameManager();
              return nameManager.getNames();
    From these methods I get this output from the ejbserver:
    1: namesejb.client.NameManagerEJBHome
    2: namesejb.client.NameManagerEJBHome
    java.class.version: 48.0
    java.class.path:/home/fredrik/Applications/bea/jrockit81sp6_142_10/lib/tools.jar:/home/fredrik/Applications/bea/weblogic81/server/lib/weblogic_sp.jar:/home/fredrik/Applications/bea/weblogic81/server/lib/weblogic.jar::/home/fredrik/Applications/bea/weblogic81/common/eval/pointbase/lib/pbserver44.jar:/home/fredrik/Applications/bea/weblogic81/common/eval/pointbase/lib/pbclient44.jar:/home/fredrik/Applications/bea/jrockit81sp6_142_10/jre/lib/rt.jar:/home/fredrik/Applications/bea/weblogic81/server/lib/webservices.jr:
    java.library.path:/home/fredrik/Applications/bea/jrockit81sp6_142_10/jre/lib/i386/jrockit:/home/fredrik/Applications/bea/jrockit81sp6_142_10/jre/lib/i386:/home/fredrik/Applications/bea/jrockit81sp6_142_10/jre/../lib/i386:/home/fredrik/Applications/bea/weblogic81/server/lib/linux/i686:/home/fredrik/Applications/bea/weblogic81/server/lib/linux/i686/oci920_8
    java.compiler: null
    java.ext.dirs: /home/fredrik/Applications/bea/jrockit81sp6_142_10/jre/lib/ext
    user.dir: /home/fredrik/Applications/bea/user_projects/domains/mydomain
    4 namesejb.client.NameManagerEJBHome
    THIS WORKS FINE
    Below is the method inside my webservice that calls the ejb directly.
    This is the code that throws the Exception:
    (namesjavaapplication->nameswebservice->namesejb->nameshibernate->database)
         public String getNamesWSEJB() throws Exception
              String errorMessage = "Error: ";
              try
                   System.out.println("getNamesWSEJB start");
                   Context context = getWebLogicInitialContext();
                   Object object = context.lookup("namesejb/client/NameManagerEJBHome");
                   System.out.println("\t1: " + object.getClass().getName());
                   Class c = Class.forName("namesejb.client.NameManagerEJBHome");
                   System.out.println("\t2: " + c.getName());
                   System.out.println("\t3: " + NameManagerEJBHome.class.getName());
                   System.out.println("\t4: " + (object instanceof NameManagerEJBHome));
                   System.out.println("\tjava.class.version: " + System.getProperty("java.class.version"));
                   System.out.println("\tjava.class.path: " + System.getProperty("java.class.path"));
                   System.out.println("\tjava.library.path: " + System.getProperty("java.library.path"));
                   System.out.println("\tjava.compiler: " + System.getProperty("java.compiler"));
                   System.out.println("\tjava.ext.dirs: " + System.getProperty("java.ext.dirs"));
                   System.out.println("\tuser.dir: " + System.getProperty("user.dir"));
                   System.out.println("java.home: " + System.getProperty("java.home"));
                   if(object instanceof namesejb.server.NameManagerSessionBean)
                        System.out.println("\t"+ ((namesejb.server.NameManagerSessionBean)object).getSerialVersionUID() );
                   else
                        System.out.println("\tNOT instanceof NameManagerSessionBean");
                   NameManagerEJBHome nameManagerEJBHome = (NameManagerEJBHome)PortableRemoteObject.narrow(object, NameManagerEJBHome.class);
                   NameManangerEJBObject nameManangerEJBObject = nameManagerEJBHome.create();
         String nameString = "";
                   List names = nameManangerEJBObject.getNames();
                   for (int i = 0; i < names.size(); i++)
                        Name theName = (Name) names.get(i);
                        nameString = nameString + "\n" + theName.getName();
                   return nameString;
              catch(RemoteException e)
                   errorMessage = errorMessage + e.getMessage();
                   e.printStackTrace();
              catch(NamingException e)
                   errorMessage = errorMessage + e.getMessage();
                   e.printStackTrace();
              catch(Exception e)
                   errorMessage = errorMessage + e.getMessage();
                   e.printStackTrace();
              return errorMessage;
    1: namesejb.server.NameManagerSessionBean_o0oo54_HomeImpl_816_WLStub
    2: namesejb.client.NameManagerEJBHome
    3: namesejb.client.NameManagerEJBHome
    4: false
    java.class.version: 48.0
    java.class.path:/home/fredrik/Applications/axis2-1.3/lib/jalopy-1.5rc3.jar:/home/fredrik/Applications/bea/jrockit81sp6_142_10/lib/tools.jar:/home/fredrik/Applications/bea/weblogic81/server/lib/weblogic_sp.jar:/home/fredrik/Applications/bea/weblogic81/server/lib/weblogic.jar::/home/fredrik/Applications/bea/weblogic81/common/eval/pointbase/lib/pbserver44.jar:/home/fredrik/Applications/bea/weblogic81/common/eval/pointbase/lib/pbclient44.jar:/home/fredrik/Applications/bea/jrockit81sp6_142_10/jre/lib/rt.jar:/home/fredrik/Applications/bea/weblogic81/server/lib/webservices.jar:
    java.library.path: /home/fredrik/Applications/bea/jrockit81sp6_142_10/jre/lib/i386/jrockit:/home/fredrik/Applications/bea/jrockit81sp6_142_10/jre/lib/i386:/home/fredrik/Applications/bea/jrockit81sp6_142_10/jre/../lib/i386:/home/fredrik/Applications/bea/weblogic81/server/lib/linux/i686:/home/fredrik/Applications/bea/weblogic81/server/lib/linux/i686/oci920_8
    java.compiler: null
    java.ext.dirs: /home/fredrik/Applications/bea/jrockit81sp6_142_10/jre/lib/ext
    user.dir: /home/fredrik/Applications/bea/user_projects/domains/mydomain
         NOT instanceof NameManagerSessionBean
    java.lang.ClassCastException: Cannot narrow remote object to namesejb.client.NameManagerEJBHome
    at weblogic.iiop.PortableRemoteObjectDelegateImpl.narrow(PortableRemoteObjectDelegateImpl.java:242)
    at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:134)
    at nameswebservices.NamesWebService.getNamesWSEJB(NamesWebService.java:49)
    at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown Source)
            at java.lang.reflect.Method.invoke(Ljava.lang.Object;[Ljava.lang.Object;I)Ljava.lang.Object;(Unknown Source)
            at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:165)
            at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:98)
            at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
            at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:96)
            at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:145)
            at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)
            at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:120)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
            at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1077)
            at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:465)
            at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:348)
            at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:7047)
            at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
            at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
            at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3902)
            at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2773)
            at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
            at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)
    I really can not find out what might be the problem since it works to call tje ejb from a standalone application.
    The "same" code executed from a webservice throws the exception.
    One strange thing that I notice is that from the standalone the java.class.version gets 50.0 and from the webserver it gets 48.0 But the standalone uses 1.6 when I run it and the Weblogic uses 1.4. (I do not think that weblogic can run with 1.6)
    Pretty long thread but I hope for some mercy!
    Best regards
    Fredrik                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Hello Thok, this code is from a quistion in a studybook for preparation of the SCJP 5.0 exam.
    When i compile i get this warning:
    Shapes.java:13: warning: [unchecked] unchecked cast
    found   : java.util.ArrayList
    required: java.util.ArrayList<generics.Rectangle>
            ArrayList <Rectangle> c = (ArrayList<Rectangle>) b;
                                                             ^
    1 warningWhen running this line causes an exception:
                for ( Rectangle o : c){My questions are
    How do i re-write the code so that i will get an warning and exception free program?
    Tnx Auke

  • ClassCastException when I access an EJB from a remote EJB in WL 8.1

    I am using WebLogic 8.1 and am trying to lookup the home interface for an EJB (_ejbRemote_)
    from another EJB (_ejbCurrent_). They are deployed in seperate EARs. When I bundle
    the home and remote interfaces for ejbRemote in the EAR file that ejbCurrent
    is deployed in, everything works fine. But I need to be able to configure ejbRemote
    at run time and my customers don't want to have to bundle their classes in my
    EAR. So I invoke a custom classloader (of type java.net.URLClassLoader) that will
    load the home and remote interface classes for ejbRemote from a configurable
    location at runtime. This finds the classes no problem, and the InitialContext.lookup()
    returns a stub, but I get a 'java.lang.ClassCastException: Cannot narrow remote
    object' error when I call PortableRemoteObject.narrow(home, homeClass);
    The code looks like:
    // Assume EJBHomeStr = "com.foo.TestHome" in this case
    // Load the home interface class. This works.
    Class homeClass = urlClassLoader.loadClass(EJBHomeStr);
    // Lookup the home interface. This works.
    Object lookedUpHomeObject = initialContext.lookup(JNDIName);
    // This fails.
    Object homeObject = PortableRemoteObject.narrow(lookedUpHomeObject, homeClass);
    And the weblogic error looks like
    ... ; nested exception is:
    java.lang.ClassCastException: Cannot narrow remote object to com.foo.TestHome
    at weblogic.iiop.PortableRemoteObjectDelegateImpl.narrow(PortableRemoteO
    bjectDelegateImpl.java:219)
    at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:134)
    at ...[the rest is just my application code stack...]
    When I log the ClassLoaders for the affected objects, using getClass().getClassLoader(),
    I get:
    <snippet from log follows>
    getClass().getClassLoader(): weblogic.utils.classloaders.GenericClassLoader@667da1
    finder:
    weblogic.utils.classloaders.MultiClassFinder@db9199 annotation: myEJBApp@
    homeClass.getName(): com.foo.TestHome classloader = java.net.URLClassLoader@4f1707
    lookedUpHomeObject.getClass().getName(): com.foo.Test_EJB_kx82zy_HomeImpl_810_WLStub
    classloader = weblogic.utils.classloaders.GenericClassLoader@667da1
    finder: weblogic.utils.classloaders.MultiClassFinder@db9199 annotation: myEJBApp@
    <end snippet from log>
    So it appears that since the looked up Stub was loaded by the WebLogic classloader
    and the actual Home class was loaded by my URLClassLoader, the narrow() can't
    reconcile the two. I have tried both rmic and the Weblogic appc command to pre-generate
    the stubs, which I put in the same JAR as my home and remote interface classes
    and load with my custom classloader. But the standard stub (generated by either
    rmic or appc) is named TestHomeStub.class and Weblogic is ignoring those and
    making a class with the name Test_EJB_kx82zy_HomeImpl_810_WLStub, as shown above.
    I have also tried to put the remote interface classes and stubs in the System
    classpath using the -classpath option when I start WebLogic, but same result.
    The question is, Is there a way in WebLogic to communicate with a remote EJB in
    a seperate EAR without bundling anything about that remote EAR in my EAR? Or is
    there something I've missed? I need to keep my application J2EE compliant, meaning
    I can't hardcode any AppServer-specific code in my application.
    Thanks.

    Hi Jon,
    Glad to hear that.
    Regards,
    Slava Imeshev
    "Jon Sutula" <[email protected]> wrote in message news:[email protected]...
    >
    I fixed the problem. It turns out I didn't need to use a custom classloader at
    all, I just use Reflection directly on the classes ruturned from my JNDI lookup.
    So when I lookup the home class, I don't need to narrow or cast it, I just use
    Reflection to invoke the "create" method. Then I use the object that I get from
    create and directly invoke whatever method on it I need, again using Reflection.
    And that works.
    "Slava Imeshev" <[email protected]> wrote:
    Hi Jon,
    The problem is, this class is not available for the classloader
    running your "main code".
    You can try to hack the into the thread context class loader:
    Thread thread = Thread.currentThread();
    ContextClassLoader originalClassLoader = thread.getContextClassLoader();
    try {
    YourURLClassloader yourClassLoader = new
    YourURLClassloader(originalClassLoader);
    thread.setContextClassLoader(yourClassLoader );
    // your code goes here
    } finally {
    // Don't forget to restore it !!!
    thread.setContextClassLoader(originalClassLoader);
    Be very cautious. If you fail to restore the original context class loader,
    you will likely have to restart the server.
    Hope this helps.
    Regards,
    Slava Imeshev
    "Jon Sutula" <[email protected]> wrote in message news:[email protected]...
    I am using WebLogic 8.1 and am trying to lookup the home interfacefor an EJB (_ejbRemote_)
    from another EJB (_ejbCurrent_). They are deployed in seperate EARs.When I bundle
    the home and remote interfaces for ejbRemote in the EAR file that
    ejbCurrent
    is deployed in, everything works fine. But I need to be able to configure
    ejbRemote
    at run time and my customers don't want to have to bundle their classesin my
    EAR. So I invoke a custom classloader (of type java.net.URLClassLoader)that will
    load the home and remote interface classes for ejbRemote from a configurable
    location at runtime. This finds the classes no problem, and the InitialContext.lookup()
    returns a stub, but I get a 'java.lang.ClassCastException: Cannot narrowremote
    object' error when I call PortableRemoteObject.narrow(home, homeClass);
    The code looks like:
    // Assume EJBHomeStr = "com.foo.TestHome" in this case
    // Load the home interface class. This works.
    Class homeClass = urlClassLoader.loadClass(EJBHomeStr);
    // Lookup the home interface. This works.
    Object lookedUpHomeObject = initialContext.lookup(JNDIName);
    // This fails.
    Object homeObject = PortableRemoteObject.narrow(lookedUpHomeObject,homeClass);
    And the weblogic error looks like
    ... ; nested exception is:
    java.lang.ClassCastException: Cannot narrow remote object tocom.foo.TestHome
    at weblogic.iiop.PortableRemoteObjectDelegateImpl.narrow(PortableRemoteO
    bjectDelegateImpl.java:219)
    at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:134)
    at ...[the rest is just my application code stack...]
    When I log the ClassLoaders for the affected objects, using getClass().getClassLoader(),
    I get:
    <snippet from log follows>
    getClass().getClassLoader(): weblogic.utils.classloaders.GenericClassLoader@667da1
    finder:
    weblogic.utils.classloaders.MultiClassFinder@db9199 annotation: myEJBApp@
    homeClass.getName(): com.foo.TestHome classloader = java.net.URLClassLoader@4f1707
    lookedUpHomeObject.getClass().getName(): com.foo.Test_EJB_kx82zy_HomeImpl_810_WLStub
    classloader = weblogic.utils.classloaders.GenericClassLoader@667da1
    finder: weblogic.utils.classloaders.MultiClassFinder@db9199 annotation:myEJBApp@
    <end snippet from log>
    So it appears that since the looked up Stub was loaded by the WebLogicclassloader
    and the actual Home class was loaded by my URLClassLoader, the narrow()can't
    reconcile the two. I have tried both rmic and the Weblogic appc commandto pre-generate
    the stubs, which I put in the same JAR as my home and remote interfaceclasses
    and load with my custom classloader. But the standard stub (generatedby either
    rmic or appc) is named TestHomeStub.class and Weblogic is ignoringthose and
    making a class with the name Test_EJB_kx82zy_HomeImpl_810_WLStub, asshown above.
    I have also tried to put the remote interface classes and stubs inthe System
    classpath using the -classpath option when I start WebLogic, but sameresult.
    The question is, Is there a way in WebLogic to communicate with a remoteEJB in
    a seperate EAR without bundling anything about that remote EAR in myEAR? Or is
    there something I've missed? I need to keep my application J2EE compliant,meaning
    I can't hardcode any AppServer-specific code in my application.
    Thanks.

  • ClassCastException when castin to a SessionEJBHome after successful lookup

    Situation
    Two EARs, say X.ear and Y.ear. Both of them deployed in the same OC4J instance (NOT STANDALONE); OAS 10.1.2
    X.ear has a JAR (say XA.jar) which looksup and uses the Stateless Session bean in Y.ear. We have a yClient.jar that contains all the necessary classes for use by X.ear, so XA.jar. This yClient.jar is available in X.ear.
    In one of the classes in XA.jar, when I lookup the EJB, I am succesful in getting the Home class. If I try to narrow down to the specific Home class instead of EJBHome.class, then I get the ClassCastException at that moment. If I cast it to EJBHome.class and postpone casting until after creation of the real remote bean, then I get the ClassCastException here.
    I have included the code also.
    Possible doubts that I am having:
    1)
    I am doubting like OAS is doing something that I am not aware of. Like the remote object it sends back and when I am casting it to the class of the object it throws ClassCastException.
    Y.ear does not contain any info like a Jar in X.ear is going to lookup this bean or so.
    Do I need to mention anything in Y.ear.
    2)
    Is there any possiblility that the same class in X.ear and Y.ear are compiled with different JDK or timing
    3) Or is the OAS Stub creation or persistence or passivation is messing up in this.
    I am kind of stuck in here. Thanks for your help
    If you notice the following exception, I have printed the SessionBean narrowed down class. It is a wrapper class from OC4J I believe.
    [u]SessionControllerSLHome_StatelessSessionHomeWrapper61
    This is what is in the orion-ejb-jar.xml
    <session-deployment name="SessionControllerSL" max-tx-retries="0" location="com/dsc/uniarch/cr/ejb/SessionControllerSL" wrapper="SessionControllerSLHome_StatelessSessionHomeWrapper61" persistence-filename="com/dsc/uniarch/cr/ejb/SessionControllerSL.home_default_island_1" />
    It seems like the looked up object when I cast it to the corresponding class, it is giving ClassCastException
    Exception
    06/10/27 11:40:13 Tutalii: /home/oracle/OracleAS/j2ee/home/applications/mlo/mloWeb/WEB-INF/classes
    06/10/27 11:40:29 Oracle Application Server Containers for J2EE 10g (10.1.2.0.0) initialized
    06/10/27 11:41:03 EL xPressionConnection Begin start session...
    06/10/27 11:41:03 EL xPressionResponseConnection - getInitialContext ()
    06/10/27 11:41:03 EL xPressionConnection PROVIDER_URL =ormi://localhost:3201/xPression
    06/10/27 11:41:03 EL xPressionConnection INITIAL_CONTEXT_FACTORY =com.evermind.server.rmi.RMIInitialContextFactory
    06/10/27 11:41:03 EL xPressionConnection SECURITY_PRINCIPAL =xpression
    06/10/27 11:41:03 EL xPressionConnection SECURITY_CREDENTIALS =xpression
    06/10/27 11:41:03 2011: After successful JNDI lookup for SessionControllerSL on the Initial Context: [SessionControllerSLHome_StatelessSessionHomeWrapper61]
    06/10/27 11:41:03 2012: After narrowing down the homeObject to EJB Home Object: SessionControllerSLHome_StatelessSessionHomeWrapper61
    06/10/27 11:41:03 2013: Used reflection to invoke the Create method on EJBHome Object: SessionControllerSL_StatelessSessionBeanWrapper60
    06/10/27 11:41:03 java.lang.ClassCastException
    06/10/27 11:41:03 at com.dsc.uniarch.ejbController.xPressionConnection.lookupTargetHome1(xPressionConnection.java:152)
    06/10/27 11:41:03 at com.dsc.uniarch.ejbController.xPressionConnection.Start(xPressionConnection.java:250)
    06/10/27 11:41:03 at com.dsc.uniarch.ecor.bean.xResponseFrameWork.startSession(xResponseFrameWork.java:5381)
    06/10/27 11:41:03 at com.dsc.uniarch.ecor.bean.xResponseFrameWork.processRequest(xResponseFrameWork.java:154)
    06/10/27 11:41:03 at html.index._jspService(_index.java:69)
    06/10/27 11:41:03 at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
    06/10/27 11:41:03 at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:347)
    06/10/27 11:41:03 at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:509)
    06/10/27 11:41:03 at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:413)
    06/10/27 11:41:03 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    06/10/27 11:41:03 at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:810)
    06/10/27 11:41:03 at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:322)
    06/10/27 11:41:03 at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
    06/10/27 11:41:03 at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:208)
    06/10/27 11:41:03 at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:125)
    06/10/27 11:41:03 at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
    06/10/27 11:41:03 at java.lang.Thread.run(Thread.java:534)
    Code that is used
    try {
    //Third EJB Lookup: CRContentSF
    if (initContext == null)
    getInitialContext();
    homeObject = initContext.lookup("com/dsc/uniarch/cr/ejb/SessionControllerSL");
    System.out.println("2011: After successful JNDI lookup for SessionControllerSL on the Initial Context: ["
    + homeObject.getClass().getName() + "]");
    obHome = (EJBHome) javax.rmi.PortableRemoteObject.narrow(homeObject,
    EJBHome.class);
    System.out.println("2012: After narrowing down the homeObject to EJB Home Object: " + obHome.getClass().getName());
    m = obHome.getClass().getDeclaredMethod("create", new Class[0]);
    obj = m.invoke(obHome, new Object[0]);
    System.out.println("2013: Used reflection to invoke the Create method on EJBHome Object: " + obj.getClass().getName());
    sessionControllerSL = (com.dsc.uniarch.cr.ejb.SessionControllerSL) obj;
    System.out.println("2014: getClass " + sessionControllerSL.getClass().getName());
    System.out.println("3014: getClass " + SessionControllerSL.getClass().getName());
    } catch (Exception e) {
    e.printStackTrace();
    Thanks

    I redeployed the target j2ee application, it does not seem to help. However, after redeploying, I had to stop/start the OC4J instance couple of times. I dont think it matters. Or I dont know if you guys meant this only when you say 'server bounce'.
    What is this SessionBeanWrapper anyways? If it is a EJB-Remote-Stub, then it should be able to cast into its original interface. I dont know what else to do at this point. I will keep working on this.
    EXCEPTION
    06/10/30 13:40:14 EL xPressionConnection Begin start session...
    06/10/30 13:40:14 EL xPressionResponseConnection - getInitialContext ()
    06/10/30 13:40:14 EL xPressionConnection PROVIDER_URL =ormi://localhost:3201/xPression
    06/10/30 13:40:14 EL xPressionConnection INITIAL_CONTEXT_FACTORY =com.evermind.server.rmi.RMIInitialContextFactory
    06/10/30 13:40:14 EL xPressionConnection SECURITY_PRINCIPAL =user
    06/10/30 13:40:14 EL xPressionConnection SECURITY_CREDENTIALS =password
    06/10/30 13:40:14 EL xPressionConnection lookup beanName :com/dsc/uniarch/cr/ejb/SessionControllerSL
    06/10/30 13:40:14 EL xPressionConnection tmpObject : SessionControllerSLHome_StatelessSessionHomeWrapper61
    06/10/30 13:40:14 EL objHome name : SessionControllerSLHome_StatelessSessionHomeWrapper61
    06/10/30 13:40:14 EL xPressionConnection start typecast exception
    06/10/30 13:40:14 java.lang.ClassCastException
    06/10/30 13:40:14 at com.dsc.uniarch.ejbController.xPressionConnection.Start(xPressionConnection.java:235)
    06/10/30 13:40:14 at com.dsc.uniarch.ecor.bean.xResponseFrameWork.startSession(xResponseFrameWork.java:5381)
    06/10/30 13:40:14 at com.dsc.uniarch.ecor.bean.xResponseFrameWork.processRequest(xResponseFrameWork.java:154)
    06/10/30 13:40:14 at html.index._jspService(_index.java:69)
    CODE BEGIN
    System.out.println ("EL xPressionConnection Begin start session...");
    LogManager.logInfo("Begin start session...");
    setServerURL(serverURL);
    initInitContext();
    SessionControllerSLHome scHome = null;
    try {
    scHome = (SessionControllerSLHome)
    lookupTargetHome(ConfigManager.getInstance().getValue("SESSIONCONTROLLER_JNDI"));
    System.out.println ("EL xPressionConnection - scHome className : " + scHome.getClass().getName());
    catch (Exception exc) {
    System.out.println ("EL xPressionConnection start typecast exception ");
    exc.printStackTrace ();
    try{
    //sessionControllerSL = lookupTargetHome1();
    sessionControllerSL = scHome.create();
    } catch (Exception e) {
    System.out.println ("EL xPressionConnection scHome.create Exception ");
    e.printStackTrace();
    String[] param = new String[1];
    param[0] = ConfigManager.getInstance().getValue("SESSIONCONTROLLER_JNDI");
    throw new JNDINamingException(9110, e, param);
    CODE END
    Thanks

  • ClassCastException while narrow an EJV using RMI-IIOP

    Hi,
    I'm trying to deploy an EJB on weblogic 6.1 SP4 on an AIX system, and a client
    (JSP) running on weblogic 6.1 SP4 on a SUN system. And, the dialog between EJB
    and servlet has to use RMI-IIOP (due to exploitation constraints).
    I receive this exception when getting the reference of the EJB's home :
    java.lang.ClassCastException: Cannot narrow remote object to ejbMweb.TstEjbMwebHome
    at weblogic.iiop.PortableRemoteObjectDelegateImpl.narrow(PortableRemoteObjectDelegateImpl.java:124)
    at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:132)
    at cliEjbMweb.cliTstMweb.narrow(cliTstMweb.java:133)
    at cliEjbMweb.cliTstMweb.getHome(cliTstMweb.java:31)
    at cliEjbMweb.cliTstMweb.testBean1(cliTstMweb.java:53)
    at jsp_servlet.__index._jspService(__index.java:91)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:262)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:321)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:198)
    at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2637)
    at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2359)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    The same test using t3 is running OK (there is no problem of classpath).
    Can you hel me ?
    Thank you !
    Marc

    "Marc" <[email protected]> writes:
    It can't download the stub, you need to set an appropriate security
    manager for the RMIClassLoader to work, or make sure the stubs are on
    the client.
    andy
    Hi,
    I'm trying to deploy an EJB on weblogic 6.1 SP4 on an AIX system, and a client
    (JSP) running on weblogic 6.1 SP4 on a SUN system. And, the dialog between EJB
    and servlet has to use RMI-IIOP (due to exploitation constraints).
    I receive this exception when getting the reference of the EJB's home :
    java.lang.ClassCastException: Cannot narrow remote object to ejbMweb.TstEjbMwebHome
    at weblogic.iiop.PortableRemoteObjectDelegateImpl.narrow(PortableRemoteObjectDelegateImpl.java:124)
    at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:132)
    at cliEjbMweb.cliTstMweb.narrow(cliTstMweb.java:133)
    at cliEjbMweb.cliTstMweb.getHome(cliTstMweb.java:31)
    at cliEjbMweb.cliTstMweb.testBean1(cliTstMweb.java:53)
    at jsp_servlet.__index._jspService(__index.java:91)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:262)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:321)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:198)
    at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2637)
    at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2359)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    The same test using t3 is running OK (there is no problem of classpath).
    Can you hel me ?
    Thank you !
    Marc

  • ClassCastException when creating a queue subscriber

    Hi all,
    I wrote a simple example class to create a queue consumer but I'm getting a CCE when subscribing. The code is below. Is there some additional setup I'm missing?
    MessagingSession ms = DefaultMessagingSession.getInstance();
    Identifier queue = ms.createQueue("toDoList");
    Subscriber subscriber = ms.subscribe(queue);
    The output is below:
    2009-06-16 11:10:04.126 Oracle Coherence 3.3.1/389p6 <Info> (thread=Main Thread, member=n/a): Loaded operational configuration from resource "jar:file:/C:/projects/.maven/repository/tangosol/jars/coherence-3.3.1.jar!/tangosol-coherence.xml"
    2009-06-16 11:10:04.142 Oracle Coherence 3.3.1/389p6 <Info> (thread=Main Thread, member=n/a): Loaded operational overrides from resource "jar:file:/C:/projects/.maven/repository/tangosol/jars/coherence-3.3.1.jar!/tangosol-coherence-override-dev.xml"
    2009-06-16 11:10:04.173 Oracle Coherence 3.3.1/389p6 <Info> (thread=Main Thread, member=n/a): Loaded operational overrides from resource "file:/C:/Documents%20and%20Settings/john.e.gregg/IdeaProjects/john/classes/tangosol-coherence-override.xml"
    Oracle Coherence Version 3.3.1/389p6
    Grid Edition: Development mode
    Copyright (c) 2000-2007 Oracle. All rights reserved.
    2009-06-16 11:10:04.658 Oracle Coherence GE 3.3.1/389p6 <Info> (thread=Main Thread, member=n/a): Loaded cache configuration from resource "file:/C:/Documents%20and%20Settings/john.e.gregg/IdeaProjects/john/classes/coherence-cache-config.xml"
    2009-06-16 11:10:05.845 Oracle Coherence GE 3.3.1/389p6 <D5> (thread=Cluster, member=n/a): Service Cluster joined the cluster with senior service member n/a
    2009-06-16 11:10:09.125 Oracle Coherence GE 3.3.1/389p6 <Info> (thread=Cluster, member=n/a): Created a new cluster with Member(Id=1, Timestamp=2009-06-16 11:10:05.486, Address=10.89.178.91:8089, MachineId=57691, Location=process:6640@PCSHPQL0063002, Edition=Grid Edition, Mode=Development, CpuCount=2, SocketCount=1) UID=0x0A59B25B00000121E9D5192EE15B1F99
    2009-06-16 11:10:09.422 Oracle Coherence GE 3.3.1/389p6 <D5> (thread=ReplicatedCache, member=1): Service ReplicatedCache joined the cluster with senior service member 1
    storing o = Identifier{toDoList}
    Exception in thread "Main Thread" java.lang.ClassCastException: com.tangosol.coherence.component.util.safeService.SafeCacheService
         at com.oracle.coherence.patterns.command.DefaultCommandSubmitter.submitCommand(DefaultCommandSubmitter.java:94)
         at com.oracle.coherence.patterns.command.DefaultCommandSubmitter.submitCommand(DefaultCommandSubmitter.java:147)
         at com.oracle.coherence.patterns.messaging.DefaultMessagingSession.subscribe(DefaultMessagingSession.java:148)
         at com.oracle.coherence.patterns.messaging.DefaultMessagingSession.subscribe(DefaultMessagingSession.java:200)
         at tangosol.messaging.Consumer.main(Consumer.java:27)
         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.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
    2009-06-16 11:10:09.641 Oracle Coherence GE 3.3.1/389p6 <D4> (thread=ShutdownHook, member=1): ShutdownHook: stopping cluster node
    The override file ion my classes dir is actually empty. The "storing 0 = ..." is not from my code.
    I'm using Coherence 3.3.1, command 2.3, common 1.3, and messaging 2.3.
    thanks
    john

    I think I've got it. It was a matter of putting
    <introduce-cache-config file="coherence-commandpattern-cache-config.xml"/>
    <introduce-cache-config file="coherence-messagingpattern-cache-config.xml"/>
    in my cache config.
    thanks

  • ClassCastException When we use JSP with Normal Bean in WebLogic 5.1

              Hai Everybody...
              We have an application where JSP files are using the Normal Java beans(Nothing
              but a Java Class).Here all jave beans are in a folder ..\myserver\classfiles\
              and the jsp files are in ..\myserver\public_html\..... .
              This combination is throwing a ClassCastException when the JSP try to Intantiate
              the bean....It doesn't give error alway..Initially it works fine and all of a
              sudden it throws this error..
              Plse..If anybody can help us Do So....
              sijo
              

    That is correct; WLS 5.1 does not support the updating of these helper classes.
              In WLS 6.0, you can package everything up as a web application or enterprise
              application and redeploy the whole thing (including the helper classes)...
              Alex wrote:
              > But, Robert, that means the JavaBean classes cannot be updated without
              > restarting the server.
              >
              > I tried putting them in the servlet directory. With the result that they
              > often work, but sometimes I get the same ClassCastException as sijo. Where
              > should JavaBean classes that are used from JSP (and maybe other servlets) be
              > put in order to be able to update them?
              >
              > "Robert Patrick" <[email protected]> escribió en el mensaje
              > news:[email protected]...
              > > The Java Beans being used by the JSP pages need to be placed into the
              > > WEBLOGICCLASSPATH (i.e., -Dweblogic.class.path=...) and not in the working
              > directory
              > > where the JSP-generated classes are created (i.e., \myserver\classfiles is
              > typically
              > > the working directory for the JSPServlet and \myserver\serverclasses is
              > the
              > > appropriate place for the Java Beans used by the JSPs)...
              > >
              > > sijo wrote:
              > >
              > > > Hai Everybody...
              > > >
              > > > We have an application where JSP files are using the Normal Java
              > beans(Nothing
              > > > but a Java Class).Here all jave beans are in a folder
              > ..\myserver\classfiles\
              > > > and the jsp files are in ..\myserver\public_html\..... .
              > > >
              > > > This combination is throwing a ClassCastException when the JSP try to
              > Intantiate
              > > > the bean....It doesn't give error alway..Initially it works fine and all
              > of a
              > > > sudden it throws this error..
              > > >
              > > > Plse..If anybody can help us Do So....
              > > >
              > > > sijo
              > > >
              > > >
              > >
              

  • ClassCastexception when casting a Class that extends HttpServletRequestWrap

    I have inherited some code that runs OK in JDK 1.4.2 in a JSP, but give s an exception when the JSP runs unfer 1.5.0. My Class is a as follows:
    public class WrappedRequest extends HttpServletRequestWrapper {
         public WrappedRequest(HttpServletRequest req) {
              super(req);     
         /** Return value string of requested parameter.
         * <ul>
         * <li> If htmlEncode == NO_HTML_ENCODE, return the native request param, un-html encoded
         * <li> If htmlEncode == HTML_ENCODE, return an html encoded copy of the requested parameter
         * <li> If htmlEncode is neither, return the html encoded copy of the requested parameter     
         * </ul>
         * @param     name               name of the request parameter
         * @param     htmlEncode          whether html encoded/un-encoded parameter value should be returned.
         * @return     String of the requested parameter value. If parameter name is null, return null
         public String getParameter(String name, int htmlEncode) {
              if(name != null && (htmlEncode == NO_HTML_ENCODE)) {
                   String str = super.getParameter(name);
                   return str;
              else
                   return getParameter(name);     
         public String getParameter(String name) {
              String str = super.getParameter(name);
              if(str != null)
                   str = Utils.htmlEncode(str); //Another package class
              return str;               
    This class in normally invoked as follows:
         String changeApproval = ((WrappedRequest)request).getParameter("CrApp" , WrappedRequest.NO_HTML_ENCODE);
    I get a ClassCastException exception on this line. Any suggestions?
    Regards,

    Stuart_Millington wrote:
    Further to my original post I have another question. Please bear in mind that I am fairly new to Java and this is code that I have inherited. In the following line of code (which is the line that causes the exception:
    String changeApproval = ((WrappedRequest)request).getParameter("CrApp" , WrappedRequest.NO_HTML_ENCODE);
    Why is the request being cast? The following code SEEMS to run OK:
    WrappedRequest wr = new WrappedRequest(request);
    String CrApproval = wr.getParameter("CrApp" , WrappedRequest.NO_HTML_ENCODE);
    Any ideas?
    Regards,
    Stuart MillingtonOkay, then I understand your problem.
    You can only cast request to WrappedRequest when request IS A WrappedRequest - ie the statement request = new WrappedRequest(request) was called. You are apparently trying to convert a default implementation of HttpServletRequest into a WrappedRequest without first 'Wrapping' the request.
    What does Wrapping a Request mean and do? A request object is generated by the servlet container and it isn't easy to switch in your own implementation. So instead you make a WrappedRequest which takes the original instance of the HttpServletRequest generated from by the container and adds functionality to it. A WrappedRequest would have to extend an HttpServletRequest, and implement all the public API of said parent class. Most of the time the methods would look something like this:
    public String getParameter(String key) { return this.parentRequest.getParameter(key); } That is, it simply delegates most of the work to the HttpServletRequest it is wrapping. But some functions it may want to change behavior for and for those you insert your implementation.
    What you need to do:
    1) Learn how to use Java before you touch Servlets and server side stuff. You are adding too much complication by going straight to the end game. Use a book and the tutorials to get you through.
    2) Take the time to run the JavaEE tutorial.
    3) Start with your own code. Taking code snippets you see around the net and trying to get them to work is tough when you don't understand the concepts. For example, using a WrappedRequest is normally fairly useless if it isn't implemented using a Filter, and they work the best when they don't require a change to the request interface (i.e. when you never actually have to do a cast). Since you don't know Filters, and don't yet understand how the wrapper works I would suggest not using them.
    This is probably a mis-use of the RequestWrapper idea anyway (since, like I said, it requires a change in interface). What you would be better off doing is simply choosing to pass the parameter through a utility function that does the encoding for you. Example like:
    String changeApproval = HTMLEncoder.encode(request.getParameter("CrApp");when you want the parameter encoded and
    String changeApproval = request.getParameter("CrApp");when you don't.
    If you don't want to make your own utility for this purpose (and why would you) you can download a library that does it for you. One example is the [org.apache.commons.lang.StringEscapeUtils#escapeXML|http://commons.apache.org/lang/apidocs/org/apache/commons/lang/StringEscapeUtils.html#escapeXml(java.lang.String)] class#method from the Apache Foundation. The StringEscapeUtils is part of the Apache Commons Lang project, which you can reach [At the Commons/lang website.|http://commons.apache.org/lang/]

  • Why do I get "Publish Failed" when I select F4V with fixed frame rate?

    I have created several projects from scratch in Captivate 5. My publishing functionality seems to be increasingly impaired. I have rebooted and uninstalled + reinstalled Captivate 5.
    In the beginning I got this message when I was publishing a specific project with the media option F4V with fixed frame rate, but now I am getting it on all my projects regardless of my publishing selections.
    I am running on Windows 7, and I think it is Windows that is suggesting that I 'debug' the program. Clicking 'Debug' takes me to a dialog box where I can choose between Visual Studio 2005 or Visual Studio 2008, none of which seem to be a good solution.
    Here is a print of my publishing options:

    Chinmay Baid,
    Thank you for your reply - over the past few days I have been able to
    narrow the problem down a little more.
    When working with Captivate 5, I am able to work with and open any
    published file until I turn that file into a Zip file.  Upon unZipping,
    the file becomes unusable by my computer and by my LMS (Cornerstone).
    I am using Adobe Flash Professional CS5 and I am able to run any SWF file
    on my machine if the file has never been zipped.  I am using Captivate 5
    in administrator mode.  Somehow, the zip process is making the files
    unusable, and my LMS requires that files be zipped before they can be
    uploaded.
    Thank you for any advice or help you may be able to offer.
    Daniel Spray
    Instructional Design Specialist
    United Spermarkets, LLC
    806.791.6329
    From:   Chinmay Baid <[email protected]>
    To:     Daniel Spray <[email protected]>
    Date:   03/03/2011 05:09 AM
    Subject:        Why do I get "Publish
    Failed" when I select F4V with fixed frame rate?
    Hi,
    Can you please give the following details :
    Can you please check and tell the Flash player version
    (plugin,activex,standalone) installed on your machine?
    Also, are you able to play the standalone SWF on your machine?
    Did you launch Adobe Captivate 5 in administrator mode?
    Above information might be helpful for further investigation.
    Regards
    Chinmay Baid
    http://blogs.adobe.com/captivate

  • Why getting WebLogic Connection when using Oracle Driver?

    Does anyone know why I would be getting back an instance of weblogic.jdbc.rmi.SerialConnection
    when retrieving a connection out of the connection pool, via my JDBC TX DataSource,
    when my JDBC Connection pool is configured to use oracle.jdbc.OracleDriver. Seems
    that since I'm using the Oracle driver I should not be getting back this WebLogic
    connection.
    Any insight is appreciated :)
    thanks,
    Dan

    innumonenu wrote:
    Even we are facing the same problem of ClassCastException when we try to cast to
    OracleCallableStatement from the weblogic pool made of Oracle JDBC driver.
    What is the URL which explains,
    "Our wrappers do provide access to various non-standard
    Oracle methods, and we document how to cast (to our concret class or to an interface
    we define) in order to access these calls." as said by Joseph.http://e-docs.bea.com/wls/docs70/jdbc/thirdparty.html#1043705
    >
    >
    "Dan Branley" <[email protected]> wrote:
    Joseph,
    Thanks for the insight. This answers a lot of questions. I appreciate
    the thorough
    explanation. Your assumption is correct. I am trying to use an Oracle
    extension,
    specifically I need to call PreparedStatement.setBlob() passing an instance
    of
    an Oracle BLOB.empty_lob(). I'll take a look at the WLS documentation
    for an
    alternative.
    thanks,
    Dan Branley
    Joseph Weinstein <[email protected]> wrote:
    We never give application code direct access to pooled connections.We
    always
    supply a wrapper class. These wrapper classes have various extra functionality,
    such as cooperating under-the-covers with the transaction coordinator
    to provide
    EJB/UserTransaction transactional semantics/guarantees, regardless of
    the number
    of EJBs involved in a given transaction. For instance, when in an EJB/UserTransaction,
    our wrapper will cheerfully ignore if application code calls a Connection.commit().
    The
    application code has no idea really when the transaction is done and
    commitable, only
    the transaction coordinator does. Most simply, our pools guarantee that
    whatever
    application reserves a pool connection will have sole use of it until
    they close the connection
    to return it to the pool. If we allowed direct access to a pooled connection,
    one application
    could cache the reference, and re-use it later when we presumed to allow
    another user to
    use it from the pool. Some of our wrapper objects are RMI-enabled so
    they work in
    external client JVMs and will do JDBC over the wire to the weblogicserver
    and it's
    pool connections. This wayt application code need not change to work
    inside or
    outside weblogic.
    I suspect this question is because you want to use some of Oracle's
    non-standard
    extensions to JDBC. Our wrappers do provide access to various non-standard
    Oracle methods, and we document how to cast (to our concret class or
    to an interface we
    define) in order to access these calls. Not all calls can be successfully
    proxied by our wrappers
    because some Oracle methods (which claim to take java.sql object asarguments)
    actually
    require oracle specific classes, and reject our proxies, even if they
    are standard JDBC objects.
    Joe
    Dan Branley wrote:
    Does anyone know why I would be getting back an instance of weblogic.jdbc.rmi.SerialConnection
    when retrieving a connection out of the connection pool, via my JDBCTX DataSource,
    when my JDBC Connection pool is configured to use oracle.jdbc.OracleDriver.Seems
    that since I'm using the Oracle driver I should not be getting backthis WebLogic
    connection.
    Any insight is appreciated :)
    thanks,
    Dan

  • ClassCastException While Narrowing

    Hi,
    I have my application deployed as EAR file, with a WAR and two JAR for the statelesss session beans. On Server start up I call a servlet (in the WAR), which invokes the EJB deployed in one of the JAR file. At that instance it is giving the following Error:
    Exception :Cannot narrow remote object to au.com.three.hutchison.hss.ejb.staticinfo.StaticInfoHome
    java.lang.ClassCastException: Cannot narrow remote object to au.com.three.hutchison.hss.ejb.staticinfo.StaticInfoHome
         at weblogic.iiop.PortableRemoteObjectDelegateImpl.narrow(PortableRemoteObjectDelegateImpl.java:242)
         at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:134)
         at au.com.three.hutchison.hss.service.HSSServiceFactory.narrow(Unknown Source)
         at au.com.three.hutchison.hss.service.HSSServiceFactory.lookupHome(Unknown Source)
         at au.com.three.hutchison.hss.service.HSSServiceFactory.getRemote(Unknown Source)
         at au.com.three.hutchison.init.InitConfigInfoServlet.init(Unknown Source)
         at weblogic.servlet.internal.ServletStubImpl$ServletInitAction.run(ServletStubImpl.java:1070)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
         at weblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubImpl.java:893)
         at weblogic.servlet.internal.ServletStubImpl.createInstances(ServletStubImpl.java:842)
         at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:782)
         at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:3236)
    The same code used to work fine before, but I had some class loader issues to resolve which i set the 'prefer-web-inf-classes' to true in the weblogic.xml of the WAR. However after that I started getting the ClassCastException problem..
    Any Help Would be Hghly Appreciated
    Thanks
    Nitin

    here's the weblogic-application.xml that i have used to specify different classloaders
    <!DOCTYPE weblogic-application PUBLIC '-//BEA Systems, Inc.//DTD WebLogic Application 8.1.0//EN' 'http://www.bea.com/servers/wls810/dtd/weblogic-application_2_0.dtd'>
    <weblogic-application>
         <classloader-structure>
              <module-ref>
                   <module-uri>hssWebApp.war</module-uri>
              </module-ref>
              <module-ref>
                   <module-uri>StaticInfoBean/StaticInfoBean.jar</module-uri>
              </module-ref>
              <module-ref>
                   <module-uri>HSSGWSBean/HSSGWSBean.jar</module-uri>
              </module-ref>
         </classloader-structure>
    </weblogic-application>

  • Keep getting 5002 Error when trying to Sign In

    Hello,
    I created a new @me.com address today for a seperate Apple ID account.  I am needing to sign into the iTunes Store, but I keep getting a response that says:
    "We could not complete your iTunes Store request. An unknown error occurred (5002)."
    Any ideas as to what's going on here?
    I also took a screen cap of the issue:
    Thank you for the help!
    Marcus

    Thank you for your response Carolyn; however, that article does not fix my problem.  I am getting this error when trying to sign into the iTunes Store on my Mac.
    I get the same problem when signing into the Store on the iPad or iPhone.  I simply can't log in, but when I go to iCloud.com or the Apple ID login on Apple.com, it works.
    Marcus

  • I keep getting error message when trying to sign in for iMessage with my Apple ID since upgrading to iOS 7

    I keep getting error messages when I try to activate iMessage on my iPad since installing iOS7. Anyone else having this issue or a solution. I can obviously sign in with the same Apple ID information/password as I have done here and I am connecting with Wifi now and in all other apps.

    After looking at some other posts I signed into iTunes and edited my password with my Mac. Then I powered off and restarted my iPad and all is good now.

Maybe you are looking for

  • Adobe Creative Cloud Package on MAC - programs do not install

    We have a iMac (Late 2013) with OS X 10.9.5 and we are taking the following situation: After creating the Adobe Creative Cloud Package, we try to perform the installation and after the process fully and correctly occur and give success message at the

  • MRP: how to segregate the planned orders by dependent requirements

    Hello SAP Guru's, I would like to know if this is possible to make the MRP work is this way: - generate global planned orders (by date) for several dependent requirements, for inhouse production; - AND generate individual planned orders for each depe

  • Purchase account GL Code Breakup

    Hi, i want breakup like Original Invoice value, Excise duty, Custom duty and sales tax etc. from Purchase account GL Code 425001 how i can get this ? hoping to reply Regards Rahul

  • How To Enable Group Layout When Creating Chart in Crystal Reports XI

    Hi I Created a chart, and i placed the same on Report Header, when i want to change the layout Option As Group, it is disabled, how to enable the Group Layout Option.

  • Cannot Sync Entourage 2008 to Address Book

    I have been using and syncing Entourage forever, and been syncing to iCal and Address for several years, especially since I've had my iPhone. For some reason, and it seems very recent, no problem Syncing to iCal from Entourage, but I cannot Sync cont