我一直有問題從我在grails 2.0.3上開發的獨立客戶端訪問我的EJB服務。 EJB服務部署在Glassfish服務器(Java)上。我測試了一個NetBeans測試類的代碼來訪問EJB的:如何從grails獨立客戶端訪問EJB服務
Properties p = new Properties();
p.put("java.naming.factory.initial", "com.sun.enterprise.naming.SerialInitContextFactory");
p.setProperty("java.naming.factory.url.pkgs", "com.sun.enterprise.naming");
p.setProperty("java.naming.factory.state", "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
p.setProperty("org.omg.CORBA.ORBInitialHost", INTEGRATION_IP);
p.setProperty("org.omg.CORBA.ORBInitialPort", CORBA_PORT);
ctx = new InitialContext(p);
try {
this.admAuth = (AdmAuthenticationRemote) this.ctx.lookup(Tester.AUTHENTICATION_SERVICE_JNDI);
}catch(Exception e){
...
}
這Tester.AUTHENTICATION_SERVICE_JNDI
是一個變量THA包含路徑部署的服務,在這種情況下,像"java:global/..."
表示地址是服務被請求。這種訪問服務的方式完全可以從測試程序中完成,但是當我嘗試從grails執行相同的操作時不起作用。我能夠創建上下文以同樣的方式,但是當我調用ctx.lookup()
呼叫我得到一個異常:
Message: Lookup failed for 'java:global/...' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.SerialInitContextFactory,
java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming}
Cause: javax.naming.NamingException: Unable to acquire SerialContextProvider for SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.SerialInitContextFactory,
java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming}
[Root exception is java.lang.RuntimeException: Orb initialization erorr]
主要的例外是命名異常,這意味着它在ctx.lookup()
失敗,但原因是orb初始化異常,它有另一個異常堆棧:
java.lang.RuntimeException: Orb initialization erorr
Caused by: java.lang.RuntimeException: java.lang.IllegalArgumentException: Can not set long field com.sun.corba.ee.impl.orb.ORBDataParserImpl.waitForResponseTimeout to java.lang.Integer
Caused by: java.lang.IllegalArgumentException: Can not set long field com.sun.corba.ee.impl.orb.ORBDataParserImpl.waitForResponseTimeout to java.lang.Integer
我真的迷失在這裏。我一直有很多問題需要通過grails來完成,我必須得到所有glassfish罐(庫和模塊),以便能夠調用InitialContext()
,但現在我不確定這是否仍然是jar問題或配置問題或它是什麼。
我知道IllegalArgumentException
發生在你嘗試在java中分配不兼容的類型,但我沒有設置類似的東西,所以我假設它的內部方法初始化。
所以問題是爲什麼這個例外即將到來?
是否有另一種方式來從grails調用我的服務更好?
+1用於描述錯誤。 –