error when instantiating ejb object from client code..ed roman example
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   juser11_juser11
Posted On:   Monday, July 20, 2009 07:26 AM

Hi, Am getting this problem when testing Ed Roman book example Client code (in weblogic server) to invoke remote ejb object gives following error Exception in thread "Main Thread" java.lang.ClassCastException: examples._HelloHome_Stub at examples.HelloClientJNDI.main(HelloClientJNDI.java:29) Below is the client code ------------------------ import javax.xml.namespace.QName; import javax.xml.rpc.ServiceFactory; import javax.naming.Context; import javax.naming.InitialContext; import examples.HelloInterface; import java.rmi.*; import javax.rmi.*; /** * This class is an example of client code which invok   More>>

Hi,
Am getting this problem when testing Ed Roman book example

Client code (in weblogic server) to invoke remote ejb object gives following error
Exception in thread "Main Thread" java.lang.ClassCastException: examples._HelloHome_Stub
at examples.HelloClientJNDI.main(HelloClientJNDI.java:29)

Below is the client code
------------------------

			

import javax.xml.namespace.QName;
import javax.xml.rpc.ServiceFactory;
import javax.naming.Context;
import javax.naming.InitialContext;
import examples.HelloInterface;
import java.rmi.*;
import javax.rmi.*;


/**
* This class is an example of client code which invokes
* methods on a simple stateless session bean.
*/
public class HelloClientJNDI {

public static void main(String[] args)
throws Exception
{
System.out.println("In Hello Client JNDI");
System.setProperty("java.naming.factory.initial", "weblogic.jndi.WLInitialContextFactory");
System.setProperty("java.naming.provider.url","t3://localhost:7001");
InitialContext ctx = new InitialContext();
Service helloService = (Service)ctx.lookup("HelloWorldWS");

/* Below Line gives error */
HelloInterface hello = (examples.HelloInterface)PortableRemoteObject.narrow(helloService, examples.HelloInterface.class);
/*
* Call the hello() method
*/
System.out.println(hello.hello());

}
}

   <<Less

Re: error when instantiating ejb object from client code..ed roman example

Posted By:   Pramy_143  
Posted On:   Wednesday, September 16, 2009 03:57 AM

Hey this is the problem with the EJB means the inter face you didn't declared put this inter face in the src folder it vil exicute.......
About | Sitemap | Contact