This discussion is archived
0 Replies Latest reply: Apr 25, 2013 11:20 PM by 740753 RSS

求助 用weblogic.rmic编译生成idl文件失败,请高手帮助。

740753 Newbie
Currently Being Moderated
我写了一个Remote接口,在接口的基础上编写一个EJB类,用weblogic.rmic编译生成idl文件,出现类没找到异常。找不到出错原因。请高手帮助。

现把代码贴出.
--------------------------------------------------------------------------------
[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

Legend

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