我们正在开发一个使用带有lucene索引的hibernate搜索的Web应用程序。首先,我们使用Windows Filesystem目录来存储lucene索引文件。对于群集,我们正在从FS更改为Infinspan以存储索引。我按照infinispan和hibernate搜索手册进行了操作,但是下面提到的异常会不断显示。
JPA persistence.xml 详细信息是
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="inov8">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:jboss/datasources/inov8bDS</jta-data-source>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect"/>
<property name="hibernate.max_fetch_depth" value="3"/>
<property name="hibernate.show_sql" value="false" />
<property name="hibernate.default_batch_fetch_size" value="10" />
<property name="hibernate.jdbc_fetch_size" value="10" />
<property name="hibernate.jdbc_batch_size" value="10" />
<property name="hibernate.id.new_generator_mappings" value="false" />
<!-- The following line is what's used in Hibernate 4 instead of a TransactionManagerLookup class -->
<property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform" />
<property name="hibernate.cache.use_second_level_cache" value="true" />
<property name="hibernate.cache.use_query_cache" value="true" />
<!-- <property name="hibernate.cache.region.factory_class" value="org.hibernate.cache.infinispan.JndiInfinispanRegionFactory"/> -->
<!-- TODO [clustering] need to change index location -->
<property name="hibernate.search.default.exclusive_index_use" value="true" />
<property name="hibernate.search.default.directory_provider" value="infinispan" />
<!-- <property name="hibernate.cache.infinispan.cachemanager" value="java:jboss/infinispan/hibernate"/> -->
<property name="hibernate.search.infinispan.configuration_resourcename" value="C:\dev\Java\lib\hibernate-search\hibernate-search-4.2.0.Final\project\hibernate-search-infinispan\src\main\resources\default-hibernatesearch-infinispan.xml" />
<property name="hibernate.cache.infinispan.cachemanager" value="java:jboss/infinispan/container/hibernate" />
<property name="hibernate.search.default.data_cachename" value="LuceneIndexesData" />
<property name="hibernate.search.default.metadata_cachename" value="LuceneIndexesMetadata" />
<property name="hibernate.search.default.locking_cachename" value="LuceneIndexesLocking" />
<property name="hibernate.search.infinispan.cachemanager_jndiname" value="java:infinispan/myup-hibernatesearch"/>
<property name="hibernate.search.default.chunk_size" value="33554432"/>
<property name="key2StringMapperClass" value="org.infinispan.lucene.LuceneKey2StringMapper" />
<property name="hibernate.search.default.indexBase" value="C:\dev\deploy\inov8b\lucene"/>
<property name="hibernate.search.lucene_version" value="LUCENE_36"/>
</properties>
</persistence-unit>
</persistence>
错误堆栈跟踪:
17:23:38,474 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 54) MSC00001: Failed to start service jboss.persistenceunit."inov8.war#inov8": org.jboss.msc.service.StartException in service jboss.persistenceunit."inov8.war#inov8": org.hibernate.search.SearchException: HSEARCH000103: Unable to initialize IndexManager xx.inov8.domain.innovation.InnovationComponent
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:103)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_17]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_17]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_17]
at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.1.0.Final.jar:2.1.0.Final]
Caused by: org.hibernate.search.SearchException: HSEARCH000103: Unable to initialize IndexManager xx.inov8.domain.innovation.InnovationComponent
at org.hibernate.search.indexes.impl.IndexManagerHolder.createIndexManager(IndexManagerHolder.java:230)
at org.hibernate.search.indexes.impl.IndexManagerHolder.buildEntityIndexBinding(IndexManagerHolder.java:102)
at org.hibernate.search.spi.SearchFactoryBuilder.initDocumentBuilders(SearchFactoryBuilder.java:414)
at org.hibernate.search.spi.SearchFactoryBuilder.buildNewSearchFactory(SearchFactoryBuilder.java:222)
at org.hibernate.search.spi.SearchFactoryBuilder.buildSearchFactory(SearchFactoryBuilder.java:146)
at org.hibernate.search.event.impl.FullTextIndexEventListener.initialize(FullTextIndexEventListener.java:130)
at org.hibernate.search.hcore.impl.HibernateSearchIntegrator.integrate(HibernateSearchIntegrator.java:83)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:303)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1742)
at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:94)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:905)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:890)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:74)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:200)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.access$600(PersistenceUnitServiceImpl.java:57)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:99)
... 4 more
Caused by: org.hibernate.search.SearchException: Unable to find directory provider implementation class: org.hibernate.search.infinispan.impl.InfinispanDirectoryProvider
at org.hibernate.search.util.impl.ClassLoaderHelper.classForName(ClassLoaderHelper.java:257)
at org.hibernate.search.util.impl.ClassLoaderHelper.instanceFromName(ClassLoaderHelper.java:107)
at org.hibernate.search.store.impl.DirectoryProviderFactory.createDirectoryProvider(DirectoryProviderFactory.java:74)
at org.hibernate.search.indexes.impl.DirectoryBasedIndexManager.createDirectoryProvider(DirectoryBasedIndexManager.java:232)
at org.hibernate.search.indexes.impl.DirectoryBasedIndexManager.initialize(DirectoryBasedIndexManager.java:100)
at org.hibernate.search.indexes.impl.IndexManagerHolder.createIndexManager(IndexManagerHolder.java:227)
... 19 more
Caused by: java.lang.ClassNotFoundException: org.hibernate.search.infinispan.impl.InfinispanDirectoryProvider from [Module "deployment.inov8.war:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190) [jboss-modules.jar:1.2.0.CR1]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.2.0.CR1]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.2.0.CR1]
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.2.0.CR1]
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) [jboss-modules.jar:1.2.0.CR1]
at java.lang.Class.forName0(Native Method) [rt.jar:1.7.0_17]
at java.lang.Class.forName(Class.java:266) [rt.jar:1.7.0_17]
at org.hibernate.search.util.impl.ClassLoaderHelper.classForName(ClassLoaderHelper.java:287)
at org.hibernate.search.util.impl.ClassLoaderHelper.classForName(ClassLoaderHelper.java:254)
... 24 more
17:23:38,693 ERROR [org.jboss.as.server] (DeploymentScanner-threads - 1) JBAS015870: Deploy of deployment "inov8.war" was rolled back with the following failure message:
{"JBAS014671: Failed services" => {"jboss.persistenceunit.\"inov8.war#inov8\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"inov8.war#inov8\": org.hibernate.search.SearchException: HSEARCH000103: Unable to initialize IndexManager xx.inov8.domain.innovation.InnovationComponent
Caused by: org.hibernate.search.SearchException: HSEARCH000103: Unable to initialize IndexManager xx.inov8.domain.innovation.InnovationComponent
Caused by: org.hibernate.search.SearchException: Unable to find directory provider implementation class: org.hibernate.search.infinispan.impl.InfinispanDirectoryProvider
Caused by: java.lang.ClassNotFoundException: org.hibernate.search.infinispan.impl.InfinispanDirectoryProvider from [Module \"deployment.inov8.war:main\" from Service Module Loader]"}}
17:23:38,693 INFO [org.jboss.weld.deployer] (MSC service thread 1-15) JBAS016009: Stopping weld service for deployment inov8.war
17:23:38,709 INFO [org.jboss.as.clustering.infinispan] (MSC service thread 1-15) JBAS010282: Stopped inov8.war#inov8.org.hibernate.cache.spi.UpdateTimestampsCache cache from hibernate container
17:23:38,709 INFO [org.jboss.as.clustering.infinispan] (MSC service thread 1-15) JBAS010282: Stopped inov8.war#inov8.org.hibernate.cache.internal.StandardQueryCache cache from hibernate container
17:23:38,709 INFO [org.infinispan.remoting.transport.jgroups.JGroupsTransport] (MSC service thread 1-15) ISPN000080: Disconnecting and closing JGroups Channel
17:23:38,724 INFO [org.infinispan.remoting.transport.jgroups.JGroupsTransport] (MSC service thread 1-15) ISPN000082: Stopping the RpcDispatcher
17:23:38,802 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015877: Stopped deployment inov8.war (runtime-name: inov8.war) in 119ms
默认-hibernatesearch-infinispan.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2012, Red Hat, Inc. and/or its affiliates or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat, Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
-->
<infinispan
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:infinispan:config:5.1 http://www.infinispan.org/schemas/infinispan-config-5.1.xsd"
xmlns="urn:infinispan:config:5.1">
<!-- *************************** -->
<!-- System-wide global settings -->
<!-- *************************** -->
<global>
<!-- Duplicate domains are allowed so that multiple deployments with default configuration
of Hibernate Search applications work - if possible it would be better to use JNDI to share
the CacheManager across applications -->
<globalJmxStatistics
enabled="true"
cacheManagerName="HibernateSearch"
allowDuplicateDomains="true" />
<!-- If the transport is omitted, there is no way to create distributed or clustered
caches. There is no added cost to defining a transport but not creating a cache that uses one,
since the transport is created and initialized lazily. -->
<transport
clusterName="HibernateSearch-Infinispan-cluster"
>
<!-- Note that the JGroups transport uses sensible defaults if no configuration
property is defined. See the JGroupsTransport javadocs for more flags -->
</transport>
<!-- Note that the JGroups transport uses sensible defaults if no configuration property
is defined. See the Infinispan wiki for more JGroups settings:
http://community.jboss.org/wiki/ClusteredConfigurationQuickStart -->
<!-- Used to register JVM shutdown hooks. hookBehavior: DEFAULT, REGISTER, DONT_REGISTER.
Hibernate Search takes care to stop the CacheManager so registering is not needed -->
<shutdown
hookBehavior="DONT_REGISTER" />
</global>
<!-- *************************** -->
<!-- Default "template" settings -->
<!-- *************************** -->
<default>
<locking
lockAcquisitionTimeout="20000"
writeSkewCheck="false"
concurrencyLevel="500"
useLockStriping="false" />
<!-- Invocation batching is required for use with the Lucene Directory -->
<invocationBatching
enabled="true" />
<!-- This element specifies that the cache is clustered. modes supported: distribution
(d), replication (r) or invalidation (i). Don't use invalidation to store Lucene indexes (as
with Hibernate Search DirectoryProvider). Replication is recommended for best performance of
Lucene indexes, but make sure you have enough memory to store the index in your heap.
Also distribution scales much better than replication on high number of nodes in the cluster. -->
<clustering
mode="replication">
<!-- Prefer loading all data at startup than later -->
<stateTransfer
timeout="480000"
fetchInMemoryState="true" />
<!-- Network calls are synchronous by default -->
<sync
replTimeout="20000" />
</clustering>
<jmxStatistics
enabled="true" />
<eviction
maxEntries="-1"
strategy="NONE" />
<expiration
maxIdle="-1" />
</default>
<!-- ******************************************************************************* -->
<!-- Individually configured "named" caches. -->
<!-- -->
<!-- While default configuration happens to be fine with similar settings across the -->
<!-- three caches, they should generally be different in a production environment. -->
<!-- -->
<!-- Current settings could easily lead to OutOfMemory exception as a CacheStore -->
<!-- should be enabled, and maybe distribution is desired. -->
<!-- ******************************************************************************* -->
<!-- *************************************** -->
<!-- Cache to store Lucene's file metadata -->
<!-- *************************************** -->
<namedCache
name="LuceneIndexesMetadata">
<clustering
mode="replication">
<stateTransfer
fetchInMemoryState="true" />
<sync
replTimeout="25000" />
</clustering>
<loaders>
<loader class="org.infinispan.loaders.jdbc.stringbased.JdbcStringBasedCacheStore" fetchPersistentState="false" ignoreModifications="false"
purgeOnStartup="false">
<properties>
<property name="stringsTableNamePrefix" value="ISPN_STRING_TABLE"/>
<property name="idColumnName" value="ID_COLUMN"/>
<property name="dataColumnName" value="DATA_COLUMN"/>
<property name="timestampColumnName" value="TIMESTAMP_COLUMN"/>
<property name="timestampColumnType" value="BIGINT"/>
<property name="connectionFactoryClass" value="org.infinispan.loaders.jdbc.connectionfactory.PooledConnectionFactory"/>
<property name="connectionUrl" value="jdbc:h2:mem:string_based_db;DB_CLOSE_DELAY=-1"/>
<property name="userName" value="sa"/>
<property name="driverClass" value="org.h2.Driver"/>
<property name="idColumnType" value="VARCHAR(255)"/>
<property name="dataColumnType" value="BINARY"/>
<property name="dropTableOnExit" value="true"/>
<property name="createTableOnStart" value="true"/>
</properties>
</loader>
</loaders>
</namedCache>
<!-- **************************** -->
<!-- Cache to store Lucene data -->
<!-- **************************** -->
<namedCache
name="LuceneIndexesData">
<clustering
mode="replication">
<stateTransfer
fetchInMemoryState="true" />
<sync
replTimeout="25000" />
</clustering>
<loaders>
<loader class="org.infinispan.loaders.jdbc.stringbased.JdbcStringBasedCacheStore" fetchPersistentState="false" ignoreModifications="false"
purgeOnStartup="false">
<properties>
<property name="stringsTableNamePrefix" value="ISPN_STRING_TABLE"/>
<property name="idColumnName" value="ID_COLUMN"/>
<property name="dataColumnName" value="DATA_COLUMN"/>
<property name="timestampColumnName" value="TIMESTAMP_COLUMN"/>
<property name="timestampColumnType" value="BIGINT"/>
<property name="connectionFactoryClass" value="org.infinispan.loaders.jdbc.connectionfactory.PooledConnectionFactory"/>
<property name="connectionUrl" value="jdbc:h2:mem:string_based_db;DB_CLOSE_DELAY=-1"/>
<property name="userName" value="sa"/>
<property name="driverClass" value="org.h2.Driver"/>
<property name="idColumnType" value="VARCHAR(255)"/>
<property name="dataColumnType" value="BINARY"/>
<property name="dropTableOnExit" value="true"/>
<property name="createTableOnStart" value="true"/>
</properties>
</loader>
</loaders>
</namedCache>
<!-- ***************************** -->
<!-- Cache to store Lucene locks -->
<!-- ***************************** -->
<namedCache
name="LuceneIndexesLocking">
<clustering
mode="replication">
<stateTransfer
fetchInMemoryState="true" />
<sync
replTimeout="25000" />
</clustering>
</namedCache>
</infinispan>
任何指针或指导都会非常有用。
此致 公羊
我这次检查了jar文件的依赖关系..当我将infinispan-cachestore-jdbc-5.2.1.Final.jar文件复制到classpath时,它堆积了无数错误消息..错误堆栈跟踪是,
17:46:08,301 ERROR [org.jboss.msc.service.fail](ServerService线程池 - 55)MSC00001:无法启动服务jboss.persistenceunit。&#34; inov8.war#inov8&#34; :服务jboss.persistenceunit中的org.jboss.msc.service.StartException。&#34; inov8.war #inov8&#34;:org.hibernate.search.SearchException:HSEARCH000103:无法初始化IndexManager xx.inov8.domain.innovation .innovationComponent at org.jboss.as.jpa.service.PersistenceUnitServiceImpl $ 1.run(PersistenceUnitServiceImpl.java:103)at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[rt.jar:1.7.0_17]在java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:615)[rt.jar:1.7.0_17] java.lang.Thread.run(Thread.java:722)[rt.jar:1.7。 0_17] at org.jboss.threads.JBossThread.run(JBossThread.java:122)引起:org.hibernate.search.SearchException:HSEARCH000103:无法在org.hibernate初始化IndexManager xx.inov8.domain.innovation.InnovationComponent。 search.indexes.impl.I位于org.hibernate.search.spi.SearchFactoryBuilder.initDocumentBuilders(SearchFactoryBuilder.java:414)的org.hibernate.search.indexes.impl.IndexManagerHolder.buildEntityIndexBinding(IndexManagerHolder.java:102)中的ndexManagerHolder.createIndexManager(IndexManagerHolder.java:230) org.hibernate.search.spi.SearchFactoryBuilder.buildNewSearchFactory(SearchFactoryBuilder.java:222)org.hibernate.search.spi.SearchFactoryBuilder.buildSearchFactory(SearchFactoryBuilder.java:146)atg.hibernate.search.event.impl.FullTextIndexEventListener .initialize(FullTextIndexEventListener.java:130)在org.hibernate.search.hcore.impl.HibernateSearchIntegrator.integrate(HibernateSearchIntegrator.java:83)在org.hibernate.internal.SessionFactoryImpl。(SessionFactoryImpl.java:303)在org.hibernate作为.cfg.Configuration.buildSessionFactory(Configuration.java:1742)org.hibernate.ejb.EntityManagerFactoryImpl。(EntityManagerFactoryImpl.java:94)org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Co) nfiguration.java:905)在org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:890)在org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:74)在org.jboss.as.jpa.service .PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:200)在org.jboss.as.jpa.service.PersistenceUnitServiceImpl.access $ 600(PersistenceUnitServiceImpl.java:57)在org.jboss.as.jpa.service.PersistenceUnitServiceImpl $ 1.run(PersistenceUnitServiceImpl .java:99)... 4更多引起:org.hibernate.search.SearchException:无法初始化目录提供程序:org.hibernate.search.store.impl.DirectoryProviderFactory.createDirectoryProvider中的xx.inov8.domain.innovation.InnovationComponent (DirectoryProviderFactory.java:87)位于org.hibernate.search.indexes.impl.DirectoryBasedIndexMan的org.hibernate.search.indexes.impl.DirectoryBasedIndexManager.createDirectoryProvider(DirectoryBasedIndexManager.java:232) org.infinispan.config.ConfigurationException:ager.initialize(DirectoryBasedIndexManager.java:100)在org.hibernate.search.indexes.impl.IndexManagerHolder.createIndexManager(IndexManagerHolder.java:227)... 19多个所致org.infinispan .CacheConfigurationException:无法在org.infinispan.configuration.parsing.Parser.parse(Parser.java:168)在org.infinispan.configuration.parsing.Parser.parse实例化类org.infinispan.loaders.jdbc.stringbased.JdbcStringBasedCacheStore( Parser.java:130)org.infinispan.manager.DefaultCacheManager。(DefaultCacheManager.java:368)org.infinispan.manager.DefaultCacheManager。(DefaultCacheManager.java:340)org.infinispan.manager.DefaultCacheManager。(DefaultCacheManager。 Java的:327)在org.hibernate.search.infinispan.CacheManagerServiceProvider.start(CacheManagerServiceProvider.java:93)在org.hibernate.search.engine.impl.StandardServiceManager $ ServiceProviderWrapper.startVirtual(StandardServiceManager.java:178)在org.hibernate作为。搜索引擎。 impl.StandardServiceManager.requestService(StandardServiceManager.java:124)org.hibernate.search.infinispan.impl.InfinispanDirectoryProvider.initialize(InfinispanDirectoryProvider.java:86)org.hibernate.search.store.impl.DirectoryProviderFactory.createDirectoryProvider(DirectoryProviderFactory。 java:84)... 22更多引起:org.infinispan.CacheConfigurationException:无法在org.infinispan.util.Util.loadClass(Util.java:90)实例化org.infinispan.loaders.jdbc.stringbased.JdbcStringBasedCacheStore类at org.infinispan.util.getInstance(Util.java:208)org.infinispan.configuration.parsing.Parser.parseLoader(Parser.java:546)org.infinispan.configuration.parsing.Parser.parseLoaders(Parser) .java:524)org.infinispan.configuration.parsing.Parser.parseCache(Parser.java:295)org.infinispan.configuration.parsing.ParsNamedCache(Parser.java:254)org.infinispan.configuration上的org.infinispan.configuration.parsing.Parser.parseCache(Parser.java:295)。在org.infinispan.configuration.parsing.Pa中解析.Parser.doParse(Parser.java:211) rser.parse(Parser.java:154)... 31更多引起:java.lang.ClassNotFoundException:org.infinispan.loaders.jdbc.stringbased.JdbcStringBasedCacheStore at java.net.URLClassLoader $ 1.run(URLClassLoader.java:366 )[rt.jar:1.7.0_17] at java.net.URLClassLoader $ 1.run(URLClassLoader.java:355)[rt.jar:1.7.0_17] at java.security.AccessController.doPrivileged(Native Method)[rt。 jar:1.7.0_17] at java.net.URLClassLoader.findClass(URLClassLoader.java:354)[rt.jar:1.7.0_17] at java.lang.ClassLoader.loadClass(ClassLoader.java:423)[rt.jar: 1.7.0_17] at sun.misc.Launcher $ AppClassLoader.loadClass(Launcher.java:308)[rt.jar:1.7.0_17] at java.lang.ClassLoader.loadClass(ClassLoader.java:356)[rt.jar: 1.7.0_17]在java.lang.Class.forName0(本地方法)[rt.jar:1.7.0_17] java.lang.Class.forName(Class.java:266)[rt.jar:1.7.0_17] at at org.infinispan.util.Util.loadClassStrict(Util.java:127)org.infinispan.util.Util.loadClass(Util.java:88)... 38更多
配置jdbc缓存存储或指针的任何示例都非常有用。
谢谢和问候,公羊
答案 0 :(得分:1)
按照hibernate search docs中的指南,我通过从文件{添加hibernate搜索模块(v4.3是我能找到的最接近AS4.2附带的v4.2)来完成此操作{ {1}}进入JBoss AS7的hibernate-search-modules-4.3.0.Final-jbossas-72-dist.zip
目录,然后添加到war文件的modules
jboss-deployment-structure.xml
我使用了https://issues.jboss.org/browse/WFLY-1632的解决方法,添加了
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="org.hibernate.search.orm"/>
</dependencies>
</deployment>
</jboss-deployment-structure>
进入文件<module name="org.infinispan.cachestore.jdbc"/>
在JBoss的modules/system/layers/base/org/infinispan/main/module.xml
中,我添加了一个新的standalone-ha.xml
元素,其下面有三个cache-container
元素:
replicated-cache
并将以下内容添加到<cache-container name="hibernateSearch" default-cache="repl">
<transport lock-timeout="60000"/>
<replicated-cache name="LuceneIndexesMetadata" mode="SYNC" >
<binary-keyed-jdbc-store datasource="java:/db/[datasource in JNDI]"
passivation="false" shared="true" purge="false">
<property name="createTableOnStart" >true</property>
<binary-keyed-table>
<id-column name="ID_COLUMN" type="VARCHAR(255)" />
<data-column name="DATUM" type="BLOB"/>
</binary-keyed-table>
</binary-keyed-jdbc-store>
</replicated-cache>
<!-- Above replicated-cache section additionally repeated for
name="LuceneIndexesData",name="LuceneIndexesLocking" -->
</cache-container>
persistence.xml
我在部署的战争中不包含任何核心hibernate或hibernate搜索jar,因为它们是由JBoss提供的,所以我更新了war POM以排除它们:
<property name="hibernate.search.infinispan.cachemanager_jndiname" value="java:jboss/infinispan/container/hibernateSearch" />
<property name="hibernate.search.default.directory_provider" value="infinispan" />