我正在尝试创建 JCR 存储库。我正在使用 Tomcat 7 和 jdk 6 以及 jar 作为:
commons-collections-3.2.1.jar
commons-dbcp-1.3.jar
commons-io-2.2.jar
commons-pool-1.5.4.jar
concurrent-1.3.4.jar
jackrabbit-api-2.5.2.jar
jackrabbit-core-2.5.2.jar
jackrabbit-jcr-commons-2.5.2.jar
jackrabbit-spi-2.5.2.jar
jackrabbit-spi-commons-2.5.2.jar
jcr-2.0.jar
log4j-1.2.14.jar
log4j-over-slf4j-1.6.4.jar
lucene-core-4.0.0.jar
postgresql-8.2-504.jdbc4.jar
slf4j-api-1.6.4.jar
xercesImpl-2.8.1.jar
xmlParserAPIs-2.0.2.jar
我的服务器的 Context.xml 文件:
<Resource
name="jcr/repository"
auth="Container"
type="javax.jcr.Repository"
factory="org.apache.jackrabbit.core.jndi.BindableRepositoryFactory"
configFilePath="C:/comrep/fiplrepository/repository.xml"
repHomeDir="C:/comrep/fiplrepository/repository"></Resource>
我的 Servlet 类:
1)...InitialContext inc = new InitialContext();
2)...Context context = (Context) inc.lookup("java:comp/env");
3)...Object repository = context.lookup("jcr/repository");//This line gives error...
第 3 行)给出了一个错误:
javax.jcr.RepositoryException: org.apache.jackrabbit.core.state.ItemStateException: failed to read bundle (stacktrace on DEBUG log level): deadbeef-face-babe-cafe-babecafebabe: java.sql.SQLException: Failed to parse bundle deadbeef-face-babe-cafe-babecafebabe
at org.apache.jackrabbit.core.version.InternalVersionManagerImpl.<init>(InternalVersionManagerImpl.java:208)
at org.apache.jackrabbit.core.RepositoryImpl.createVersionManager(RepositoryImpl.java:492)
at org.apache.jackrabbit.core.RepositoryImpl.<init>(RepositoryImpl.java:311)
at org.apache.jackrabbit.core.RepositoryImpl.create(RepositoryImpl.java:589)
at org.apache.jackrabbit.core.jndi.BindableRepository.createRepository(BindableRepository.java:141)
at org.apache.jackrabbit.core.jndi.BindableRepository.init(BindableRepository.java:117)
at org.apache.jackrabbit.core.jndi.BindableRepository.<init>(BindableRepository.java:106)
at org.apache.jackrabbit.core.jndi.BindableRepositoryFactory.getObjectInstance(BindableRepositoryFactory.java:52)
at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:143)
at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source)
at org.apache.naming.NamingContext.lookup(NamingContext.java:843)
at org.apache.naming.NamingContext.lookup(NamingContext.java:154)
at org.apache.naming.NamingContext.lookup(NamingContext.java:831)
at org.apache.naming.NamingContext.lookup(NamingContext.java:168)
at com.willcode4beer.demo.jcr.JcrDemoServlet.doPost(JcrDemoServlet.java:33)
at com.willcode4beer.demo.jcr.JcrDemoServlet.doGet(JcrDemoServlet.java:22)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.jackrabbit.core.state.ItemStateException: failed to read bundle (stacktrace on DEBUG log level): deadbeef-face-babe-cafe-babecafebabe: java.sql.SQLException: Failed to parse bundle deadbeef-face-babe-cafe-babecafebabe
at org.apache.jackrabbit.core.persistence.pool.BundleDbPersistenceManager.loadBundle(BundleDbPersistenceManager.java:902)
at org.apache.jackrabbit.core.persistence.bundle.AbstractBundlePersistenceManager.getBundleCacheMiss(AbstractBundlePersistenceManager.java:766)
at org.apache.jackrabbit.core.persistence.bundle.AbstractBundlePersistenceManager.getBundle(AbstractBundlePersistenceManager.java:749)
at org.apache.jackrabbit.core.persistence.bundle.AbstractBundlePersistenceManager.exists(AbstractBundlePersistenceManager.java:560)
at org.apache.jackrabbit.core.version.InternalVersionManagerImpl.<init>(InternalVersionManagerImpl.java:162)
我的 repository.xml 文件包含:
<Repository>
<FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
<param name="path" value="${rep.home}/repository" />
</FileSystem><!-- security configuration -->
<Security appName="Jackrabbit">
<AccessManager
class="org.apache.jackrabbit.core.security.SimpleAccessManager">
</AccessManager>
<LoginModule class="org.apache.jackrabbit.core.security.SimpleLoginModule">
<param name="anonymousId" value="anonymous" />
</LoginModule>
</Security>
<Workspaces rootPath="${rep.home}/workspaces"
defaultWorkspace="default" />
<Workspace name="${wsp.name}">
<FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem">
<param name="driver" value="org.postgresql.Driver"/>
<param name="url" value="jdbc:postgresql://myPort/DMS"/>
<param name="user" value="postgres" />
<param name="password" value="pass" />
<param name="schema" value="postgresql"/>
<param name="schemaObjectPrefix" value="pm_ws_${wsp.name}_"/>
</FileSystem>
<PersistenceManager class="org.apache.jackrabbit.core.persistence.pool.PostgreSQLPersistenceManager">
<param name="driver" value="org.postgresql.Driver"/>
<param name="url" value="jdbc:postgresql://myPort/DMS"/>
<param name="user" value="postgres" />
<param name="password" value="pass" />
<param name="schema" value="postgresql"/>
<param name="schemaObjectPrefix" value="pm_ws_${wsp.name}_"/>
<param name="externalBLOBs" value="false"/>
</PersistenceManager>
<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
<param name="path" value="${wsp.home}/index" />
</SearchIndex>
</Workspace><!-- Configures the versioning -->
<Versioning rootPath="${rep.home}/version">
<FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
<param name="path" value="${rep.home}/version" />
</FileSystem>
<PersistenceManager class="org.apache.jackrabbit.core.persistence.pool.PostgreSQLPersistenceManager">
<param name="url" value="jdbc:postgresql://myPort/DMS"/>
<param name="user" value="postgres" />
<param name="password" value="pass" />
<param name="schema" value="postgresql"/>
<param name="schemaObjectPrefix" value="pm_vs_"/>
</PersistenceManager>
</Versioning>
<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
<param name="path" value="${rep.home}/repository/index" />
</SearchIndex>
</Repository>
在我的存储库路径中,我可以看到存储库文件夹已生成,并且在我的数据库中创建了命名表。那么这里出了什么问题,我在这里改变了什么,该程序将运行。另外,我如何为 RMI 配置以便我的其他应用程序可以调用此存储库?请帮帮我,我上周就卡在这里了。提前致谢。