Java.lang.ClassCastException: examples.ejb.basic.statefulSession.TraderBeanHomeImpl_ServiceStub

I am using the example from the XML/HTTP which uses a client, servlet and request
handler. The Servlet calls the StatefulSession TraderHome Bean.
I am getting the following: java.lang.ClassCastException: examples.ejb.basic.statefulSession.TraderBeanHomeImpl_ServiceStub.
Anyboy have a similar problem?
This works with the Client prg in the ejb/basic/StatefulSssion "Client" It works
correctly

I am using the example from the XML/HTTP which uses a client, servlet and request
handler. The Servlet calls the StatefulSession TraderHome Bean.
I am getting the following: java.lang.ClassCastException: examples.ejb.basic.statefulSession.TraderBeanHomeImpl_ServiceStub.
Anyboy have a similar problem?
This works with the Client prg in the ejb/basic/StatefulSssion "Client" It works
correctly

Similar Messages

  • Java.lang.ClassCastException in EJB's

    Friends Need your suggestions on the following:-
    1. try {
    2.     InitialContext ctx = new InitialContext();
    3.     Object objref = ctx.lookup("ejb/test/MyTestSessionBean");
    4.     testSessionBean = (MyTestSessionHome) PortableRemoteObject.narrow(
    5.               objref, MyTestSessionHome.class);
    6. } catch (Exception NamingException) {
    7.      NamingException.printStackTrace();
    8. }
    I am unable to understand as to why I am getting an exception at line 4.
    The exception is:-
    11:21:56,649 ERROR [STDERR] java.lang.ClassCastException
    11:21:56,649 ERROR [STDERR] at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:
    293)
    11:21:56,649 ERROR [STDERR] at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:134)
    11:21:56,649 ERROR [STDERR] at test.session.SessionTestServlet.init(SessionTestServlet.java:29)
    11:21:56,649 ERROR [STDERR] at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1105)
    11:21:56,649 ERROR [STDERR] at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:932)
    11:21:56,649 ERROR [STDERR] at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3917)
    11:21:56,649 ERROR [STDERR] at org.apache.catalina.core.StandardContext.start(StandardContext.java:4201)
    The above exception comes as soon as I deploy my ear to deploy folder in JBOSS.
    Thanks,
    Vishal

    I was facing the same proble. Simply diasble packaging class files in war file and the problem will be solved. Check build xml...I have commecnted class file addition in war file......Hope it solve your problem....I am beginer in Java technology...so dont hope expert repy from me in case your problem is still not solved....
    <?xml version="1.0"?>
    <!-- ==================================================== -->
    <!-- Build file for our first web application -->
    <!-- build.xml, Saturday, July 20, 2002 -->
    <!-- Author: Deepak Kumar -->
    <!-- Email : [email protected] -->
    <!-- Url : http://www.roseindia.net -->
    <!-- ==================================================== -->
    <project name="Jboss 3.0 tutorial series" default="all" basedir=".">
         <path id="build.classpath">
              <fileset dir="D:/JBOSS-4.0.4/server/default/lib/">
                   <include name="*.jar"/>
              </fileset>
         </path>
         <target name="init">
              <property name="dirs.base" value="${basedir}"/>
              <property name="classdir" value="${dirs.base}/build/src"/>
              <property name="src" value="${dirs.base}/src"/>
              <property name="web" value="${dirs.base}/web"/>
              <property name="deploymentdescription" value="${dirs.base}/deploymentdescriptors"/>
              <property name="warFile" value="example3.war"/>
              <property name="earFile" value="example3.ear"/>
              <property name="jarFile" value="example3.jar"/>
              <property name="earDir" value="${dirs.base}/build/ear"/>
              <property name="warDir" value="${dirs.base}/build/war"/>
              <property name="jarDir" value="${dirs.base}/build/jar"/>
              <!-- Create Web-inf and classes directories -->
              <mkdir dir="${warDir}/WEB-INF"/>
              <mkdir dir="${warDir}/WEB-INF/classes"/>
              <!-- Create Meta-inf and classes directories -->
              <mkdir dir="${earDir}/META-INF"/>
              <mkdir dir="${jarDir}/META-INF"/>
         </target>
         <!-- Main target -->
         <target name="all" depends="init,build,buildWar,buildJar,buildEar"/>
         <!-- Compile Java Files and store in /build/src directory -->
         <target name="build" >
              <javac srcdir="${src}" destdir="${classdir}" classpathref="build.classpath" debug="on" includes="**/*.java" />
         </target>
         <!-- Create the web archive File -->
         <target name="buildWar" depends="init">
    <!--          <copy todir="${warDir}/WEB-INF/classes">
                   <fileset dir="${classdir}" includes="**/*.class" />
              </copy>
    -->     
              <copy todir="${warDir}/WEB-INF">
                   <fileset dir="${deploymentdescription}/web/" includes="web.xml,jboss-web.xml" />
              </copy>
              <copy todir="${warDir}">
                   <fileset dir="${web}" includes="**/*.*" />
              </copy>
              <!-- Create war file and place in ear directory -->
              <jar jarfile="${earDir}/${warFile}" basedir="${warDir}" />
         </target>
         <!-- Create the jar File -->
         <target name="buildJar" depends="init">
              <copy todir="${jarDir}">
                   <fileset dir="${classdir}" includes="**/*.class" />
              </copy>
              <copy todir="${jarDir}/META-INF">
                   <fileset dir="${deploymentdescription}/jar/" includes="ejb-jar.xml,jboss.xml" />
              </copy>
              <!-- Create jar file and place in ear directory -->
              <jar jarfile="${earDir}/${jarFile}" basedir="${jarDir}" />
         </target>
         <!-- Create the ear File -->
         <target name="buildEar" depends="init">
              <copy todir="${earDir}/META-INF">
                   <fileset dir="${deploymentdescription}/ear" includes="application.xml" />
              </copy>
              <!-- Create ear file and place in ear directory -->
              <jar jarfile="${basedir}/${earFile}" basedir="${earDir}" />
         </target>
    </project>

  • Java.lang.ClassCastException serializing EJB

    Hi!
    I'm getting this exception while passing an EJB as a method parameter.
    RMI Exception passing by to client
    java.lang.ClassCastException: com.evermind.server.rmi.RemoteInvocationHandler
    at com.evermind.server.ejb.EJBOutputStream.replaceEJBObject(EJBOutputStream.java:53)
    at com.evermind.server.ejb.EJBOutputStream.replaceObject(EJBOutputStream.java:25)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:318)
    The Remote interface extends java.io.Serializable, and the Bean Class implement this interface (obviously). All fields in the Bean implementation class are also Serializable.
    I don't know why casting to com.evermind.server.rmi.RemoteInvocationHandler fails for this EJB, and I don't know if is the expected behavior.
    Any ideas?
    F.Catrin
    TUXPAN

    Hi!
    I'm getting this exception while passing an EJB as a method parameter.
    RMI Exception passing by to client
    java.lang.ClassCastException: com.evermind.server.rmi.RemoteInvocationHandler
    at com.evermind.server.ejb.EJBOutputStream.replaceEJBObject(EJBOutputStream.java:53)
    at com.evermind.server.ejb.EJBOutputStream.replaceObject(EJBOutputStream.java:25)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:318)
    The Remote interface extends java.io.Serializable, and the Bean Class implement this interface (obviously). All fields in the Bean implementation class are also Serializable.
    I don't know why casting to com.evermind.server.rmi.RemoteInvocationHandler fails for this EJB, and I don't know if is the expected behavior.
    Any ideas?
    F.Catrin
    TUXPAN

  • Java.lang.ClassCastException in Servle while using EJB

    I m trying to get a ejb instant in a servlet.I am using Blazix EJB server as a EJB contianer and Blazix Web server as servlet container.I get a java.lang.ClassCastException.
    I m using Demo bean with DemoHome as home interface and DemoBean as EJB name.
    The servlet code contains....
    Context initial = getInitialContext();
    Object objref = initial.lookup("DemoBean");
    DemoHome dhome =(DemoHome)PortableRemoteObject.narrow(objref,DemoHome.class);
                   demo = dhome.create();
    The printStackTrace is as follows
    java.lang.ClassCastException
    at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:293)
    at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:134)
    at BeanServlet.init(BeanServlet.java:30)
    at desisoft.server.servlets.Servlet.init(Servlet.java:52)
    at desisoft.server.servlets.Context.getServletInstance(Context.java:1783
    at desisoft.server.servlets.Context.getContextInternalDispatcher(Context.java:2583)
    at desisoft.server.servlets.Context.getContextDispatcher(Context.java:2402)
    at desisoft.server.servlets.Context.getDispatcher(Context.java:2212)
    at desisoft.server.common.HttpStream.processRequest(HttpStream.java:617)
    at desisoft.server.conn.ServerThread.run(ServerThread.java:335)
    So please help me
    Regards
    Pravin

    I am having a similar issue with stratightforward client code ...
    I set properties values
    java.naming.provider.url=iiop://officepc:3700
    java.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory
    java.naming.factory.url.pkgs=com.sun.enterprise.naming
    in a properties file.
    When "Object objref = jndiContext.lookup( resourceId ) "
    returns,objref is resolved as a "com.sun.corba.se.internal.iiop.CDRInputStream_1_0$1"
    instance. The "resourceId" is a String jndi-name for a Session Bean reference.
    When the "javax.rmi.PortableRemoteObject.narrow((java.lang.Object) objref, CartHome.class )"
    is called, the stack dumps:
    java.lang.ClassCastException
    at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:293)
    at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:134)
    Any thoughts? I have tried everything, I think.
    HW

  • Java.lang.ClassCastException in glassfish

    I'm working on a simple application with Glassfish and OSGI. I found this tutorial: http://blogs.oracle.com/arungupta/entry/totd_154_dynamic_osgi_services I modified the example. You can find my customized example file: http://uploading.com/files/cf1ffd63/test.zip/ I created EAR package with web module and EJB module. I created a session bean which calls the OSGI bundle. I successfully compiled the project. The problem is that when i uploaded the packages into Glassfish application server and tried to open the simple applet into the web module this error message appears:
    HTTP Status 500 -
    type Exception report
    message
    descriptionThe server encountered an internal error () that prevented it from fulfilling this request.
    exception
    java.lang.ClassCastException: Cannot cast org.glassfish.web.loader.WebappClassLoader to org.osgi.framework.BundleReference
    note The full stack traces of the exception and its root causes are available in the GlassFish Server Open Source Edition 3.1.1 logs.
    GlassFish Server Open Source Edition 3.1.1
    Maybe the problem is missing dependency. I can't the problem? Do you have any idea what may be the problem?
    Kind regards, Peter
    p.s this is the error stack
    http://pastebin.com/FNaTd9jP

    I'm working on a simple application with Glassfish and OSGI. I found this tutorial: http://blogs.oracle.com/arungupta/entry/totd_154_dynamic_osgi_services I modified the example. You can find my customized example file: http://uploading.com/files/cf1ffd63/test.zip/ I created EAR package with web module and EJB module. I created a session bean which calls the OSGI bundle. I successfully compiled the project. The problem is that when i uploaded the packages into Glassfish application server and tried to open the simple applet into the web module this error message appears:
    HTTP Status 500 -
    type Exception report
    message
    descriptionThe server encountered an internal error () that prevented it from fulfilling this request.
    exception
    java.lang.ClassCastException: Cannot cast org.glassfish.web.loader.WebappClassLoader to org.osgi.framework.BundleReference
    note The full stack traces of the exception and its root causes are available in the GlassFish Server Open Source Edition 3.1.1 logs.
    GlassFish Server Open Source Edition 3.1.1
    Maybe the problem is missing dependency. I can't the problem? Do you have any idea what may be the problem?
    Kind regards, Peter
    p.s this is the error stack
    http://pastebin.com/FNaTd9jP

  • Java.lang.ClassCastException in JSP page

    My JSP page:
    <%@page contentType="text/html"%>
    <HTML>
    <HEAD>
    <TITLE> JDBC Servlet/JSP Example </TITLE>
    </HEAD>
    <BODY>
    <%@ page import="myBeans.memoryBean" %>
    <%@ page import="java.util.Vector" %>
    <H1> JDBC Servlet/JSP Example </H1>
    <H2> <%= session.getValue("message") %>
    </H2>
    <UL>
    <%
         Vector vData = (Vector) session.getValue("res");
         myBeans.memoryBean mb;
         Object o;
         for (Enumeration e = vData.elements() ; e.hasMoreElements() ;) {
              o = e.nextElement();
              mb = (myBeans.memoryBean) o;
    %>
        <LI> <%= o.getClass().getName() %>
    <%      } // end for
    %>
    </UL>
    </BODY>
    </HTML>Notice that I don't even use the object I cast but I still get the error message:
    Exception:
    java.lang.ClassCastException
         at _memory._search._jspService(_search.java:66)
         at oracle.jsp.runtime.HttpJsp.service(HttpJsp.java)
         at oracle.jsp.app.JspApplication.dispatchRequest(JspApplication.java)
         at oracle.jsp.JspServlet.doDispatch(JspServlet.java)
         at oracle.jsp.JspServlet.internalService(JspServlet.java)
         at oracle.jsp.JspServlet.service(JspServlet.java)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
         at org.apache.jserv.JServConnection.processRequest(JServConnection.java:314)
         at org.apache.jserv.JServConnection.run(JServConnection.java:188)
         at java.lang.Thread.run(Thread.java:534)When I comment out the line that castes my object my browser displays:
    JDBC Servlet/JSP Example
    Records Found:
        * myBeans.memoryBean
        * myBeans.memoryBean
        * myBeans.memoryBean Notice that the three objects that are returned are exactly the type that I caste to.
    Also, I did a getClass().getClassLoader() when I create the objects in my servlet code and again on the JSP pages for each object I pull out of the vector and the class loader matched.
    I even changed the package on my bean class and recompiled everything to make sure it wasn't a old .class file floating around.
    Could this have something to do with my classpath or where my classes are being placed? I found a similar problem here: http://forum.java.sun.com/thread.jsp?forum=33&thread=380437&start=0&range=15&hilite=false&q=
    but the explanation of what was done wasn't clear
    Anyone have any idea what's going on here?
    I am using:
    Oracle 9i
    Oracle HTTP Server Powered by Apache/1.3.12 (Unix)
    ApacheJServ/1.1
    Thanks in advance.
    - Linus

    Is ti at all possible that you have another jar / zip file with the same class file in it, seemingly away from the Server classpath ? In which case this could happen even though logically it shouldn't !!!

  • Sun J2EE SDK 1.3_01, java.lang.ClassCastException thrown during deployment

    I encountered a bug while using the deploytool to deploy
    an EAR file to the Sun J2EE 1.3_01 server.
    I submitted a bug report to Sun via the Sun Java Developer Connection.
    (Sorry, it has not been assigned a BugID yet)
    Question:
    Does anybody know if the web container in Sun's
    J2EE 1.3_01 server supports access to local enterprise beans?
    Screenshots of the bug are available at
    http://sync4j.sourceforge.net/deploymentbug/
    Full details below....
    -Sean
    category: j2ee
    subcategory: deployment
    release: 1.3_01
    hardware: x86
    OSversion: windows_2000
    synopsis: java.lang.ClassCastException thrown during deployment of Session bean
    java -version
    java version "1.3.1_01"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_01)
    Java HotSpot(TM) Client VM (build 1.3.1_01, mixed mode)
    C:\j2sdkee1.3\bin>j2ee -version
    Java 2 Enterprise Edition version 1.3_01, build 1.3_01-b01
    I built a EJB 2.0 compliant stateful session bean.
    The session bean has a remote interface (ISyncRemote),
    a remote home interface (ISyncHomeRemote),
    a local interface (ISyncLocal),
    and a local home interface (ISyncHomeLocal).
    I built an HTTP Servlet that is supposed to access
    the Stateful Session Bean using ISyncHomeLocal and
    ISyncLocal
    I run "deploytool.bat" in GUI mode to perform the deployment.
    During deployment, the deploytool GUI displays a message
    box which states:
    "There was a deployment error.
    java.rmi.ServerException: RemoteException occurred in server thread;
    nested exception is:
    java.rmi.RemoteException: An error was encountered while loading
    a web component.
    Please refer to
    <J2EE_HOME>/logs/<machine-name>/j2ee//j2ee/error.log
    for more information. Please verify your Application with the
    Verifier tool."
    The "error.log" file did not contain any useful information.
    I ran the J2EE "verifier.bat" tool to verify that my EAR archive is OK.
    The Sun J2EE server output this error string:
    "java.lang.ClassCastException:
    com.sun.enterprise.deployment.EjbExternalDescriptor"
    Here is the full output from the Sun J2EE server:
    C:\j2sdkee1.3\bin>j2ee -verbose
    J2EE server listen port: 1050
    Naming service started:1050
    Binding DataSource, name = jdbc/EstoreDB, url =
    jdbc:cloudscape:rmi:CloudscapeDB;create=true
    Binding DataSource, name = jdbc/Cloudscape, url =
    jdbc:cloudscape:rmi:CloudscapeDB;create=true
    Binding DataSource, name = jdbc/DB1, url =
    jdbc:cloudscape:rmi:CloudscapeDB;create=true
    Binding DataSource, name = jdbc/DB2, url =
    jdbc:cloudscape:rmi:CloudscapeDB;create=true
    Binding DataSource, name = jdbc/InventoryDB, url =
    jdbc:cloudscape:rmi:CloudscapeDB;create=true
    Binding DataSource, name = jdbc/XACloudscape, url = jdbc/XACloudscape__xa
    Binding DataSource, name = jdbc/XACloudscape__xa, dataSource =
    COM.cloudscape.core.RemoteXaDataSourc
    e@245536
    Starting JMS service...
    Initialization complete - waiting for client requests
    Binding: < JMS Destination : jms/Queue , javax.jms.Queue >
    Binding: < JMS Destination : jms/Topic , javax.jms.Topic >
    Binding: < JMS Cnx Factory : TopicConnectionFactory , Topic , No properties >
    Binding: < JMS Cnx Factory : jms/TopicConnectionFactory , Topic , No properties
    >
    Binding: < JMS Cnx Factory : QueueConnectionFactory , Queue , No properties >
    Binding: < JMS Cnx Factory : jms/QueueConnectionFactory , Queue , No properties
    >
    Starting web service at port: 8000
    Starting secure web service at port: 7000
    J2EE SDK/1.3
    Starting web service at port: 9191
    J2EE SDK/1.3
    J2EE server startup complete.
    Compiling c:\j2sdkee1.3\repository\rbi\gnrtrTMP\Sync4j Server enterprise
    application\sync4j\server\s
    yncbean\SyncBean_LocalHomeImpl.java ....
    Compiling c:\j2sdkee1.3\repository\rbi\gnrtrTMP\Sync4j Server enterprise
    application\sync4j\server\s
    yncbean\SyncBean_EJBLocalObjectImpl.java ....
    Compiling c:\j2sdkee1.3\repository\rbi\gnrtrTMP\Sync4j Server enterprise
    application\sync4j\server\s
    yncbean\SyncBean_RemoteHomeImpl.java ....
    Compiling c:\j2sdkee1.3\repository\rbi\gnrtrTMP\Sync4j Server enterprise
    application\sync4j\server\s
    yncbean\SyncBean_EJBObjectImpl.java ....
    rmic sync4j.server.syncbean.SyncBean_RemoteHomeImpl...
    rmic sync4j.server.syncbean.SyncBean_EJBObjectImpl...
    c:\j2sdkee1.3\repository\rbi\applications\Sync4j Server enterprise
    application1004172068449Server.ja
    r
    Binding name:`java:comp/env/ejb/ISyncHomeRemote`
    Binding name:`java:comp/env/ejb/ISyncHomeLocal`
    java.lang.ClassCastException:
    com.sun.enterprise.deployment.EjbExternalDescriptor
    at com.sun.enterprise.deployment.EjbReferenceDescriptor.getValue
    (EjbReferenceDescriptor.java
    :202)
    at com.sun.enterprise.naming.NamingManagerImpl.bindObjects
    (NamingManagerImpl.java:394)
    at com.sun.web.server.WebService.addContext(WebService.java:148)
    at com.sun.web.server.ServletDeployerImpl.loadWebComponents
    (ServletDeployerImpl.java:214)
    at
    com.sun.enterprise.tools.deployment.backend.JarInstallerImpl.deployWebComponent
    s
    (JarInsta
    llerImpl.java:791)
    at
    com.sun.enterprise.tools.deployment.backend.JarInstallerImpl.deployApplication
    (JarInstall
    erImpl.java:219)
    at
    org.omg.stub.com.sun.enterprise.tools.deployment.backend._JarInstallerImpl_Tie.
    invoke(Un
    known Source)
    at com.sun.corba.ee.internal.corba.ServerDelegate.dispatch
    (ServerDelegate.java:355)
    at com.sun.corba.ee.internal.iiop.ORB.process(ORB.java:273)
    at com.sun.corba.ee.internal.iiop.RequestProcessor.process
    (RequestProcessor.java:84)
    at com.sun.corba.ee.internal.orbutil.ThreadPool$PooledThread.run
    (ThreadPool.java:99)
    Does the Sun J2EE server implementation support the invocation
    of Session EJB's via a Local interface?
    Does the Sun J2EE server implementation allow a Servlet to invoke
    Session EJB's via the bean's Local interface?
    While researching this issue, I read the J2EE 1.3 final specification.
    The spec says:
    "The EJB container is required to access to local enterprise beans.
    We recommend that the web container also support access to local
    enterprise beans."
    Does the web container in Sun's J2EE server support access to local enterprise beans?

    I'm pretty much sure that you cannot access a
    local Session bean from outside the EJB container.Please read the J2EE 1.3 specification before posting messages about EJB and J2EE.
    According to the J2EE 1.3 specification:
    "The EJB container is required to support access to local enterprise beans. We recommend that the web container also support access to local enterprise beans.
    No support is provided for access to local enterprise beans from the application client container or the applet container."
    If you use local interfaces for your session bean,
    than your client must be local too. A local client is
    a client that is collocated in the same JVM with the
    session/entity that provides the local view and which
    can be tightly coupled to the bean.My client is running in the same JVM as my EJB. The client is a servlet. The servlet is running in the same JVM as the EJB.
    For what its worth, the error that I observed occurs during deployment. I haven't figured out why deployment is failing.

  • Java.lang.ClassCastException when calling webservice stub  from oracle DB

    Hello everyone,
    Because i need to get familliar with calling java webservices from an oracle database, i followed the following example
    (http://www.oracle.com/technology/products/jdev/howtos/10g/WS_DBCallout/DBCalloutWS_HowTo.htm),
    which included installing the SOAP client stack to the database (in the sys schema), grant the right permissions to the SYS user, developing a simple Helloworld webservice with jdeveloper 10.1.2, generating a Webservice stub and deploying a static method of this stub to the database.
    All of this worked just fine, but when i want to call the webservice from oracle by invoking the deployed function, i get a java.lang.ClassCastException.
    The complete stacktrace lists as follows:
    v_Return = foutje: java.lang.ClassCastExceptionnulljava.lang.ClassCastException
         at org.apache.soap.rpc.RPCMessage.serializeParams(RPCMessage.java:323)
         at org.apache.soap.rpc.RPCMessage.marshall(RPCMessage.java:305)
         at org.apache.soap.Body.marshall(Body.java:148)
         at org.apache.soap.Envelope.marshall(Envelope.java:203)
         at org.apache.soap.Envelope.marshall(Envelope.java:161)
         at oracle.soap.transport.http.OracleSOAPHTTPConnection.send(OracleSOAPHTTPConnection.java:664)
         at org.apache.soap.rpc.Call.invoke(Call.java:261)
         at test.HelloWorldServiceStub.sayHello(HelloWorldServiceStub.java:82)
    I debugged the WebServiceStub and noticed that the call.invoke method crashes. This is weird beacuse when i use System.out.println on the parameter is works just fine. so you would think it is a string.
    Moreover, if i invoke the webservice from the endpoint or even when im debugging the stub locally it all works just fine.
    Can someone plzzzzzz help me with this because i spend the whole day looking for an answer and im getting crazy!!!!!
    Thanx al lot guys,
    Kim
    PS or could the problem be in the database instead of the webservice?????????
    Message was edited by:
    user568880
    Message was edited by:
    Kim Zeevaarders

    I think that it's going wrong because i did not install the right SOAP client stack.
    In the HowTo is specified what JAR files are to be loaded in the database (from %JDEV_HOME), but it states that it has only been tested on a Oracle 9.2 database. I'm using Oracle10g. Maybe that's the reason that im getting this classcast exception...
    Can anybody tell me what the right .JAR files are that have to be loaded into database when working with Oracle 10g?
    Many thx in advance!
    Kim

  • Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException:

    Could anyone please explain me what is this error about
    Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: java.lang.Integer
    at timetablegen.MainFrame.jButton17ActionPerformed(MainFrame.java:1816)
    at timetablegen.MainFrame.access$2100(MainFrame.java:16)
    at timetablegen.MainFrame$23.actionPerformed(MainFrame.java:1136)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:234)
    at java.awt.Component.processMouseEvent(Component.java:5488)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
    at java.awt.Component.processEvent(Component.java:5253)
    at java.awt.Container.processEvent(Container.java:1966)
    at java.awt.Component.dispatchEventImpl(Component.java:3955)
    at java.awt.Container.dispatchEventImpl(Container.java:2024)
    at java.awt.Component.dispatchEvent(Component.java:3803)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
    at java.awt.Container.dispatchEventImpl(Container.java:2010)
    at java.awt.Window.dispatchEventImpl(Window.java:1774)
    at java.awt.Component.dispatchEvent(Component.java:3803)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
    I am taking an object from jComboBox as a String and then converting it to integer & adding to the database.
    It is not getting added in database to & throwing above exception.

    Hello,
    First parse the string taken from combo box using Integer.parseInt(str), not directly cast it to Integer.
    Regards

  • Java.lang.ClassCastException  in local lookups

    hi,
    i have written two ejb projects named as proj1 and proj2.
    i deployed proj1 as EAR1 and proj2 as EAR2.(in same server)
    in proj1 Sessionbean1  i need to use(lookup) proj2 Sessionbean2 .
    <b>i have given jndi name for proj2 Sessionbean2 as "jndiproj2"</b>
    InitialContext ic=new InitialContext();
    Sessionbean2LocalHome home=(Sessionbean2LocalHome)ic.lookup("localejbs/jndiproj2");
    while i am running this application i am getting java.lang.ClassCastException.
    (this application is working fine if i deployed both proj1 and proj2 together as single EAR)
    regards
    Guru

    Have you ever connected to your SAP J2EE Engine using the Visual Administrator?  If so, you can go to Server->Service->JNDI Registry and look under the localejbs for the actual name that would work in the lookup method.
    It appears to me that you are missing the vendor.  If you have not specified a vendor in the application-j2ee-engine.xml, then it is by default "sap.com", then your ejb application name, then you EJB name.
    I have created a bean SurveyReportsBean with my SurveyApp with the vendor of pcbp.com.  My lookup would be:
    "localejbs/pcbp.com/SurveyApp/SurveyReportsBean"
    Hope this helps.

  • Java.Lang.ClassCastException in HelloWorldMessageJNDI

    Hi
    I am getting this error message when I compile and run the Sun provided sample HelloWorldMessageJNDI
    Looking up Queue Connection Factory object with lookup name: MyQueueConnectionFactory
    Exception in thread "main" java.lang.ClassCastException
    at HelloWorldMessageJNDI.<init>(HelloWorldMessageJNDI.java:142)
    at HelloWorldMessageJNDI.main(HelloWorldMessageJNDI.java:99)
    The code fragment at the specified line number is
    qcf = (javax.jms.QueueConnectionFactory) ctx.lookup(MYQCF_LOOKUP_NAME);  Any help would be highly appreciated.
    Thanks
    Andy

    Hi,
    The HelloWorldMessageJNDI.java example uses imqobjmgr
    to first set up the required queue connection factory and queue
    administered objects prior to running the
    HelloWorldMessageJNDI application. Running the imqobjmgr
    command is made simpler by having 'command files' - files
    containing the parameters to imqobjmgr. These are the java
    property files .props suffix.
    The entire sequence of steps required for setting up and
    running the demo is in the README file.
    I assume you ran:
    imqobjmgr -i add_qcf.props
    imqobjmgr -i add_q.props
    prior to running the example ?
    The command:
    imqobjmgr -i list.props
    can also be used to verify if the setup worked. The output
    should look something like:
    % imqobjmgr -i list.props
    Listing all administered objects in the object store specified by:
    java.naming.factory.initial com.sun.jndi.fscontext.RefFSContextFactory
    java.naming.provider.url file:///tmp
    Lookup Name Object Class Name
    MyQueue com.sun.messaging.Queue
    MyQueueConnectionFactory com.sun.messaging.QueueConnectionFactory
    What could go wrong ? If, prior to running this example, you
    or someone else had created another administered object of a
    different type but at the same lookupname (e.g.
    'MyQueueConnectionFactory') the class cast exception would
    occur.
    However if you run the imqobjmgr commands as above, any
    pre-existing objects will be detected and you should see
    something like:
    Warning: MyQueueConnectionFactory already exists.
    Warning: Adding will overwrite the current object.
    Are you sure you want to overwrite this object? (y/n)
    The output of:
    imqobjmgr -i list.props
    should show you if/whether the right type of object is at the
    lookup location MyQueueConnectionFactory. The value
    should be
    com.sun.messaging.QueueConnectionFactory which is
    compatible with javax.jms.QueueConnectionFactory.
    Another possibility is a bad or modified add_qcf.props
    file. The line in it that specifies the type of object is:
    # Object type
    obj.type=qf
    hope this helps,
    -isa
    http://www.sun.com/software/products/message_queue/index.xml

  • Java.lang.ClassCastException in jsp trying to access session bean

    Ok I'm totally stuck on this. I've been able to deploy my session bean facade to a bunch of entities bean with no problem. Now I'm trying to access the bean from a JSP. I can do a lookup ok, I can even do a PortableRemoteObject.narrow() ok, but when I try to actually cast the object I get an error. I can't understand why narrow works if the object is not of the correct type, when I do reflection I can verify that the object implements the interface I am trying to cast to. But when I do an instanceof the object from narrow is not the right type. I'm totally confused by this.
    Here's my jsp,
    <%@taglib uri="/com/sct/socrates/web/jsp/tld/UserAdmin.tld" prefix="UserAdmin" %>
    <%@ page import="java.sql.*" %>
    <%@ page import="javax.naming.*" %>
    <%@ page import="com.sct.socrates.useradmin.model.UserAdminHome" %>
    <%@page import="javax.rmi.PortableRemoteObject"%>
    <html>
    <body>
    <pre>
    <%
    try {
    InitialContext context = new InitialContext();
    Object object1 = context.lookup("com.sct.socrates.useradmin.model.UserAdminHome");
    out.println(object1.getClass().getName());
    Object object2 = PortableRemoteObject.narrow(object1, UserAdminHome.class);
    out.println(object2.getClass().getName());
    if (object2 instanceof UserAdminHome) out.println("is instance");
    Class[] list = object2.getClass().getInterfaces();
    for(int i=0;i<list.length;i++)
    out.println(list.getName());
    UserAdminHome home = (UserAdminHome) object2;
    } catch (Exception e){
    e.printStackTrace();
    %>
    </pre>
    </body>
    </html>
    Here's the output from the JSP,
    com.sct.socrates.useradmin.model._UserAdminHome_Stub
    com.sct.socrates.useradmin.model._UserAdminHome_Stub
    com.sct.socrates.useradmin.model.UserAdminHome
    Here's the server output,
    FINE: for host 127.0.0.1 trying to GET /socrates/jsp/guest/test.jsp, ntrans-j2ee reports: mapped uri "/jsp/guest/test.jsp" in context "/socrates" to resource
    FINE: context = StandardEngine[null].StandardHost[server1].StandardContext[socrates]
    FINE: contextPath = /socrates
    FINE: wrapper = StandardEngine[null].StandardHost[server1].StandardContext[socrates].StandardWrapper[jsp]
    FINE: servletPath = /jsp/guest/test.jsp
    FINE: pathInfo = null
    FINE: SingleSignOn[server1]: Process request for '/socrates/jsp/guest/test.jsp'
    FINE: SingleSignOn[server1]: Checking for SSO cookie
    FINE: SingleSignOn[server1]: SSO cookie is not present
    FINE: Authenticator[socrates]: Security checking request GET /socrates/jsp/guest/test.jsp
    FINE: Authenticator[socrates]: Checking constraint 'SecurityConstraint[community]' against GET /jsp/guest/test.jsp --> false
    FINE: Authenticator[socrates]: Checking constraint 'SecurityConstraint[user]' against GET /jsp/guest/test.jsp --> false
    FINE: Authenticator[socrates]: Checking constraint 'SecurityConstraint[community]' against GET /jsp/guest/test.jsp --> false
    FINE: Authenticator[socrates]: Checking constraint 'SecurityConstraint[moderator]' against GET /jsp/guest/test.jsp --> false
    FINE: Authenticator[socrates]: Checking constraint 'SecurityConstraint[admin]' against GET /jsp/guest/test.jsp --> false
    FINE: Authenticator[socrates]: No applicable constraint located
    FINE: Authenticator[socrates]: Not subject to any constraint
    FINE: JspEngine --> /jsp/guest/test.jsp
    FINE: ServletPath: /jsp/guest/test.jsp
    FINE: PathInfo: null
    FINE: RealPath: E:\dev\app_server\sun\appserv\domains\domain1\server1\applications\j2ee-apps\socrates_3\socrates_war\jsp\guest\test.jsp
    FINE: RequestURI: /socrates/jsp/guest/test.jsp
    FINE: QueryString: null
    FINE: ++++ Entered SecClientRequestInterceptor::send_request()
    FINE: Security context is null (nothing to add to service context)
    FINE: No SAS context element found in service context list
    FINE: ++++ Entered SecClientRequestInterceptor::receive_reply
    FINE: No SAS context element found in service context list
    FINE: Status to be set : 0
    FINE: Invoked receivedReply()
    FINE: ++++ Entered SecClientRequestInterceptor::send_request()
    FINE: Security context is null (nothing to add to service context)
    FINE: No SAS context element found in service context list
    FINE: ++++ Entered SecClientRequestInterceptor::receive_reply
    FINE: No SAS context element found in service context list
    FINE: Status to be set : 0
    FINE: Invoked receivedReply()
    FINE: service-j2ee: name = "com.sct.socrates.useradmin.model._UserAdminHome_Stub", codebase = ""
    FINER: service-j2ee: (thread context class loader: WebappClassLoader
    available:
    delegate: false
    repositories:
    /WEB-INF/classes/
    required:
    ----------> Parent Classloader:
    EJB CL:
    [com.iplanet.ias.loader.EJBClassLoader$URLEntry@e1df6e, com.iplanet.ias.loader.EJBClassLoader$URLEntry@13b9fb]
    FINER: service-j2ee: class "com.sct.socrates.useradmin.model._UserAdminHome_Stub" found via codebase, defined by EJB CL:
    [com.iplanet.ias.loader.EJBClassLoader$URLEntry@e1df6e, com.iplanet.ias.loader.EJBClassLoader$URLEntry@13b9fb]
    FINE: ++++ Entered SecClientRequestInterceptor::send_request()
    FINE: Security context is null (nothing to add to service context)
    FINE: No SAS context element found in service context list
    FINE: ++++ Entered SecClientRequestInterceptor::receive_reply
    FINE: No SAS context element found in service context list
    FINE: Status to be set : 0
    FINE: Invoked receivedReply()
    FINE: service-j2ee: name = "com.sct.socrates.useradmin.model._UserAdminHome_Stub", codebase = ""
    FINER: service-j2ee: (thread context class loader: WebappClassLoader
    available:
    delegate: false
    repositories:
    /WEB-INF/classes/
    required:
    ----------> Parent Classloader:
    EJB CL:
    [com.iplanet.ias.loader.EJBClassLoader$URLEntry@e1df6e, com.iplanet.ias.loader.EJBClassLoader$URLEntry@13b9fb]
    FINER: service-j2ee: class "com.sct.socrates.useradmin.model._UserAdminHome_Stub" found via codebase, defined by EJB CL:
    [com.iplanet.ias.loader.EJBClassLoader$URLEntry@e1df6e, com.iplanet.ias.loader.EJBClassLoader$URLEntry@13b9fb]
    WARNING: CORE3283: stderr: java.lang.ClassCastException: com.sct.socrates.useradmin.model._UserAdminHome_Stub
    WARNING: CORE3283: stderr: at jasper.jsp._guest._test_jsp._jspService(_test_jsp.java:89)
    WARNING: CORE3283: stderr: at org.apache.jasper.runtime.HttpJspBase.service(Unknown Source)
    WARNING: CORE3283: stderr: at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    WARNING: CORE3283: stderr: at com.iplanet.ias.web.jsp.JspServlet$JspServletWrapper.service(Unknown Source)
    WARNING: CORE3283: stderr: at com.iplanet.ias.web.jsp.JspServlet.serviceJspFile(Unknown Source)
    WARNING: CORE3283: stderr: at com.iplanet.ias.web.jsp.JspServlet.service(Unknown Source)
    WARNING: CORE3283: stderr: at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    WARNING: CORE3283: stderr: at org.apache.catalina.core.StandardWrapperValve.invokeServletService(Unknown Source)
    WARNING: CORE3283: stderr: at org.apache.catalina.core.StandardWrapperValve.access$000(Unknown Source)
    WARNING: CORE3283: stderr: at org.apache.catalina.core.StandardWrapperValve$1.run(Unknown Source)
    WARNING: CORE3283: stderr: at java.security.AccessController.doPrivileged(Native Method)
    WARNING: CORE3283: stderr: at org.apache.catalina.core.StandardWrapperValve.invoke(Unknown Source)
    WARNING: CORE3283: stderr: at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source)
    WARNING: CORE3283: stderr: at org.apache.catalina.core.StandardContextValve.invoke(Unknown Source)
    WARNING: CORE3283: stderr: at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source)
    WARNING: CORE3283: stderr: at org.apache.catalina.core.StandardHostValve.invoke(Unknown Source)
    WARNING: CORE3283: stderr: at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source)
    WARNING: CORE3283: stderr: at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(Unknown Source)
    WARNING: CORE3283: stderr: at com.iplanet.ias.web.WebContainer.service(Unknown Source)

    Please configure the classloader to delegate to the parent loader by specifying the following in WEB-INF/sun-web.xml (the Sun ONE Application Server specific deployment descriptor for web applications)
    <class-loader delegate="true"/>
    More information on this can be found at
    http://docs.sun.com/source/816-7150-10/dwdeploy.html#48102
    Thanks,
    Arvind

  • Caught an unexpected exception! java.lang.ClassCastException at com.sun.cor

    Hi,
    Iam struggling with this problem from last 3days.
    Any body could u help me to solve this problem.
    error:
    Caught an unexpected exception!
    java.lang.ClassCastException at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow (PortableRemoteObject.java:293)
    at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:134)
    at ConverterClient.main(ConverterClient.java:59)
    Client Code is here:
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.rmi.PortableRemoteObject;
    import java.util.Properties;
    import javax.ejb.CreateException;
    import java.util.Hashtable;
    // NOT NECESSARY import Converter;
    // NOT NECESSARY import ConverterHome;
    public class ConverterClient {
    public static void main(String[] args) {
    try {
    Properties env = new Properties();
              env.put("java.naming.factory.initial","com.sun.jndi.cosnaming.CNCtxFactory");
              env.put("java.naming.provider.url", "iiop://localhost:3700");
              Context initial = new InitialContext(env);
         ConverterHome home =(ConverterHome)PortableRemoteObject.narrow(initial.lookup("MyConverter"),ConverterHome.class);
    // Create converter session bean
    Converter currencyConverter = home.create();
    // Calculate from dollars to yen
    double amount = currencyConverter.dollarToYen(100.00);
    System.out.println("100 Dollars is " + String.valueOf(amount) + " Yen");
    // Calculate from yen to dollars
    amount = currencyConverter.yenToEuro(100.00);
    System.out.println("100 Yen is " + String.valueOf(amount) + " Dollars");
    } catch (Exception ex) {
    System.err.println("Caught an unexpected exception!");
    ex.printStackTrace();

    Hi,
    I have a stateless bean and accessing it from a jsp page in Orion App Server. There is no problem in the deployment. of the application.
    When I access the bean from the jsp page is throwing
    java.lang.ClassCastException
    at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(Unknown Source)
    The code is :
    Object homeObject = null;
    homeObject = ctx.lookup("LoginHome");
    out.println(homeObject.toString());
    LoginHome ejbHome = (LoginHome)PortableRemoteObject.narrow(homeObject,LoginHome.class);
    Login login = ejbHome.create();
    when I use the statement
    homeOject.toString() to print the object it prints
    LoginHome EJBHome
    I am not able to resolve this for th epast three days.
    Thanks,
    Vivek S

  • Jpql - multi expressions in select query, java.lang.ClassCastException:

    Hello, i'm trying to get a Unit object from the query below.
    i am getting javax.ejb.EJBException in this method
    @NamedQuery(name = "getUnitIdUnitName", query = "SELECT u.unitId,u.unitName FROM Unit u "+ "ORDER BY u.unitName")
    public Unit getUnitsComboBox() {
    //get UnitId, UnitName from Units.
    Unit unitIDUnitName =(Unit) ((List<Object[]>)em.createNamedQuery("getUnitIdUnitName").getResultList()).get(0)[0];
    return unitIDUnitName;
    Caused by: java.lang.ClassCastException: java.lang.Long cannot be cast to mmis.entity.Unit
    Must i use an iterator ?
    Thanx

    Amasoni wrote:
    Hello, i'm trying to get a Unit object from the query below.
    i am getting javax.ejb.EJBException in this method
    @NamedQuery(name = "getUnitIdUnitName", query = "SELECT u.unitId,u.unitName FROM Unit u "+ "ORDER BY u.unitName")
    public Unit getUnitsComboBox() {
    //get UnitId, UnitName from Units.
    Unit unitIDUnitName =(Unit) ((List<Object[]>)em.createNamedQuery("getUnitIdUnitName").getResultList()).get(0)[0];
    return unitIDUnitName;
    Caused by: java.lang.ClassCastException: java.lang.Long cannot be cast to mmis.entity.Unit
    ThanxYou don't want to select the columns, you want to select the object itself.
    SELECT u FROM Unit u ORDER BY u.unitName
    or even shorter:
    FROM Unit u ORDER BY u.unitName
    Try to reason where to put your question by the way, it is not about Javaserver Faces. If you can't find a forum that clearly matches consider putting it in Java Programming. In this case it was entirely unnecessary since you already posted JPA questions in the EJB forum, which is a decent match.

  • 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.

Maybe you are looking for