aspose file tools*
The moose likes Websphere and the fly likes class cast exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "class cast exception" Watch "class cast exception" New topic
Author

class cast exception

shiva shankar
Ranch Hand

Joined: Jun 10, 2001
Posts: 84
Hi all,
I have a small problem

I have a java standalone client. I am trying to invoke the bean with that. I am getting an exception.
I would be very much thankful if you can help me out of this

My environment is WinNT 4 , WAS 3.5 with no fixpacks, HTTP Server 1.3.12
The code written is as below

import javax.rmi.*;
import javax.ejb.*;
import javax.naming.*;
import com.hex.util.*;
import com.hex.util.ejb.*;
import com.ibm.as400.access.*;
import java.sql.*;
import java.util.*;

class DBAccessClient
{


public static void main(String arg[])
{
String wsHomeName = "DatabaseAccessSessionAS400";
try
{
Context woCtx = getInitialContext();
System.out.println("checkpoint0");
Object woObj=woCtx.lookup("DatabaseAccessSessionAS400");
System.out.println("checkpoint1");
DatabaseAccessSessionAS400Home woHome=(DatabaseAccessSessionAS400Home)PortableRemoteObject.narrow(woObj,DatabaseAccessSessionAS400Home.class);
System.out.println(woHome);
System.out.println("checkpoint2");
DatabaseAccessSessionAS400 woRemoteObject=woHome.create();
System.out.println("checkpoint3");
System.out.println(woRemoteObject.TestBean());
}
catch (Exception woEx)
{
System.out.println("****FirstHome not found "+woEx);
woEx.printStackTrace();
}
}


static public Context getInitialContext() throws Exception
{
Properties p=new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.ejs.ns.jndi.CNInitialContextFactory");
p.put(Context.PROVIDER_URL,"iiop://hex009f1");

System.out.println("Properties have been INTIALIZED");
return new InitialContext(p);
}


}

The exception thrown is as follows

E:\DataAccessas400>java DBAccessClient
Properties have been INTIALIZED
checkpoint0
checkpoint1
com.ibm.rmi.iiop.CDRInputStream$1
****FirstHome not found java.lang.ClassCastException
java.lang.ClassCastException
at java.lang.Throwable.<init>(Throwable.java:84)
at java.lang.Exception.<init>(Exception.java:35)
at java.lang.RuntimeException.<init>(RuntimeException.java:39)
at java.lang.ClassCastException.<init>(ClassCastException.java:38)
at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:324)
at DBAccessClient.main(DBAccessClient.java:34)

Thanks in advance
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: class cast exception