2 Replies Latest reply on Apr 25, 2013 9:56 AM by 740753

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

      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
      | | |---Hello.java (*Class implents)
      | | IHello.java (*Interface)
      | |---META-INF
      | |--- MANIFEST.MF
      | weblogic-ejb-jar.xml
      | |---Hello.class
      | IHello.class
      |--- MANIFEST.MF
      // IHello.java
      package hello;

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

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

      [Java Class]
      // Hello.java
      package hello;

      import java.rmi.RemoteException;

      public class Hello implements IHello {

      private String name;

      public Hello(String s) throws RemoteException {
      this.name = 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="http://xmlns.oracle.com/weblogic/weblogic-ejb-jar" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd http://xmlns.oracle.com/weblogic/weblogic-ejb-jar http://xmlns.oracle.com/weblogic/weblogic-ejb-jar/1.3/weblogic-ejb-jar.xsd">

      [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.
          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.
          SET CLASSPATH=.;%WEBLOGIC_SERVER%\lib;%WEBLOGIC_SERVER%\lib\weblogic.jar;
          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.
            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 java.net.URLClassLoader$1.run(Unknown Source)
            at java.net.URLClassLoader$1.run(Unknown Source)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(Unknown 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(Remote2Java.java:757)
            at weblogic.rmi.rmic.Remote2Java.checkIsNotInterface(Remote2Java.java:73
            at weblogic.rmi.rmic.Remote2Java.outputs(Remote2Java.java:518)
            at weblogic.utils.compiler.CodeGenerator.generate(CodeGenerator.java:262
            at weblogic.rmic.runBody(rmic.java:64)
            at weblogic.utils.compiler.Tool.run(Tool.java:158)
            at weblogic.utils.compiler.Tool.run(Tool.java:115)
            at weblogic.rmic.main(rmic.java:142)
            ejbModule.hello.Hello must be a remote interface implementation and should exist in the classpath