0 Replies Latest reply: Apr 25, 2013 3:37 AM by 740753 RSS

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

    740753
      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]
      Ejb3ToIdlApp\
      |---ejbModule
      | |---hello
      | | |---Hello.java (*Class implents)
      | | IHello.java (*Interface)
      | |---META-INF
      | |--- MANIFEST.MF
      | weblogic-ejb-jar.xml
      |---build
      |---classes
      |---hello
      | |---Hello.class
      | IHello.class
      |---META-INF
      |--- MANIFEST.MF
      weblogic-ejb-jar.xml
      [Interface]
      // 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;
           }
           
           @Override
           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());
                     e.printStackTrace();
                }
           }

      }

      [MANIFEST.MF]
      Manifest-Version: 1.0
      Class-Path:

      [weblogic-ejb-jar.xml]
      <?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">
      <!--weblogic-version:12.1.1-->
      </wls:weblogic-ejb-jar>

      [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
      ejbModule.hello.Hello
      -----

      Help!