[jboss-user] [EJB/JBoss] - java.lang.ClassCastException: org.jnp.interfaces.NamingConte
mcayci
do-not-reply at jboss.com
Mon Aug 27 10:07:45 EDT 2007
Hi,
I am sorry if this has been posted before. I did a search and nothing came back.
I developed a very simple EJB3.0 Stateless Session Bean. I created a client that calls this session bean as follows:
public static void main(String [] args) {
| try {
| final Context context = getInitialContext();
| ReadCrimeReport readCrimeReport = (ReadCrimeReport)context.lookup("ReadCrimeReport");
| } catch (Exception ex) {
| ex.printStackTrace();
| }
|
| private static Context getInitialContext() throws NamingException {
| Hashtable env = new Hashtable();
| env.put( Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory" );
| env.put(Context.PROVIDER_URL, "localhost");
| env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces" );
| return new InitialContext( env );
| }
|
I deployed the EJB and see the following
09:13:04,288 WARN [Ejb3DescriptorHandler] Descriptor based bean has no ejb-clas
s defined: ReadCrimeReportBean
09:13:04,328 INFO [JmxKernelAbstraction] creating wrapper delegate for: org.jbo
ss.ejb3.stateless.StatelessContainer
09:13:04,338 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:jar=ejb1.
jar,name=ReadCrimeReport,service=EJB3 with dependencies:
09:13:04,568 INFO [EJBContainer] STARTED EJB: server.ReadCrimeReportBean ejbNam
e: ReadCrimeReport
09:13:04,678 INFO [EJB3Deployer] Deployed: file:/D:/jboss-4.2.1.GA/server/defau
lt/deploy/ejb1.jar
Now when I run the client, I am getting
java.lang.ClassCastException: org.jnp.interfaces.NamingContext
at client.ReadCrimeReportClient.main(ReadCrimeReportClient.java:15)
It is complaining on
ReadCrimeReport readCrimeReport = (ReadCrimeReport)context.lookup("ReadCrimeReport");
Thanks for your help.
Mustafa
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4078359#4078359
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4078359
More information about the jboss-user
mailing list