我有两个主要问题,我无法在我的简单客户端上实例化存储库,并且在wildfly-jackRabbit服务器上出现了德比错误。 我可以通过身份验证连接到我的疯狂服务器,通过wildfly定位并调用jackRabbit,但查找失败。
这是我的客户端堆栈跟踪:
org.jboss.naming.remote.protocol.NamingIOException: Failed to lookup [Root exception is java.io.IOException: java.lang.ClassNotFoundException: org.apache.jackrabbit.jca.JCARepositoryHandle]
at org.jboss.naming.remote.client.ClientUtil.namingException(ClientUtil.java:49)
at org.jboss.naming.remote.protocol.v1.Protocol$1.execute(Protocol.java:104)
at org.jboss.naming.remote.protocol.v1.RemoteNamingStoreV1.lookup(RemoteNamingStoreV1.java:95)
at org.jboss.naming.remote.client.HaRemoteNamingStore$1.operation(HaRemoteNamingStore.java:276)
at org.jboss.naming.remote.client.HaRemoteNamingStore.namingOperation(HaRemoteNamingStore.java:137)
at org.jboss.naming.remote.client.HaRemoteNamingStore.lookup(HaRemoteNamingStore.java:272)
at org.jboss.naming.remote.client.RemoteContext.lookupInternal(RemoteContext.java:104)
at org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:93)
at org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:146)
at javax.naming.InitialContext.lookup(InitialContext.java:411)
at com.mycompany.jcrtest.main.getJcaRepository(main.java:123)
at com.mycompany.jcrtest.main.main(main.java:51)
Caused by: java.io.IOException: java.lang.ClassNotFoundException: org.apache.jackrabbit.jca.JCARepositoryHandle
at org.jboss.naming.remote.protocol.v1.Protocol$1$3.read(Protocol.java:159)
at org.jboss.naming.remote.protocol.v1.Protocol$1$3.read(Protocol.java:149)
at org.jboss.naming.remote.protocol.v1.BaseProtocolCommand.readResult(BaseProtocolCommand.java:59)
at org.jboss.naming.remote.protocol.v1.Protocol$1.handleClientMessage(Protocol.java:149)
at org.jboss.naming.remote.protocol.v1.RemoteNamingStoreV1$MessageReceiver$1.run(RemoteNamingStoreV1.java:232)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: org.apache.jackrabbit.jca.JCARepositoryHandle
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:278)
at org.jboss.marshalling.AbstractClassResolver.loadClass(AbstractClassResolver.java:131)
at org.jboss.marshalling.AbstractClassResolver.resolveClass(AbstractClassResolver.java:112)
at org.jboss.marshalling.river.RiverUnmarshaller.doReadClassDescriptor(RiverUnmarshaller.java:948)
at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1255)
at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:276)
at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:209)
at org.jboss.marshalling.AbstractObjectInput.readObject(AbstractObjectInput.java:41)
at org.jboss.naming.remote.protocol.v1.Protocol$1$3.read(Protocol.java:156)
... 7 more
这是我的服务器错误:
2019-09-26 10:43:46,446 ERROR [stderr] (MSC service thread 1-7) Thu Sep 26 10:43:46 EDT 2019 Thread[MSC service thread 1-7,5,main] java.io.FileNotFoundException: derby.log (Permission denied)
2019-09-26 10:43:46,867 INFO [org.apache.jackrabbit.core.fs.local.LocalFileSystem] (MSC service thread 1-4) LocalFileSystem initialized at path /mnt/jcr/repository
2019-09-26 10:43:47,015 INFO [org.apache.jackrabbit.core.fs.local.LocalFileSystem] (MSC service thread 1-4) LocalFileSystem initialized at path /mnt/jcr/version
2019-09-26 10:43:47,200 ERROR [stderr] (MSC service thread 1-4) ----------------------------------------------------------------
2019-09-26 10:43:47,202 ERROR [stderr] (MSC service thread 1-4) Thu Sep 26 10:43:47 EDT 2019:
2019-09-26 10:43:47,203 ERROR [stderr] (MSC service thread 1-4) Booting Derby version The Apache Software Foundation - Apache Derby - 10.14.2.0 - (1828579): instance a816c00e-016d-6e07-2a8f-000001858d68
2019-09-26 10:43:47,203 ERROR [stderr] (MSC service thread 1-4) on database directory /mnt/jcr/version/db with class loader ModuleClassLoader for Module "deployment.jackrabbit-jca-2.18.3.rar" from Service Module Loader
2019-09-26 10:43:47,203 ERROR [stderr] (MSC service thread 1-4) Loaded from vfs:/content/jackrabbit-jca-2.18.3.rar/derby-10.14.2.0.jar
2019-09-26 10:43:47,203 ERROR [stderr] (MSC service thread 1-4) java.vendor=Oracle Corporation
2019-09-26 10:43:47,203 ERROR [stderr] (MSC service thread 1-4) java.runtime.version=1.8.0_222-b10
2019-09-26 10:43:47,203 ERROR [stderr] (MSC service thread 1-4) user.dir=/
2019-09-26 10:43:47,204 ERROR [stderr] (MSC service thread 1-4) os.name=Linux
2019-09-26 10:43:47,204 ERROR [stderr] (MSC service thread 1-4) os.arch=amd64
2019-09-26 10:43:47,204 ERROR [stderr] (MSC service thread 1-4) os.version=3.10.0-957.el7.x86_64
2019-09-26 10:43:47,204 ERROR [stderr] (MSC service thread 1-4) derby.system.home=null
2019-09-26 10:43:47,365 ERROR [stderr] (MSC service thread 1-4) Database Class Loader started - derby.database.classpath=''
2019-09-26 10:43:48,029 INFO [org.apache.jackrabbit.core.fs.local.LocalFileSystem] (MSC service thread 1-4) LocalFileSystem initialized at path /mnt/jcr/workspaces/default
2019-09-26 10:43:48,096 ERROR [stderr] (MSC service thread 1-4) ----------------------------------------------------------------
2019-09-26 10:43:48,097 ERROR [stderr] (MSC service thread 1-4) Thu Sep 26 10:43:48 EDT 2019:
2019-09-26 10:43:48,097 ERROR [stderr] (MSC service thread 1-4) Booting Derby version The Apache Software Foundation - Apache Derby - 10.14.2.0 - (1828579): instance d89d8024-016d-6e07-2a8f-000001858d68
2019-09-26 10:43:48,097 ERROR [stderr] (MSC service thread 1-4) on database directory /mnt/jcr/workspaces/default/db with class loader ModuleClassLoader for Module "deployment.jackrabbit-jca-2.18.3.rar" from Service Module Loader
2019-09-26 10:43:48,097 ERROR [stderr] (MSC service thread 1-4) Loaded from vfs:/content/jackrabbit-jca-2.18.3.rar/derby-10.14.2.0.jar
2019-09-26 10:43:48,097 ERROR [stderr] (MSC service thread 1-4) java.vendor=Oracle Corporation
2019-09-26 10:43:48,097 ERROR [stderr] (MSC service thread 1-4) java.runtime.version=1.8.0_222-b10
2019-09-26 10:43:48,097 ERROR [stderr] (MSC service thread 1-4) user.dir=/
2019-09-26 10:43:48,098 ERROR [stderr] (MSC service thread 1-4) os.name=Linux
2019-09-26 10:43:48,098 ERROR [stderr] (MSC service thread 1-4) os.arch=amd64
2019-09-26 10:43:48,098 ERROR [stderr] (MSC service thread 1-4) os.version=3.10.0-957.el7.x86_64
2019-09-26 10:43:48,098 ERROR [stderr] (MSC service thread 1-4) derby.system.home=null
2019-09-26 10:43:48,135 ERROR [stderr] (MSC service thread 1-4) Database Class Loader started - derby.database.classpath=''
2019-09-26 10:43:50,979 INFO [org.apache.jackrabbit.core.fs.local.LocalFileSystem] (MSC service thread 1-4) LocalFileSystem initialized at path /mnt/jcr/workspaces/security
2019-09-26 10:43:51,052 ERROR [stderr] (MSC service thread 1-4) ----------------------------------------------------------------
2019-09-26 10:43:51,053 ERROR [stderr] (MSC service thread 1-4) Thu Sep 26 10:43:51 EDT 2019:
2019-09-26 10:43:51,053 ERROR [stderr] (MSC service thread 1-4) Booting Derby version The Apache Software Foundation - Apache Derby - 10.14.2.0 - (1828579): instance c99d403a-016d-6e07-2a8f-000001858d68
2019-09-26 10:43:51,053 ERROR [stderr] (MSC service thread 1-4) on database directory /mnt/jcr/workspaces/security/db with class loader ModuleClassLoader for Module "deployment.jackrabbit-jca-2.18.3.rar" from Service Module Loader
2019-09-26 10:43:51,053 ERROR [stderr] (MSC service thread 1-4) Loaded from vfs:/content/jackrabbit-jca-2.18.3.rar/derby-10.14.2.0.jar
2019-09-26 10:43:51,053 ERROR [stderr] (MSC service thread 1-4) java.vendor=Oracle Corporation
2019-09-26 10:43:51,053 ERROR [stderr] (MSC service thread 1-4) java.runtime.version=1.8.0_222-b10
2019-09-26 10:43:51,054 ERROR [stderr] (MSC service thread 1-4) user.dir=/
2019-09-26 10:43:51,054 ERROR [stderr] (MSC service thread 1-4) os.name=Linux
2019-09-26 10:43:51,054 ERROR [stderr] (MSC service thread 1-4) os.arch=amd64
2019-09-26 10:43:51,054 ERROR [stderr] (MSC service thread 1-4) os.version=3.10.0-957.el7.x86_64
2019-09-26 10:43:51,054 ERROR [stderr] (MSC service thread 1-4) derby.system.home=null
2019-09-26 10:43:51,097 ERROR [stderr] (MSC service thread 1-4) Database Class Loader started - derby.database.classpath=''
服务器上下文
我的standalone.xml配置:
<resource-adapters>
<resource-adapter id="jcrServer" statistics-enabled="true">
<archive>
jackrabbit-jca-2.18.3.rar
</archive>
<connection-definitions>
<connection-definition class-name="org.apache.jackrabbit.jca.JCAManagedConnectionFactory" jndi-name="java:jboss/exported/jcrServer" enabled="true" pool-name="jackrabbit-jca-2_18_3_rar-Pool">
<config-property name="ConfigFile">
/mnt/jcr/repository.xml
</config-property>
<config-property name="homeDir">
/mnt/jcr
</config-property>
<config-property name="BindSessionToTransaction">
true
</config-property>
<security>
<application/>
</security>
<validation>
<background-validation>false</background-validation>
</validation>
</connection-definition>
</connection-definitions>
</resource-adapter>
客户环境
我的代码示例:
public static void main(String[] args) throws NamingException {
Repository repository = null;
Properties jndiProps = new Properties();
jndiProps.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
jndiProps.put(Context.PROVIDER_URL, "http-remoting://192.168.4.135:8080");
jndiProps.put(Context.SECURITY_PRINCIPAL, "***");
jndiProps.put(Context.SECURITY_CREDENTIALS, "***");
jndiProps.put("jboss.naming.client.ejb.context", false);
Context ctx = new InitialContext(jndiProps);
RemoteRepository rr = (RemoteRepository) ctx.lookup("jcrServer");
if (rr != null) {
ClientAdapterFactory adapter = new ClientAdapterFactory();
repository = adapter.getRepository(rr);
}
}
我的pom.xml:
<dependency>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>jackrabbit-api</artifactId>
<version>2.14.8</version>
</dependency>
<dependency>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>jackrabbit-core</artifactId>
<version>2.14.8</version>
</dependency>
<dependency>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>jackrabbit-jcr-commons</artifactId>
<version>2.14.8</version>
</dependency>
<dependency>
<groupId>org.apache.servicemix.specs</groupId>
<artifactId>org.apache.servicemix.specs.jcr-api-2.0</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-ejb-client-bom</artifactId>
<version>10.0.0.Final</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>jackrabbit-jcr-rmi</artifactId>
<version>2.14.8</version>
</dependency>
谢谢。