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