This discussion is archived
2 Replies Latest reply: Apr 25, 2013 2:56 AM by 740753 RSS

How I can compile a ejb3 class to a idl file by the weblogic.rmic command.

740753 Newbie
Currently Being Moderated
Now, I want create a idl file from a ejb3 class by the weblogic.rmic command.
I had written a sample case. but when I compile, I get a [Class not found] error, why?
Who can guide me or provide me with a sample?

There is a my sample code, below.

[Java Class/Source Path Diagram]
| |---hello
| | | (*Class implents)
| | (*Interface)
| |---META-INF
| weblogic-ejb-jar.xml
| |---Hello.class
| IHello.class
package hello;

import java.rmi.Remote;
import java.rmi.RemoteException;

public interface IHello extends Remote {
String sayHello() throws RemoteException;

[Java Class]
package hello;

import java.rmi.RemoteException;

public class Hello implements IHello {

private String name;

public Hello(String s) throws RemoteException { = s;

public String sayHello() throws RemoteException {
return "Hello ! From " + name;

* @param args
public static void main(String[] args) {
int i = 0;
try {
for(i = 0; i < 10; i++) {
Hello obj = new Hello("MutiHelloServer" + i);
//Context.rebind("//sample/MutiHelloServer" + i, obj);
} catch(Exception e) {
System.out.println("Hello Error: " + e.getMessage());


Manifest-Version: 1.0

<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-ejb-jar xmlns:wls="" xmlns:xsi="" xsi:schemaLocation="">

[EJB Jar]
ejbModule.jar (* Exported from a sample, above)

[Command Environment]
SET WEBLOGIC_SERVER=C:\Oracle\Middleware\wlserver_12.1\server
SET JAVA_HOME=C:\Program Files\Java\jdk1.7.0_09
SET CLASSPATH=.;%JAVA_HOME%\jre\lib;%JAVA_HOME%\lib;%JAVA_HOME%\lib\tools.jar;%WEBLOGIC_SERVER%\lib;%WEBLOGIC_SERVER%\lib\weblogic.jar;

java weblogic.rmic -idl ejbModule.hello.Hello

[execution result]
Class not found : ejbModule.hello.Hello


  • 1. Re: How I can compile a ejb3 class to a idl file by the weblogic.rmic command.
    gimbal2 Guru
    Currently Being Moderated
    SET CLASSPATH=.;%JAVA_HOME%\jre\lib;%JAVA_HOME%\lib;%JAVA_HOME%\lib\tools.jar;%WEBLOGIC_SERVER%\lib;%WEBLOGIC_SERVER%\lib\weblogic.jar;
    Horribly wrong. Don't put the runtime stuff on the classpath.
    The WEBLOGIC_SERVER\lib element is not going to do anything either. You really need to research how to properly manage the classpath (and like also: what it actually is) to resolve this problem and all future problems you are going to have with ClassNotfound.
  • 2. Re: How I can compile a ejb3 class to a idl file by the weblogic.rmic command.
    740753 Newbie
    Currently Being Moderated
    Thanks for your replay.

    Before I set the classpath, I had met the ClassNotFound problem.
    My command : java -cp %WEBLOGIC_SERVER%\lib\weblogic.jar weblogic.rmic -idl ejbModule.hello.Hello
    I was afraid to lost the class that the weblogic.rmic is required, I set the classpath(java library path/class ,weblogic library path/class).
    I think the class what is not found is like my class(hello), not the class of the weblogic or java.
    Now I don't know what is requred by weblogic.rmic. Is it a class or source of "Hello", and the package name of "Hello" is requred?

    After the idl option is cut, when I execute the Command[java weblogic.rmic *---idl--* ejbModule.hello.Hello], I got the other error, below.
    (*the Hello class is in ejbModule.jar)
    C:\CORBA\test>java weblogic.rmic ejbModule.hello.Hello
    java.lang.ClassNotFoundException: ejbModule.hello.Hello
    at$ Source)
    at$ Source)
    at Method)
    at Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at weblogic.rmi.rmic.Remote2Java.loadClassUsingSystemClasspath(Remote2Ja
    at weblogic.rmi.rmic.Remote2Java.loadClass(
    at weblogic.rmi.rmic.Remote2Java.checkIsNotInterface(
    at weblogic.rmi.rmic.Remote2Java.outputs(
    at weblogic.utils.compiler.CodeGenerator.generate(
    at weblogic.rmic.runBody(
    at weblogic.rmic.main(
    ejbModule.hello.Hello must be a remote interface implementation and should exist in the classpath


  • Correct Answers - 10 points
  • Helpful Answers - 5 points