ClassCastException with SignedObject

I have a signed object which I store as a blob in an sql database. In order to retrieve the signed object, i do the following:
String driver = "org.gjt.mm.mysql.Driver";
String url = "jdbc:mysql://127.0.0.1:3306/database";
Class.forName(driver);
connection = DriverManager.getConnection(url,"user", "pass");
Statement stmt = connection.createStatement();
String query = "select * from registered_doctor;";
ResultSet result = stmt.executeQuery( query );
while( result.next() )
    String str = result.getString( "id" );
    Object obj = result.getObject( "token" );
    System.out.println( "Id: " + str + "; token: " + obj.toString() );
    SignedObject so = (SignedObject) obj;
}Under windows, this code works perfectly, I can then pass the signed object to other methods.
I am porting my code to Linux platforms, and the operation
    SignedObject so = (SignedObject) obj;Throws an exception:
Id: 12; token: [B@161d36b
java.lang.ClassCastException
        at Connect.getConn(Connect.java:71)
        at Connect.main(Connect.java:11)I have no idea what is wrong, and suspecting Classpath problems, but I was hoping for some guidance.
Many thanks
Seb

Okay, clearly you pointed out my problem:
Id: 22; token: [B@161d36b
Actual object class: class [B
Expected object class: class
java.security.SignedObjectWhat can I do?Like I said in my second reply, I'd suggest you store fields that make up the object, not the object itself in the database.

Similar Messages

  • Problem with SignedObject.

    Hello!
    PROBLEM:
    1. There is java.security.SignedObject in JDK 1.3, it may be signed Private key and after checked with Public key.
    2. I serialized this object in file �so.ser�. After some time deserialized and call verify(public key, ..), it return true, it's ok, but if I try read SignedObject from jar, call verify(public key, ..) it always return false. Although method getObject() return correct String from SignedObject. How can I solve this puzzle?
    I need only one jar which contain code and �so.ser� with SignedObject, public key come from anywhere and code check SignedObject.
    I used:
    1. ObjectInputStream objectinputstream = new
    ObjectInputStream( RMIServer.class.getClassLoader().getSystemClassLoader().getResourceAsStream("so.ser"));
    SignedObject so = (SignedObject)
    objectinputstream.readObject();
    boolean ok = so.verify(publicKey,...); (false)
    2. objectinputstream = new ObjectInputStream(
    RMIServer.class.getResourceAsStream("/so.ser"));
    boolean ok = so.verify(publicKey,...); (false)
    3. Thread t = Thread.currentThread();
    ClassLoader cl = t.getContextClassLoader();
    objectinputstream = new ObjectInputStream(
    cl.getResourceAsStream("so.ser"));
    boolean ok = so.verify(publicKey,...); (false)
    From file system everything is all right, from jar - NOT.
    ObjectInputStream objectinputstream = new
    ObjectInputStream( new File("so.ser"));
    SignedObject so = (SignedObject)
    objectinputstream.readObject();
    boolean ok = so.verify(publicKey,...); (true)
    Vadim.

    Try to use this.getClass() instead of RMIServer.class. It will ensure that you retrieve the resource from the correct classloader context.

  • ERROR:JAVA.LANG.CLASSCASTEXCEPTION WITH JDEVELOPER 10.0.1.3

    I´m trying to use JSTL functions but I have the error
    "Error:java.lang.ClassCastException with JDeveloper 10.0.1.3".
    When I make or rebuild the code I have the error.
    The test <c:when test="${fn:length(P_LIGACOES) > 0}" > has error. I´ve been
    used others functions and the error is the same.
    Please, see JSP code as follows:
    <%@ page import="java.text.DateFormat"%>
    <%@ page import="java.text.SimpleDateFormat"%>
    <%@ page import="java.text.NumberFormat"%>
    <%@ page import="com.celesc.tf.BilheteTelefonico"%>
    <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>Ligações Telefônicas</title>
    <style type="text/css">
    Body{
    background-image: url(images/fdo.jpg);
    background-repeat: no-repeat;
    background-color: #FFFFFF;
    </style>
    <link href="css/ligtel.css" rel="stylesheet" type="text/css">
    </head>
    <body>
    <h1 align=center> </h1>
    <h1 align=center> </h1>
    <c:choose>
    <c:when test="${!empty mensagem}">
    <h1 align=center>
    <img src="images/erro.jpg"><font size="5" face="Verdana, Arial, Helvetica,
    sans-serif"><c:out value="${mensagem}"/></font></h1>
    </c:when>
    <c:otherwise>
    <%
    Vector ligacoes = (Vector) request.getAttribute("P_LIGACOES");
    SimpleDateFormat formato = new SimpleDateFormat("dd/MM/yyyy
    HH:mm:ss");
    double totalligacoes = 0;
    NumberFormat preco = NumberFormat.getCurrencyInstance();
    %>
    <c:choose>
    <c:when test="${fn:length(P_LIGACOES) > 0}" >
    <h1 align=center><font size="5" face="Verdana, Arial, Helvetica,
    sans-serif">Nenhuma ligação Realizada</font></h1>
    </c:when>
    <c:otherwise>
    <h1 align=center><font size="5" face="Verdana, Arial, Helvetica,
    sans-serif">Relação das Ligações</font></h1>
    <table class="table-normal" width="70%" align="center">
    <tr class="table-result">
    <td colspan="5"><b><%= ligacoes.size()%> </b> Ligações Realizadas</td>
    </tr>
    <tr class="table-title">
    <td>Fone Chamado</td>
    <td>Ramal</td>
    <td>Data</td>
    <td>Duração</td>
    <td>Custo(R$)</td>
    </tr>
    <c:forEach items="${P_LIGACOES}" var="bilhete">
    <tr class="table-content">
    <td><c:out value="${bilhete.numeroChamado}"/></td>
    <td><c:out value="${bilhete.ramalOrigem}"/></td>
    <td><c:out value="${bilhete.dataLigacao}"/></td>
    <td><c:out value="${bilhete.duracao}"/></td>
    <!--<td><c:out value="${bilhete.custo}"/></td>-->
    <td><c:out value="${bilhete.custo}"/></td>
    <c:set var="totalligacoes" value="${totalligacoes +
    bilhete.custo}"/>
    </tr>
    </c:forEach>
    <tr class="table-result">
    <td colspan="4" align="right"><B>Total</B></td>
    <!-- <td ><B><%= preco.format(totalligacoes)%></B></td> -->
    <td><B><c:out value="${totalligacoes}" /></B></td>
    </tr>
    </table>
    </c:otherwise>
    </c:choose>
    </c:otherwise>
    </c:choose>
    </body>
    </html>

    Hi,
    Please make sure that there is no other version of *"net.nrj.alf.DimensionLabel"* class present in any other Class Loader
    There are various kind of Class Loaders : PreMordial Class Loader, BootStrap ClassLoader, System Class Loader (WebLogic ClassLoader), Application ClassLoader, Module Class Loader....
    net.nrj.service.SearchServiceProcessor java.lang.ClassCastException: net.nrj.alf.DimensionLabel java.lang.ClassCastException: net.nrj.alf.DimensionLabel If your code is working fine in WLS9.2 it means in WLS10.3.3 the same class is getting loaded from different Class Loaders...In order to find out which classLoader is being used to load that class please do the following:
    <b><font color=maroon>
    Class dimentionLevel=Class.forName("net.nrj.alf.DimensionLabel")
    ClassLoader cl=dimentionLevel.getClassLoader();
    System.out.println("\n\n\t DimentionLevel is loaded from ClassLoader: "+cl);
    </font></b>
    Above 3 Lines of code you need to write for "net.nrj.service.SearchServiceProcessor" class as well...Because i suspect that these two classes are getting loaded from two different class Loaders.
    If the Application Code is 100% correct The Main reason of ClassCastException is Classes are getting Loaded from two Different Class Loaders. You can also look at the Filtering ClassLoader Feature of WebLogic to Tell WebLogic to Load some Classes from a Specific ClassLoaders...As described Here .*http://middlewaremagic.com/weblogic/?page_id=192*
    Thanks
    Jay SenSharma
    http://middlewaremagic.com/weblogic/?page_id=2261  (Middleware magic Is Here)

  • ClassCastException with javax.jms.ObjectMessage

    Hello
              I have the following problem:
              I filled a JMS queue with ObjectMessages containing a so called container class (self written, plain old java class implementing serializable).
              I have also written a Servlet that runs in the same EAR like the EJB that fills the JMS queue. This servlet uses a JMS QueueBrowser to show the messages. It casts the Message to ObjectMessage, calls getObject() and casts again in my container class.
              Now when I shutdown the server, regenerate my source and restart the server, the last cast to my container class doesn't work anymore (ClassCastException). When I print out the hash value of the class (containerFromObjectMessage.getClass().hashCode() and Container.class.hashCode() those two hashcodes are different!
              Does anybody have an idea? Is there a switch that I have to set to my WLS 8.1 be a little less secure?
              Regards,
              Stephan

    Correction:
              This only happens when I don't restart my server. So when I hot deploy the EAR with the new compiled classes it doesn't work (ClassCastException). But when I restart the server the servlet runs fine.
              So there must be a cache in the server or something like that.
              Does anybody know any hints or tips to help me?
              Stephan

  • ClassCastException with OracleConnection in Oracle 9i

    I have a piece of code that works perfectly with Oracle 8i and JDK 1.3.
    Now I've migrated to Oracle 9i and JDK 1.4. I continue working with tomcat and I've configured server.xml file (some changes about 'url' and 'username').
    I get a ClassCastException when I try to make a explicit cast to OracleConnection of the connection object recovered. This is the code:
    public class CargadorRecursos {
         public Connection devuelveConexion()
              throws javax.naming.NamingException, SQLException {
              Context envContext = devuelveContexto();
              DataSource ds = (DataSource) envContext.lookup("jdbc/prosegur");
              Connection conn = ds.getConnection();
              return conn;
    in another classes I do:
    OracleConnection conn = (OracleConnection) CargadorRecursos.getCargador().devuelveConexion();
    and then the ClassCastException is raised in the web browser.
    Please, help.

    Cast class exception means you are trying to cast an object to something that it can't be case too.
    You can determine the actual class of an instance by doing the following...
    System.out.println("class=" + myinstance.getClass().getName());
    Once you know the class that actually is being used you can determine the course of action to take...
    1. It isn't the class that you think it is, something is wrong with your code.
    2. Something changed outside of your code and you will have to code around the problem.
    3. Class loaders are being used and you are using class instances from two different class loaders - use the same class loader.

  • HELP!! ClassCastException with custom module classloader hierarchy and redeployment

    Hi,
    I am defining custom module classloader hierarchy to avoid redeploying of the
    entire application mainly because we have so many EJBs and it takes a long time
    to deploy the entire app. I deploy my app using the exploded directory, add a
    new method to an EJB in my dal.jar, redeploy, run my unittest and I get ClassCastException.
    I am using weblogic.Deployer utility to reploy my module using "-targets dal.jar@accsserver"
    argument. I even tried undeploying that module and redeploy again with no luck.
    here is weblogic-application.xml definition of the custom class loader
    <classloader-structure>
    <module-ref>
         <module-uri>floghmi.war</module-uri>
         </module-ref>
    <module-ref>
         <module-uri>cts.jar</module-uri>
         </module-ref>
    <module-ref>
         <module-uri>fdbs.jar</module-uri>
         </module-ref>
    <classloader-structure>
         <module-ref>
              <module-uri>dml.jar</module-uri>
         </module-ref>
    <classloader-structure>
         <module-ref>
         <module-uri>dal.jar</module-uri>
    </module-ref>
    </classloader-structure>
    </classloader-structure>
    </classloader-structure>
    thanks,
    Nasrin

    Rob,
    regarding your question on redeploying the whole app without the classloader
    structure, yes, that works fine. If I change a class and redeploy the whole app,
    things are ok. However, when I speocify the classloader structure, and try to
    redeploy the dal.jar, I get ClassClasException.
    You are right about dml.jar being in a separate classloader. I have changed my
    structure after I posted my question to load dml.jar from the application classloader.
    So Rob, is there a bug in Weblogic 8.1 that causes this exception?
    please let me know, I am anxiously waiting your response.
    thanks,
    Nasrin
    Rob Woollen <[email protected]> wrote:
    >
    >
    Nasrin Azordegan wrote:
    Rob,
    if I remove my classloader structure from weblogic-application.xml,I get an
    error during redeployment, saying "You must include all of<list ofmy module names
    here> in your files list to modify <dal.jar>. Yes, the server enforces constraints on partial redeployments. You must
    deploy all the modules in a given classloader and any modules in child
    classloaders.
    Just to make sure, if you initially deploy your app, or redeploy the
    whole thing, it works fine without the classloader-structure, right?
    The problem I am trying to solve is to minimize our deployment time.Our application
    has over 700 CMP 2.0 entity beans and 200 session beans. Our applicationdeployment
    follows the J2EE layer architecture. The data mapping layer which consistof 700
    entity beans are located in dml.jar. The data access layer which consistof 200
    session beans are located in dal.jar. We create our ear with thesetwo jar files
    plus some other framework jars and deploy on bea weblogic 8.1 SP2 andthat takes
    about an hour. I need to be able to modify a session bean, i.e. changethe implementation
    of a session bean or add a new method to a session bean interface andredeploy
    only data access layer, the dal.jar, not the entity beans. This explainswhy you
    see dml.jar in a classloader with a child classloader that loads dal.jar.
    I included the ClassCastException from weblogic server console below.What is
    happening is that I have a session bean with 6 methods that just doesa println.
    I deploy my session bean, ExerciseSessionBeanFactory, and run my unittest that
    invokes test1 through test6 methods. I modify my bean to add "test7"method and
    redeply dal.jar successfully. I run my unit test that invokes test1through test7
    methods and then I get a ClassCastException.
    I hope this helps. Please let me know if you need more details.If you push dml.jar into a subloader, that means you can change dml.jar
    without touching anything in the parent loader. However, it also means
    that you've isolated it's classes and other modules can't see them.
    -- Rob
    thanks,
    Nasrin
    in test method
    in test2 method
    in test3 method
    in test4 method
    in test5 method
    in test6 method
    <Apr 12, 2004 9:26:03 AM PDT> <Warning> <EJB> <BEA-010096> <The Message-Driven
    EJB: SimTimeListener is unable to connect
    to the JMS destination: cn=t.cms.cts.simTimeInfo. Connection failedafter 184
    attempts. The MDB will attempt to reconne
    ct every 10 seconds. This log message will repeat every 600 secondsuntil the
    condition clears.>
    <Apr 12, 2004 9:26:03 AM PDT> <Warning> <EJB> <BEA-010061> <The Message-Driven
    EJB: SimTimeListener is unable to connect
    to the JMS destination: cn=t.cms.cts.simTimeInfo. The Error was:
    [EJB:011011]The Message-Driven EJB attempted to connect to the JMSdestination
    with the JNDI name: cn=t.cms.cts.simTimeI
    nfo. However, the object with the JNDI name: cn=t.cms.cts.simTimeInfois not a
    JMS destination, or the destination found
    was of the wrong type (Topic or Queue).>
    in test method
    in test2 method
    in test3 method
    in test4 method
    in test5 method
    in test6 method
    <Apr 12, 2004 9:28:26 AM PDT> <Warning> <RMI> <BEA-080003> <RuntimeExceptionthrown
    by rmi server: com.trs.cv.infr.istr.
    sc.sim.factory.ejb.ExerciseSessionFactory_zhotso_EOImpl.test7()
    java.lang.ClassCastException.
    java.lang.ClassCastException
    at com.trs.cv.infr.istr.sc.sim.factory.ejb.ExerciseSessionFactory_zhotso_EOImpl_WLSkel.invoke(Unknown
    Source)
    at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:477)
    at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java:108)
    at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:420)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:353)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:144)
    at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:415)
    at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:30)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
    Rob Woollen <[email protected]> wrote:
    You'll have to give me some more information on the ClassCastException.
    Where does it happen? Print out the classnames and the
    classloaders of the 2 objects.
    Does everything work fine if you remove your classloader-structure?
    -- Rob
    Nasrin Azordegan wrote:
    Hi,
    I am defining custom module classloader hierarchy to avoid redeployingof the
    entire application mainly because we have so many EJBs and it takesa long time
    to deploy the entire app. I deploy my app using the exploded directory,add a
    new method to an EJB in my dal.jar, redeploy, run my unittest and
    I
    get ClassCastException.
    I am using weblogic.Deployer utility to reploy my module using "-targetsdal.jar@accsserver"
    argument. I even tried undeploying that module and redeploy again
    with
    no luck.
    here is weblogic-application.xml definition of the custom class loader
    <classloader-structure>
    <module-ref>
         <module-uri>floghmi.war</module-uri>
         </module-ref>
    <module-ref>
         <module-uri>cts.jar</module-uri>
         </module-ref>
    <module-ref>
         <module-uri>fdbs.jar</module-uri>
         </module-ref>
    <classloader-structure>
         <module-ref>
              <module-uri>dml.jar</module-uri>
         </module-ref>
    <classloader-structure>
         <module-ref>
         <module-uri>dal.jar</module-uri>
    </module-ref>
    </classloader-structure>
    </classloader-structure>
    </classloader-structure>
    thanks,
    Nasrin

  • ClassCastException with ClassLoader issues

    I'm using JBoss 3.2.3, with Kodo 3.1.0
    After doing a hot deploy in JBoss, ClassCastExceptions start occuring.
    String filter = "reference==param1";
    Extent extent = pm.getExtent(Customer.class, false);
    KodoQuery query = (KodoQuery) pm.newQuery(extent, filter);
    Collection col = null;
    try {
    query.declareParameters("String param1");
    col = (Collection) query.execute("x34c");
    if (col.isEmpty())
    return null;
    Customer cust = (Customer) col.iterator().next();
    finally {
    if (query != null)
    query.close(col);
    At the line: Customer cust = (Customer) col.iterator().next();
    a ClassCastException is thrown. The class loader for Customer.class point
    to the deployed ear file, whilst the loader for
    col.iterator().next().getClass() points to null.
    Now, what is even more interesting is if I amend the above code slightly:
    Extent extent = pm.getExtent(Customer.class, false);
    KodoQuery query = (KodoQuery) pm.newQuery(extent);
    Collection col = null;
    try {
    col = (Collection) query.execute();
    if (col.isEmpty())
    return null;
    Customer cust = (Customer) col.iterator().next();
    finally {
    if (query != null)
    query.close(col);
    With the above, everything works fine. The only difference is that one
    uses a filter to retrieve a particular object from the datastore, and the
    other retrieves all objects from the datastore. I don't understand why it
    throws a ClassCastException in one instance and not the other. Note that
    this only happens after a hot deploy.
    This problem only surfaced recently after I added a few more classes to be
    persistent capable. After adding a further two classes, the
    ClassCastException moved to another class.
    Can anyone explain this?
    Cheers

    A N-
    Did you make absolutely sure that you enhanced all of the new classes
    and deployed them to correctly, and that you have clobbered any caches
    JBoss may have to any of the old .ear files?
    It might be the case that when you obtain the first in the list of all
    the Customer instances, it doesn't have a relation to one of the new
    classes, or its concrete instance is not one of the new classes, as
    opposed to when you execute the filter.
    If this doesn't help, can you provide us with some more information? At
    a minimum, a complete stack trace is usually a prerequisite for being
    able to diagnose problems like this.
    In article <[email protected]>, A N wrote:
    >
    I'm using JBoss 3.2.3, with Kodo 3.1.0
    After doing a hot deploy in JBoss, ClassCastExceptions start occuring.
    String filter = "reference==param1";
    Extent extent = pm.getExtent(Customer.class, false);
    KodoQuery query = (KodoQuery) pm.newQuery(extent, filter);
    Collection col = null;
    try {
    query.declareParameters("String param1");
    col = (Collection) query.execute("x34c");
    if (col.isEmpty())
    return null;
    Customer cust = (Customer) col.iterator().next();
    finally {
    if (query != null)
    query.close(col);
    At the line: Customer cust = (Customer) col.iterator().next();
    a ClassCastException is thrown. The class loader for Customer.class point
    to the deployed ear file, whilst the loader for
    col.iterator().next().getClass() points to null.
    Now, what is even more interesting is if I amend the above code slightly:
    Extent extent = pm.getExtent(Customer.class, false);
    KodoQuery query = (KodoQuery) pm.newQuery(extent);
    Collection col = null;
    try {
    col = (Collection) query.execute();
    if (col.isEmpty())
    return null;
    Customer cust = (Customer) col.iterator().next();
    finally {
    if (query != null)
    query.close(col);
    With the above, everything works fine. The only difference is that one
    uses a filter to retrieve a particular object from the datastore, and the
    other retrieves all objects from the datastore. I don't understand why it
    throws a ClassCastException in one instance and not the other. Note that
    this only happens after a hot deploy.
    This problem only surfaced recently after I added a few more classes to be
    persistent capable. After adding a further two classes, the
    ClassCastException moved to another class.
    Can anyone explain this?
    Cheers
    Marc Prud'hommeaux [email protected]
    SolarMetric Inc. http://www.solarmetric.com

  • ClassCastException with Local Interfaces

    Hi,
    My environment is
    WLS6.1SP3 (JDK131)
    DB2 7.1
    Windows 2000
    I am trying to access an entity bean through it's local interface from a stateless session bean. I can see the jndi tree contains both remote and local names. I get the correct local home object from the lookup, howevere when I cast it to LocalHome, I get ClassCastException.
    Any help would be greatly appreciated.
    Thanks.
    zahid

    Thanks for your comments. In case of clustered
    anvironment doesn't each node has it's own startup
    script which could contain these local inerfaces ?Yes, it has , but again if you deploy ear to clustered environment everything will get propagated to participating nodes.
    If you put jar with interfaces in classpath of each node you will have hard time to do hot deployment ( you can't ) and to keep things in sync.
    >
    I tried ear and it worked fine too.
    However I still got the problem as it worked on
    windows 2000 but doesn't work on aix where we want to
    deploy it.if it is same setting as win box it shouldn't have problem

  • ClassCastException with PortableRemoteObject.narrow call

    I want to call an ejb component located on a different machine and I can not get it to work. So I tried to deploy it under my version of jboss and try to invoke it. I was able to call it but when I added Context.PROVIDER_URL to my properties I get a classCastException.
    String host = "jnp://localhost:1099";
    props.setProperty(Context.PROVIDER_URL, host);
    I started getting the following exception
    2006-11-03 10:17:18,319 ERROR [STDERR] java.lang.ClassCastException
    2006-11-03 10:17:18,319 ERROR [STDERR]      at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narr
    ow(PortableRemoteObject.java:229)
    2006-11-03 10:17:18,319 ERROR [STDERR]      at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObjec
    t.java:137)
    As soon as I uncomment that props.setProperty(Context.PROVIDER_URL, host);
    line everything works fine.
    I have seen this type of exception before when I tried invoking the ejb on a different computer as well. When I inspect the object with reflection I see that it found the right interface.
    This is my code again:
    Properties props = new Properties();
    props.setProperty(Context.INITIAL_CONTEXT_FACTORY,"org.jboss.security.jndi.JndiLoginInitialContextFactory");
    props.setProperty(Context.SECURITY_PRINCIPAL, "admin");
    props.setProperty(Context.SECURITY_CREDENTIALS, "admin");
    props.put(javax.naming.Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
    String host = "jnp://localhost:1099";
    props.setProperty(Context.PROVIDER_URL, host);
    ctx = new InitialContext( props );
    Object object = ctx.lookup( "ejb/com/blah/Manager" );
    ManagerRemoteHome home = (ManagerRemoteHome)PortableRemoteObject.narrow ( object, ManagerRemoteHome.class);
    ManagerRemote manager = home.create();
    Thanks

    1099 is the RMI/JRMP Registry. You are using RMI/IIOP. Is this port number really correct?

  • ClassCastException with Document

    I have an abstract class implements DOM Document.
    public abstract class XDataDoc implements Document {
    I get ClassCastException when I try to parse and XML.
    public XDataDoc xDataDoc ;
    factory = DocumentBuilderFactory.newInstance();
    parser = factory.newDocumentBuilder();
    xDataDoc = parser.parse("http://url");
    I have the same problem also with the classes implements Node or NodeList. I need this custom Document to use as a data source.
    What am I doing wrong? Is there a better way than creating a class implements Document? (Shall I create an interface extends?)
    Any help about extends / implements abstract classes and interfaces will be great useful. (I am still a newbie as you will understand)
    Thanks in advance.

    I have to prepare too many screens for data entry in a
    web application.
    I have an Oracle 8i database and servlets creating xml
    from database and receiving xml to write to database.
    Xml created with servlets have all similar schema as
    master row and detail rows as childnode of master.
    Idea is to create also custom swing objects (such as
    JTextField, JcomboBox, Jlist etc) that can work bound
    to DOM document. So creating screens will be easy as
    easy as placing swing objects on layout.
    I forget to mention also that gives the same
    exception:
    xDataDoc = (XDataDoc) parser.parse("http://url");
    Those requirements you describe have nothing to do with your problem, though, and I don't see where they require you to implement Document. In fact you can't implement Document because the parser has already done it for you. Your code needs to look like this:
    Document xDataDoc = parser.parse("http://url");

  • ClassCastException with t:datatable

    Hi
    I am using apache myfaces and trying to use its datatable with preserveDataModel=true attribute. I get the following exception when I click on a command link inside the datatable -
    [Servlet Error]-[Faces Servlet]: java.lang.ClassCastException: javax.faces.model.ListDataModel incompatible with org.apache.myfaces.component.html.ext._SerializableDataModel
    I do have the latest tomahawk-1.1.3.jar which is supposed to have one fix mentioned on tihs issue.
    Reading the doc on JSF datatable it seems like the datamodel is not serializable for pure JSF. So how do I get the datamodel to be a subclass of what myfaces is looking for?
    Any pointers wold be very helpful.
    Thanks

    Well here is a code snippet that works fine:
    extract of JSP-page:
    =============
    <h:dataTable value="#{usrctrl.userList}" var="user" rowClasses="odd, even"
                 styleClass="datatable" align="center">
        <h:column>
            <f:facet name="header">
                <h:outputText value="#{msg['name.first']}" />
            </f:facet>
            <h:outputText value="#{user.firstName}" />
        </h:column>
    </h:datatable>source of usrctrl:
    ===========
        public java.util.List<User> getUserList () {
            java.util.List<User> users = new ArrayList ();
            users.addAll (userControl.getUsers ()); // get data from backeind
            return users   
    ...interface of userControl:
    ================
        public java.util.List<User> getUsers () {Class user has to implement a method named public String getFirstName().
    Hope that gets you further.
    Regards Mark

  • ClassCastException with webservices with arrays

    Hi,
    I am trying to call a webservice from Fuego, where one of the webservice parameter is an array of string, which causes problems (when I remove this paramter everything works fine)
    When I invoke the call, I get the following ClassCastException.
    Could this be a bug of Fuego?
    Thank you
    Lui
    Details:
    The method 'CIL_mailAutorizado' from class 'BEA_Systems__Inc__.SolicitaCajeros.Default_1_0.Instance' could not be successfully executed.
    Caused by: java.lang.ClassCastException
    fuego.lang.ComponentExecutionException: The method 'CIL_mailAutorizado' from class 'BEA_Systems__Inc__.SolicitaCajeros.Default_1_0.Instance' could not be successfully executed.
         at fuego.component.ExecutionThreadContext.invokeMethod(ExecutionThreadContext.java:496)
         at fuego.component.ExecutionThreadContext.invokeMethod(ExecutionThreadContext.java:249)
         at fuego.fengine.FEEngineExecutionContext.invokeMethodAsCil(FEEngineExecutionContext.java:216)
         at fuego.server.execution.EngineExecutionContext.runCil(EngineExecutionContext.java:1068)
         at fuego.server.execution.TaskExecution.invoke(TaskExecution.java:391)
         at fuego.server.execution.TaskExecution.executeCIL(TaskExecution.java:475)
         at fuego.server.execution.TaskExecution.executeTask(TaskExecution.java:649)
         at fuego.server.execution.TaskExecution.executeTask(TaskExecution.java:610)
         at fuego.server.execution.TaskExecution.executeTask(TaskExecution.java:152)
         at fuego.server.execution.activities.XAutomatic.execute(XAutomatic.java:54)
         at fuego.metadata.Activity.execute(Activity.java:1019)
         at fuego.server.execution.ToDoItemAutomatic.execute(ToDoItemAutomatic.java:35)
         at fuego.server.execution.DefaultEngineExecution$AtomicExecutionTA.runTransaction(DefaultEngineExecution.java:290)
         at fuego.transaction.TransactionAction.startBaseTransaction(TransactionAction.java:465)
         at fuego.transaction.TransactionAction.startTransaction(TransactionAction.java:543)
         at fuego.transaction.TransactionAction.start(TransactionAction.java:216)
         at fuego.server.execution.DefaultEngineExecution.executeImmediate(DefaultEngineExecution.java:116)
         at fuego.server.execution.DefaultEngineExecution.executeAutomaticWork(DefaultEngineExecution.java:56)
         at fuego.server.execution.EngineExecution.executeAutomaticWork(EngineExecution.java:42)
         at fuego.server.execution.ToDoItem.executeAutomaticWork(ToDoItem.java:265)
         at fuego.server.execution.ToDoItem.run(ToDoItem.java:536)
         at fuego.component.ExecutionThread.processMessage(ExecutionThread.java:752)
         at fuego.component.ExecutionThread.processBatch(ExecutionThread.java:732)
         at fuego.component.ExecutionThread.doProcessBatch(ExecutionThread.java:138)
         at fuego.component.ExecutionThread.doProcessBatch(ExecutionThread.java:130)
         at fuego.fengine.ToDoQueueThread$PrincipalWrapper.processBatch(ToDoQueueThread.java:429)
         at fuego.component.ExecutionThread.work(ExecutionThread.java:816)
         at fuego.component.ExecutionThread.run(ExecutionThread.java:395)
    Caused by: java.lang.ClassCastException
         at fuego.soaptype.SoapCall.fixInputArguments(SoapCall.java:303)
         at fuego.soaptype.SoapCall.invoke(SoapCall.java:242)
         at fuego.soaptype.SoapObject.invoke(SoapObject.java:283)
         at fuego.lang.Invokeable.invokeImpl(Invokeable.java:220)
         at fuego.lang.Invokeable.invoke(Invokeable.java:161)
         at BEA_Systems__Inc__.SolicitaCajeros.Default_1_0.Instance.CIL_mailAutorizado(Instance.java:2112)
         at BEA_Systems__Inc__.SolicitaCajeros.Default_1_0.Instance.CIL_mailAutorizado(Instance.java:2156)
         at sun.reflect.GeneratedMethodAccessor75.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at fuego.component.ExecutionThreadContext.invokeMethod(ExecutionThreadContext.java:489)
         ... 27 more

    Meanwhile, most suggestions offered for my original
    post add a type parameter for the inner class Entry.
    If I created an Entry object instead of an array of
    Entry objects, no type parameter would be necessary.
    Why should this not work for arrays?
    Not entirely sure I follow you, but this version, which is close to your original proposition will not compile:
    public class EntryArray<T> {
        private Entry[] data;
        public EntryArray() {
            data = new Entry[20];
        public void setValueAt(T value, int idx) {
            data[idx] = new Entry(value);
        public T getValueAt(int idx) {
            return data[idx].field;
        private class Entry {
            private final T field;
            private Entry(T newField) {
                field = newField;
      public static void main(String[] args) {
            EntryArray<String> thing = new EntryArray<String>();
            thing.setValueAt("foo",0);
            System.out.println(thing.getValueAt(0));   
    EntryArray.java [17:1] generic array creation
            data = new Entry[20];Obviously here we've made Entry a NON-static inner class again, thus every Entry has an enclosing EntryArray<T> and thus the compiler can't generate array creation code for it, not knowing what T is.
    If you're asking why this is, I believe the answer has to do with the way memory is allocated when an array is initialized. It needs to know what 'T' actually is to do it, and it can't know this because T has been erased. Perhaps someone else can provide a precise explanation?

  • ClassCastException with Crypto.provider.SunJCE

    Hi
    I was using JCE_1_2_1.jar in jdk1.3.1,as it expiers on Jul 27 ,i replace all with the new jar i,e JCE1_2_2.jar,sunprovider.jar,LocalPolicy.jar ,USExportpolicy.jar.My server startup is not a problem, when i run my class it gives ERROR
    Failed to create "Credential.java.lang.ClassCastException:com.sun.crypto.provider.SunJCE"
    Can nay one please help me?

    My JCE code worked in a "standalone" class; but not inside a servlet deployed with the Tomcat that comes with the JWSDP.
    Know it works in both places.. what I've done is to copy the four JCE jars in the directory
    c:\jwsdp-1.1\common\lib
    does somebody knows a better way to include JARs in JWSDP environment??
    I�ve modified the next line in catalina.bat including %CLASSPATH% with no success
    "%JAVA_HOME%\bin\java.exe" -classpath %PRG%\..;%PRG%\..\..\jwsdp-shared\bin;"%PRG%\..\..\jwsdp-shared\bin\commons-launcher.jar";"%PRG%\..\..\jakarta-ant-1.5.1\lib\ant.jar";"%PRG%\..\..\jakarta-ant-1.5.1\lib\optional.jar";"%PRG%\..\..\jaxp-1.2.2\lib\jaxp-api.jar";"%PRG%\..\..\jaxp-1.2.2\lib\endorsed\sax.jar";"%PRG%\..\..\jaxp-1.2.2\lib\endorsed\dom.jar";"%PRG%\..\..\jaxp-1.2.2\lib\endorsed\xercesImpl.jar";"%PRG%\..\..\jaxp-1.2.2\lib\endorsed\xalan.jar";"%PATH%";"%CLASSPATH%" LauncherBootstrap jwsdp -DJAVA_HOME="%JAVA_HOME%" -DCATALINA_OPTS="%CATALINA_OPTS%" %CMD_LINE_ARGS%
    (thanks for your reply)

  • ClassCastException with JDK7U5 while using Iterator.

    Hi All,
    While i am trying to iterate through a raw Collection (without generics) which contains my business objects using Iterator. It is throwing ClassCastException when i am casting the Iterator's next value with expected object.
    but when i replace Iterator with for(int i=0; i<collection.size();i++) loop its working fine and i am able to iterate the collection without any exception and i am able to cast my object with expected class type.
    I am not sure why this is happening with JDK1.7u5 while the same code(with iterator) works fine in JDK1.6u31.
    Please suggest me the solution or workaround for the same.
    Thanks .

    show your code.

  • ClassCastException with Axis Web Service

    I have a web service running on Tomcat 5.0 with the attached WSDL. I was able to deploy my BPEL process but got an ClassCastException error on invoking the operation getAccessPointsProtocols. Do you have any ideas? I am using version v2.0.10.
    Thanks a lot..
    ahoy
    Maik Thiele
    TU Dresden
    wsdl:
    <?xml version="1.0" encoding="UTF-8" ?>
    - <wsdl:definitions targetNamespace="http://localhost:8080/axis/services/Manager" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://localhost:8080/axis/services/Manager" xmlns:intf="http://localhost:8080/axis/services/Manager" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <wsdl:message name="reinitializeResponse" />
    - <wsdl:message name="getAccessPointsProtocolsResponse">
      <wsdl:part name="getAccessPointsProtocolsReturn" type="xsd:string" />
      </wsdl:message>
      <wsdl:message name="getAccessPointsProtocolsRequest" />
      <wsdl:message name="reinitializeRequest" />
    - <wsdl:portType name="Manager">
    - <wsdl:operation name="reinitialize">
      <wsdl:input message="impl:reinitializeRequest" name="reinitializeRequest" />
      <wsdl:output message="impl:reinitializeResponse" name="reinitializeResponse" />
      </wsdl:operation>
    - <wsdl:operation name="getAccessPointsProtocols">
      <wsdl:input message="impl:getAccessPointsProtocolsRequest" name="getAccessPointsProtocolsRequest" />
      <wsdl:output message="impl:getAccessPointsProtocolsResponse" name="getAccessPointsProtocolsResponse" />
      </wsdl:operation>
      </wsdl:portType>
    - <wsdl:binding name="ManagerSoapBinding" type="impl:Manager">
      <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
    - <wsdl:operation name="reinitialize">
      <wsdlsoap:operation soapAction="" />
    - <wsdl:input name="reinitializeRequest">
      <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://wsfi.webservices.org" use="encoded" />
      </wsdl:input>
    - <wsdl:output name="reinitializeResponse">
      <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost:8080/axis/services/Manager" use="encoded" />
      </wsdl:output>
      </wsdl:operation>
    - <wsdl:operation name="getAccessPointsProtocols">
      <wsdlsoap:operation soapAction="" />
    - <wsdl:input name="getAccessPointsProtocolsRequest">
      <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://wsfi.webservices.org" use="encoded" />
      </wsdl:input>
    - <wsdl:output name="getAccessPointsProtocolsResponse">
      <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost:8080/axis/services/Manager" use="encoded" />
      </wsdl:output>
      </wsdl:operation>
      </wsdl:binding>
    - <wsdl:service name="ManagerService">
    - <wsdl:port binding="impl:ManagerSoapBinding" name="Manager">
      <wsdlsoap:address location="http://localhost:8080/axis/services/Manager" />
      </wsdl:port>
      </wsdl:service>
      </wsdl:definitions>bpel process:
    <process name="testWSFI" targetNamespace="http://acm.org/samples" suppressJoinFailure="yes" xmlns:tns="http://acm.org/samples" xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/" xmlns:bpelx="http://schemas.oracle.com/bpel/extension" xmlns:ora="http://schemas.oracle.com/xpath/extension" xmlns:cx="http://schemas.collaxa.com/xpath/extension" xmlns:Manager="http://localhost:8080/axis/services/Manager">
         <partnerLinks>
              <partnerLink name="client" partnerLinkType="tns:testWSFI" myRole="testWSFIProvider"/>
              <partnerLink name="WSFIService" partnerLinkType="Manager:ManagerLink" partnerRole="ManagerProvider"/>
         </partnerLinks>
         <variables>
              <variable name="input" messageType="tns:testWSFIRequestMessage"/>
              <variable name="output" messageType="tns:testWSFIResponseMessage"/>
              <variable name="in" messageType="Manager:getAccessPointsProtocolsRequest"/>
              <variable name="out" messageType="Manager:getAccessPointsProtocolsResponse"/>
              <variable name="reinitReq" messageType="Manager:reinitializeRequest"/>
              <variable name="reinitResp" messageType="Manager:reinitializeResponse"/>
         </variables>
         <sequence name="main">
              <receive name="receiveInput" partnerLink="client" portType="tns:testWSFI" operation="process" variable="input" createInstance="yes"/>
              <assign name="createIn">
                   <copy>
                        <from variable="input" part="payload" query="/tns:testWSFIRequest/tns:input">
                        </from>
                        <to variable="in"/>
                   </copy>
              </assign>
              <invoke name="reinit" partnerLink="WSFIService" portType="Manager:Manager" operation="reinitialize" inputVariable="reinitReq" outputVariable="reinitResp"/>
              <invoke name="getAccessPoints" partnerLink="WSFIService" portType="Manager:Manager" operation="getAccessPointsProtocols" inputVariable="in" outputVariable="out"/>
              <assign name="createOut">
                   <copy>
                        <from variable="out" part="getAccessPointsProtocolsReturn">
                        </from>
                        <to variable="output" part="payload" query="/tns:testWSFIResponse/tns:result"/>
                   </copy>
              </assign>
              <reply name="replyOutput" partnerLink="client" portType="tns:testWSFI" operation="process" variable="output"/>
         </sequence>
    </process>

    When I switched all loggers on I got the stack trace:
    java.lang.ClassCastException
         at com.collaxa.cube.engine.ext.wmp.BPELInvokeWMP.__executeStatements(BPELInvokeWMP.java:167)
         at com.collaxa.cube.engine.ext.wmp.BPELActivityWMP.perform(BPELActivityWMP.java:177)
         at com.collaxa.cube.engine.CubeEngine.performActivity(CubeEngine.java:3301)
         at com.collaxa.cube.engine.CubeEngine.handleWorkItem(CubeEngine.java:1698)
         at com.collaxa.cube.engine.dispatch.message.instance.PerformMessageHandler.handleLocal(PerformMessageHandler.java:75)
         at com.collaxa.cube.engine.dispatch.DispatchHelper.handleLocalMessage(DispatchHelper.java:86)
         at com.collaxa.cube.engine.dispatch.DispatchHelper.sendMemory(DispatchHelper.java:139)
         at com.collaxa.cube.engine.CubeEngine.endRequest(CubeEngine.java:5375)
         at com.collaxa.cube.engine.CubeEngine.createAndInvoke(CubeEngine.java:1226)
         at com.collaxa.cube.engine.bean.CubeEngineBean.createAndInvoke(CubeEngineBean.java:117)
         at com.collaxa.cube.engine.bean.CubeEngineBean.syncCreateAndInvoke(CubeEngineBean.java:140)
         at ICubeEngineBean_StatelessSessionBeanWrapper2.syncCreateAndInvoke(ICubeEngineBean_StatelessSessionBeanWrapper2.java:486)
         at com.oracle.bpel.client.dispatch.BaseDispatcherService.initialRequestAnyType(BaseDispatcherService.java:843)
         at com.oracle.bpel.client.dispatch.BaseDispatcherService.initialRequest(BaseDispatcherService.java:733)
         at com.oracle.bpel.client.dispatch.BaseDispatcherService.request(BaseDispatcherService.java:272)
         at com.oracle.bpel.client.dispatch.DispatcherService.request(DispatcherService.java:73)
         at com.oracle.bpel.client.dispatch.DeliveryService.request(DeliveryService.java:81)
         at com.oracle.bpel.client.dispatch.DeliveryService.request(DeliveryService.java:59)
         at _ngDoInitiate._jspService(_ngDoInitiate.java:157)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:347)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:509)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:413)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:765)
         at com.evermind.server.http.ServletRequestDispatcher.include(ServletRequestDispatcher.java:121)
         at com.evermind.server.http.EvermindPageContext.include(EvermindPageContext.java:267)
         at _displayProcess._jspService(_displayProcess.java:261)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:347)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:509)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:413)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:765)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:317)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
         at java.lang.Thread.run(Thread.java:534)

Maybe you are looking for