我嘗試使用Java 9運行我的應用程序(Java Swing中開發的前端,使用部署在Wildfly 8上的EJB開發的服務器)。 當客戶端嘗試建立一個EJB連接得到了以下異常:使用Java 9運行應用程序,java.base模塊不會「打開java.io」
09:53:42,358 INFO [xnio] XNIO version 3.2.0.Final
09:53:42,465 INFO [nio] XNIO NIO Implementation Version 3.2.0.Final
09:53:42,507 DEBUG [nio] Started channel thread 'Remoting "config-based-naming-client-endpoint" I/O-1', selector [email protected]
RmiServiceFactpry ExceptionInInitializerError
java.lang.ExceptionInInitializerError
at org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver.<init>(RemotingConnectionEJBReceiver.java:148)
at org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver.<init>(RemotingConnectionEJBReceiver.java:106)
at org.jboss.ejb.client.EJBClientContext.registerConnection(EJBClientContext.java:465)
at org.jboss.naming.remote.client.ejb.RemoteNamingStoreEJBClientHandler.associate(RemoteNamingStoreEJBClientHandler.java:78)
at org.jboss.naming.remote.protocol.v1.RemoteNamingStoreV1.<init>(RemoteNamingStoreV1.java:71)
at org.jboss.naming.remote.protocol.v1.VersionOne.getRemoteNamingStore(VersionOne.java:50)
at org.jboss.naming.remote.protocol.Versions.getRemoteNamingStore(Versions.java:55)
at org.jboss.naming.remote.client.RemoteContextFactory.createVersionedStore(RemoteContextFactory.java:73)
at org.jboss.naming.remote.client.HaRemoteNamingStore.failOverSequence(HaRemoteNamingStore.java:202)
at org.jboss.naming.remote.client.HaRemoteNamingStore.namingStore(HaRemoteNamingStore.java:149)
at org.jboss.naming.remote.client.HaRemoteNamingStore.namingOperation(HaRemoteNamingStore.java:130)
at org.jboss.naming.remote.client.HaRemoteNamingStore.lookup(HaRemoteNamingStore.java:272)
at org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:79)
at org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:83)
at java.naming/javax.naming.InitialContext.lookup(Unknown Source)
at com.dataloy.client.core.RmiServiceFactory.createRemote(RmiServiceFactory.java:105)
at com.dataloy.client.core.RmiServiceFactory.getServiceImpl(RmiServiceFactory.java:96)
at com.dataloy.core.AbstractServiceFactory.getService(AbstractServiceFactory.java:58)
at com.dataloy.DataloyEngine.getService(DataloyEngine.java:198)
at com.dataloy.DataloyEngine.login(DataloyEngine.java:548)
at com.dataloy.client.login.LoginPanel.doLogin(LoginPanel.java:511)
at com.dataloy.client.login.LoginPanel.access$500(LoginPanel.java:56)
at com.dataloy.client.login.LoginPanel$5.run(LoginPanel.java:452)
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make java.io.OptionalDataException(boolean) accessible: module java.base does not "opens java.io" to unnamed module @312002a1
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(Unknown Source)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(Unknown Source)
at java.base/java.lang.reflect.Constructor.checkCanSetAccessible(Unknown Source)
at java.base/java.lang.reflect.Constructor.setAccessible(Unknown Source)
at org.jboss.marshalling.Marshalling$OptionalDataExceptionCreateAction$1.run(Marshalling.java:385)
at org.jboss.marshalling.Marshalling$OptionalDataExceptionCreateAction$1.run(Marshalling.java:381)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at org.jboss.marshalling.Marshalling$OptionalDataExceptionCreateAction.<init>(Marshalling.java:381)
at org.jboss.marshalling.Marshalling$OptionalDataExceptionCreateAction.<init>(Marshalling.java:376)
at org.jboss.marshalling.Marshalling.<clinit>(Marshalling.java:374)
... 23 more
我看到有一些問題,在Java 9中引入新的模塊管理,但我不明白什麼應該做的。
問候, 安德烈
嘗試添加'--add-打開java.base/java.io = ALL-UNNAMED'到java命令行打開java.io包爲反射。背景:http://mail.openjdk.java.net/pipermail/jdk9-dev/2016-November/005276.html –