aspose file tools
The moose likes EJB and other Java EE Technologies and the fly likes need help run to first programme Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Reply Bookmark "need help run to first programme" Watch "need help run to first programme" New topic
Author

need help run to first programme

niroshan iranga
Greenhorn

Joined: Apr 28, 2004
Posts: 19
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
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: need help run to first programme
 
Similar Threads
Problem in EJB reference Example
NoInitialContextException
Urgent....Runtime error when running client
NoInitialContextException
EJB Compilation