• 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Bear Bibeault
  • paul wheaton
Saloon Keepers:
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Mikalai Zaikin
  • Piet Souris
Bartenders:

need help run to first programme

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello i m new to the ejb
i tried to run the very simple exaple i was able to compile the following code and deploy them to the j2ee server but i wavs un able to run the cilent program in the same machine

here are the codes


// this is remote intterface class

public interface remote extends javax.ejb.EJBObject{
public String show() throws java.rmi.RemoteException;

}

//home interface


import javax.ejb.*;
import java.rmi.*;
public interface homeinter extends EJBHome{
remote create()throws CreateException,RemoteException;


}


//bean

import javax.ejb.SessionBean;
import javax.ejb.EJBException;
import java.rmi.RemoteException;
import javax.ejb.SessionContext;
public class bean implements SessionBean {

SessionContext sct;
public String show() throws RemoteException {
return " this is from bean";
}

public void ejbActivate(){}
public void ejbPassivate(){}
public void ejbCreate(){}
public void ejbRemove(){}

public void setSessionContext(SessionContext set){
this.sct=set;
}

}

}

// client

import javax.ejb.*;
import javax.rmi.*;
import javax.naming.*;
import java.rmi.*;


public class client {
public static void main(String[] args) {
try{
InitialContext ic= new InitialContext();
Object obj= ic.lookup("MySecond");
homeinter h=(homeinter)PortableRemoteObject.narrow(obj,homeinter.class);
remote r=h.create();
System.out.println("the return value is" + r.show());
}catch(Exception e){

e.printStackTrace();
}


}
}


in the DOS prompt i tried to run the programme like

set CPATH=.;c:\j2ee\lib\j2ee.jar;secondClient.jar
java -Dorg.omg.CORBA.ORBInitialHost=lacalhost -classpath %CPATH% client

then i had the following error mesage


C:\ejb>set CPATH=.;c:\j2ee\lib\j2ee.jar;secondClient.jar

C:\ejb>java -Dorg.omg.CORBA.ORBInitialHost=Localhost -classpath .;c:\j2ee\lib\
j2ee.jar;secondClient.jar client
Exception in thread "main" java.lang.NoSuchMethodError: loadClass0
at com.sun.corba.ee.internal.util.JDKClassLoader.specialLoadClass(Native
Method)
at com.sun.corba.ee.internal.util.JDKClassLoader.loadClass(JDKClassLoade
r.java:58)
at com.sun.corba.ee.internal.util.JDKBridge.loadClassM(JDKBridge.java:18
0)
at com.sun.corba.ee.internal.util.JDKBridge.loadClass(JDKBridge.java:83)

at com.sun.corba.ee.internal.javax.rmi.CORBA.Util.loadClass(Util.java:37
8)
at javax.rmi.CORBA.Util.loadClass(Unknown Source)
at javax.rmi.PortableRemoteObject.createDelegateIfSpecified(Unknown Sour
ce)
at javax.rmi.PortableRemoteObject.<clinit>(Unknown Source)
at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.jav
a:57)
at com.sun.enterprise.naming.SerialContext.<init>(SerialContext.java:79)

at com.sun.enterprise.naming.SerialInitContextFactory.getInitialContext(
SerialInitContextFactory.java:54)
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.init(Unknown Source)
at javax.naming.InitialContext.<init>(Unknown Source)
at client.main(client.java:10)


pls give me a solution
thank you
 
There's a way to do it better - find it. -Edison. A better tiny ad:
Low Tech Laboratory
https://www.kickstarter.com/projects/paulwheaton/low-tech-0
reply
    Bookmark Topic Watch Topic
  • New Topic