Netbeans에서 예상대로 작동하는 Netbeans에서 간단한 엔터프라이즈 응용 프로그램을 만들었습니다.클래스를 인스턴스화 할 수 없습니다. com.sun.enterprise.naming.SerialInitContextFactory
package clienttest2;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import test.TestEJBRemote;
/**
*
* @author
*/
public class Main {
private TestEJBRemote testejb;
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws NamingException {
Properties props = new Properties();
props = new Properties();
props.setProperty("java.naming.factory.initial",
"com.sun.enterprise.naming.SerialInitContextFactory");
props.setProperty("java.naming.factory.url.pkgs",
"com.sun.enterprise.naming");
props.setProperty("java.naming.factory.state",
"com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
props.setProperty("org.omg.CORBA.ORBInitialHost", "computer");
props.setProperty("org.omg.CORBA.ORBInitialPort", "3700");
InitialContext ctx = new InitialContext(props);
TestEJBRemote t = (TestEJBRemote) ctx.lookup("java:global/EJBTest/EJBTest-ejb/TestEJB");
System.out.println(t.getName("Ian"));
//Context ctx = null;
//ctx=new InitialContext();
//TestEJBRemote t = (TestEJBRemote) ctx.lookup("java:global/EJBTest/EJBTest-ejb/TestEJB");
//System.out.println(t.getName("Ian"));
}
}
내가 시도 다음 : 엔터프라이즈 응용 프로그램 클라이언트는 다음과 같은 코드를 포함
java -jar ClientTest.jar
내가 오류는 다음과 같습니다 클래스 인스턴스화 할 수 없습니다 com.sun.enterprise.naming.SerialInitContextFactory
몇 가지 질문이 있습니다.
나는 내 PC에 JRE 1.8을 설치했습니다. 그렇다면 Java EE 및 Java SE와 같은 모든 유형의 Java 응용 프로그램을 실행할 수 있습니까?
glassfish의 appclient 명령은 이러한 종속성을 해결할 수 있습니다. – Thufir