Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

class cast exception

 
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Once upon a time there were three bears. And they were visted by a golden haired tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic