Migration of javax.persistence to jakarta.persistence - java

I am trying to migrate javax.persistence to jakarta.persistence and curently I seem to be unable to overcome following error:
Class org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider does not implement the requested interface javax.persistence.spi.PersistenceProvider
My dependencies are:
org.eclipse.persistence:org.eclipse.persistence.jpa:3.0.2
org.hibernate:hibernate-entitymanager:5.6.5.Final
org.hibernate:hibernate-c3p0:5.6.5.Final
org.hibernate:hibernate-core-jakarta:5.6.5.Final
jakarta.validation:jakarta.validation-api:3.0.1
org.hibernate.validator:hibernate-validator:7.0.2.Final
org.hibernate.validator:hibernate-validator-cdi:7.0.2.Final
org.springframework:spring-context:5.3.15
org.springframework:spring-orm:5.3.15
org.springframework:spring-tx:5.3.15
org.springframework:spring-core:5.3.15
org.springframework:spring-aop:5.3.15
org.springframework:spring-aspects:5.3.15
Can you lead me to what I am including wrongly?

These are my dependencies. I use Spring 5, but I don't use Spring JPA.
<!--### HIBERNATE5 ###-->
<module groupId="jakarta.persistence" artifactId="jakarta.persistence-api" version="3.0.0"/>
<module groupId="jakarta.xml.bind" artifactId="jakarta.xml.bind-api" version="3.0.1"/>
<module groupId="org.hibernate" artifactId="hibernate-core-jakarta" version="5.6.4.Final"/>
<module groupId="org.jboss" artifactId="jandex" version="2.4.2.Final"/>
<module groupId="antlr" artifactId="antlr" version="2.7.7"/>
<module groupId="net.bytebuddy" artifactId="byte-buddy" version="1.10.17"/>
<module groupId="jakarta.transaction" artifactId="jakarta.transaction-api" version="2.0.0"/>
<module groupId="org.hibernate.common" artifactId="hibernate-commons-annotations" version="5.1.2.Final"/>
<module groupId="org.dom4j" artifactId="dom4j" version="2.1.3"/>
<module groupId="org.javassist" artifactId="javassist" version="3.27.0-GA"/>
<module groupId="org.jboss.logging" artifactId="jboss-logging" version="3.4.1.Final"/>
<module groupId="com.fasterxml" artifactId="classmate" version="1.5.1"/>

Related

How to configure WildFly version 27 to use EclipseLink?

I am trying to deploy applications currently running on WildFly 26.1.2.Final to WildFly 27.0.0.Final. The deployment fails with the following error:
ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7) MSC000001: Failed to start service jboss.deployment.unit."jee2ap102-ear.ear".FIRST_MODULE_USE: org.jboss.msc.service.StartException in service jboss.deployment.unit."jee2ap102-ear.ear".FIRST_MODULE_USE: WFLYSRV0153: Failed to process phase FIRST_MODULE_USE of deployment "jee2ap102-ear.ear"
at org.jboss.as.server#19.0.0.Final//org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:189)
at org.jboss.msc#1.4.13.Final//org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1739)
at org.jboss.msc#1.4.13.Final//org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1701)
at org.jboss.msc#1.4.13.Final//org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1559)
at org.jboss.threads#2.4.0.Final//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads#2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990)
at org.jboss.threads#2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
at org.jboss.threads#2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: jakarta.persistence.PersistenceException: WFLYJPA0057: PersistenceProvider 'org.eclipse.persistence.jpa.PersistenceProvider' not found
at org.jboss.as.jpa#27.0.0.Final//org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.lookupProvider(PersistenceUnitServiceHandler.java:999)
at org.jboss.as.jpa#27.0.0.Final//org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.nextPhaseDependsOnPersistenceUnit(PersistenceUnitServiceHandler.java:1042)
at org.jboss.as.jpa#27.0.0.Final//org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.deploy(PersistenceUnitServiceHandler.java:138)
at org.jboss.as.jpa#27.0.0.Final//org.jboss.as.jpa.processor.PersistenceBeginInstallProcessor.deploy(PersistenceBeginInstallProcessor.java:52)
at org.jboss.as.server#19.0.0.Final//org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:182)
... 8 more
I used the same configuration that I have been using for previous versions, that is:
Copy eclipselink-2.7.8.jar to C:\wildfly-27.0.0.Final\modules\system\layers\base\org\eclipse\persistence\main.
Modify the module.xml file in that directory to add the resource corresponding to eclipselink-2.7.8.jar. Now the file looks like this:
<properties>
<property name="jboss.api" value="public"/>
</properties>
<resources>
<resource-root path="jipijapa-eclipselink-27.0.0.Final.jar"/>
<resource-root path="eclipselink-2.7.8.jar">
<filter>
<exclude path="javax/**" />
</filter>
</resource-root>
</resources>
<dependencies>
<module name="java.logging"/>
<module name="java.management"/>
<module name="java.naming"/>
<module name="jakarta.annotation.api"/>
<module name="jakarta.enterprise.api"/>
<module name="jakarta.json.api" optional="true"/>
<module name="jakarta.persistence.api"/>
<module name="jakarta.transaction.api"/>
<module name="jakarta.validation.api"/>
<module name="jakarta.xml.bind.api"/>
<module name="org.antlr"/>
<module name="org.apache.commons.collections"/>
<module name="org.dom4j"/>
<module name="org.jboss.as.jpa.spi"/>
<module name="org.jboss.logging"/>
<module name="org.jboss.vfs"/>
</dependencies>
The persistence.xml file had no modifications; it looks like this:
<persistence
version="2.1"
xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="jee2ap102-ejb-pu" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>jdbc/jee2ap102</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="eclipselink.target-server" value="JBoss"/>
<property name="eclipselink.weaving" value="static"/>
</properties>
</persistence-unit>
</persistence>
I'm using the same eclipselink-2.7.8.jar for both WildFly 26 and 27. I'm sure class org.eclipse.persistence.jpa.PersistenceProvider is in that jar, but even so WildFly 27 can't find it.
EDIT 11/19/2022
I also tried using eclipselink 3.0.3. It also fails. This is the error message:
INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 18) WFLYJPA0003: Starting Persistence Unit Service 'jee2ap102-ear.ear/jee2ap102-ejb.jar#jee2ap102-ejb-pu'
ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 18) MSC000001: Failed to start service jboss.persistenceunit."jee2ap102-ear.ear/jee2ap102-ejb.jar#jee2ap102-ejb-pu": org.jboss.msc.service.StartException in service jboss.persistenceunit."jee2ap102-ear.ear/jee2ap102-ejb.jar#jee2ap102-ejb-pu": java.lang.NoClassDefFoundError: java/rmi/RemoteException
at org.jboss.as.jpa#27.0.0.Final//org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:199)
at org.jboss.as.jpa#27.0.0.Final//org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:129)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at org.wildfly.security.elytron-base#2.0.0.Final//org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:664)
at org.jboss.as.jpa#27.0.0.Final//org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:214)
at org.jboss.threads#2.4.0.Final//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads#2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990)
at org.jboss.threads#2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
at org.jboss.threads#2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
at java.base/java.lang.Thread.run(Thread.java:834)
at org.jboss.threads#2.4.0.Final//org.jboss.threads.JBossThread.run(JBossThread.java:513)
Caused by: java.lang.NoClassDefFoundError: java/rmi/RemoteException
at org.eclipse.persistence//org.eclipse.persistence.jpa.PersistenceProvider.createContainerEntityManagerFactoryImpl(PersistenceProvider.java:331)
at org.eclipse.persistence//org.eclipse.persistence.jpa.PersistenceProvider.createContainerEntityManagerFactory(PersistenceProvider.java:316)
at org.jboss.as.jpa#27.0.0.Final//org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:367)
at org.jboss.as.jpa#27.0.0.Final//org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:191)
... 10 more
Caused by: java.lang.ClassNotFoundException: java.rmi.RemoteException from [Module "org.eclipse.persistence" from local module loader #fb9c7aa (finder: local module finder #4c398c80 (roots: C:\wildfly-27.0.0.Final\modules,C:\wildfly-27.0.0.Final\modules\system\layers\base))]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:200)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:410)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
... 14 more
At this point I tried adding java.management.rmi and java.rmi as module dependencies, but it didn't work with either of them.
I will be very grateful for any help in solving this problem.
Take a look into the changelog:
We don’t plan to support Jakarta EE 8 in standard WildFly. The WildFly 26.1 releases will be the last that support EE 8.
Use Eclipselink 3.0.0 because it supports Jakarta EE 9 in which all namespaces have been adapted to jakarta.* in comparison to the old one javax.*.
With Wildfly 27 and Eclipselink 4 the following updated module.xml works (see commented changes):
<module name="org.eclipse.persistence" xmlns="urn:jboss:module:1.9">
<properties>
<property name="jboss.api" value="public"/>
</properties>
<resources>
<resource-root path="jipijapa-eclipselink-27.0.1.Final.jar"/>
<!-- Added Eclipselink library -->
<resource-root path="eclipselink-4.0.0.jar"/>
</resources>
<dependencies>
<module name="java.logging"/>
<module name="java.management"/>
<module name="java.naming"/>
<!-- Added rmi dependency used by Eclipselink -->
<module name="java.rmi"/>
<!-- Added desktop dependency used by Eclipselink -->
<module name="java.desktop"/>
<module name="jakarta.annotation.api"/>
<module name="jakarta.enterprise.api"/>
<module name="jakarta.json.api" optional="true"/>
<module name="jakarta.persistence.api"/>
<module name="jakarta.transaction.api"/>
<module name="jakarta.validation.api"/>
<module name="jakarta.xml.bind.api"/>
<module name="org.antlr"/>
<module name="org.jboss.as.jpa.spi"/>
<module name="org.jboss.logging"/>
<module name="org.jboss.vfs"/>
</dependencies>
</module>
add <module name="javax.api"/> to your dependencies, i also did not add the filter attribute to my resource-root as that caused an exception loop. Also, if you get a Failed to define class org.eclipse.persistence.jpa.rs.exceptions.JPARSExceptionMapper, add <module name="javax.ws.rs.api"/> to the dependencies as well.
Your final configured module.xml file should look like this:
<module name="org.eclipse.persistence" xmlns="urn:jboss:module:1.9">
<properties>
<property name="jboss.api" value="public"/>
</properties>
<resources>
<resource-root path="jipijapa-eclipselink-27.0.0.Final.jar"/>
<resource-root path="eclipselink.jar"/>
</resources>
<dependencies>
<module name="java.logging"/>
<module name="java.management"/>
<module name="java.naming"/>
<module name="javax.api"/>
<module name="jakarta.annotation.api"/>
<module name="jakarta.enterprise.api"/>
<module name="jakarta.json.api" optional="true"/>
<module name="jakarta.persistence.api"/>
<module name="jakarta.transaction.api"/>
<module name="jakarta.validation.api"/>
<module name="jakarta.xml.bind.api"/>
<module name="javax.ws.rs.api"/>
<module name="org.antlr"/>
<module name="org.apache.commons.collections"/>
<module name="org.dom4j"/>
<module name="org.jboss.as.jpa.spi"/>
<module name="org.jboss.logging"/>
<module name="org.jboss.vfs"/>
</dependencies>
</module>

Wildfly 26 Jakarta EE 9.1

Background
Transforming a Wildfly 17 Java EE project (EAR) to Wildfly 26 and Jakarta EE9.1
Updated all dependencies and changed imports. Also some code changes necessary.
Now i am stuck on resteasy-core-spi-6.0.0.Beta1
When deploying i get this error:
Caused by: java.lang.IncompatibleClassChangeError: Expected static method 'java.lang.Object org.jboss.resteasy.spi.ResteasyProviderFactory.getContextData(java.lang.Class)'
The Code that calls this method looks like this.
FooClass foo = ResteasyProviderFactory.getContextData(FooClass .class);
A look at the SPI Class reveals this.
public static <T> T getContextData(Class<T> type) {
return getContextDataMap().get(type);
}
That looks perfectly fine.
Examining the Wildfly system dir and looking in the module for same jar.(resteasy-core-spi-6.0.0.Beta1,jar)
reveals this
<resources>
<resource-root path="resteasy-core-spi-6.0.0.Beta1.jar"/>
</resources>
<dependencies>
<module name="java.desktop"/>
<module name="java.logging"/>
<module name="java.management"/>
<module name="java.naming"/>
<module name="java.xml"/>
<module name="javax.activation.api"/>
<module name="javax.annotation.api"/>
<module name="javax.enterprise.api"/>
<module name="javax.servlet.api"/>
<module name="javax.validation.api"/>
<module name="javax.xml.bind.api"/>
<module name="javax.ws.rs.api"/>
<module name="org.jboss.logging"/>
<module name="org.reactivestreams"/>
</dependencies>
I tried to update that to jakarta namespace but no change.
I am at a loss here, do anyone have some ideas?

Use WildFly module both datasource and connectionFactory

I have a module in Wildfly to use as my datasource to Firebird. It works great
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="org.firebirdsql">
<resources>
<resource-root path="jaybird-2.2.13.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
<module name="javax.resource.api"/>
<module name="javax.xml.bind.api"/> <!-- Jaybird 3.0 onwards doesn't need this -->
<module name="org.antlr4"/>
</dependencies>
</module>
and the jar is put inside the directory of module.xml.
But I want to use the driver both with data source and also to create a pure JDBC connection in connectionfactory like Class.forName("org.firebirdsql.jdbc.FBDriver");, not using data source provided by the server.
If I put jaybird in pom.xml I got errors. I think because this is duplicating the libs. How can I solve this?
I just added the below code under <subsystem xmlns="urn:jboss:domain:ee:4.0">
<global-modules>
<module name="org.firebirdsql" slot="main"/>
</global-modules>
Thanks, Mark Rotteveel for answer on the Jaybird bug tracker.

Unable to query Infinispan on JBoss 7 due to SearchFactoryIntegrator not being in the registry

TL:DR I'm getting the following error and I can see no reason for it, indexing is enabled, and the SearchFactoryIntegrator is on the classpath for everything that needs to see it.
Indexing was not enabled on this cache. interface
org.hibernate.search.spi.SearchFactoryIntegrator not found in registry
Long Version:
JBoss version: 7.1.1 FINAL
Infinispan version: 5.16 (upgraded from 5.1.2 JBoss ships with in attempts to solve issue)
Java Version: 1.7
I am attempting to build a simple test application to run queries against an Infinispan cache.
I am successfully adding objects to the cache. The cache is defined as private org.infinispan.Cache<String, Agent> cache; with Agent being my own object.
When attempting to query the cache I get the following error from the line
SearchManager searchManager = Search.getSearchManager(cache);
17:35:43,873 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/SearchableCacheTest].[Faces Servlet]] (http-localhost-127.0.0.1-8080-1) Servlet.service() for servlet Faces Servlet threw exception: java.lang.IllegalArgumentException: Indexing was not enabled on this cache. interface org.hibernate.search.spi.SearchFactoryIntegrator not found in registry
at org.infinispan.query.impl.ComponentRegistryUtils.getComponent(ComponentRegistryUtils.java:40) [infinispan-query-5.1.6.FINAL.jar:5.1.6.FINAL]
at org.infinispan.query.SearchManagerImpl.<init>(SearchManagerImpl.java:56) [infinispan-query-5.1.6.FINAL.jar:5.1.6.FINAL]
at org.infinispan.query.Search.getSearchManager(Search.java:39) [infinispan-query-5.1.6.FINAL.jar:5.1.6.FINAL]
The important part being
Indexing was not enabled on this cache. interface org.hibernate.search.spi.SearchFactoryIntegrator not found in registry
Prior to this error cache.getCacheConfiguration().indexing().enabled() resolves to true
The cache is a modified version of the default "cluster" cache already configured in the standalone-ha.xml of JBoss.
<cache-container name="cluster" aliases="ha-partition" default-cache="default" start="EAGER">
<transport lock-timeout="60000"/>
<replicated-cache name="default" mode="SYNC" batching="true" indexing="LOCAL">
<locking isolation="REPEATABLE_READ"/>
<store class="org.infinispan.loaders.file.FileCacheStore" preload="true" passivation="false" fetch-state="true" purge="false">
<property name="location">
/tempCacheIndex
</property>
</store>
</replicated-cache>
</cache-container>
I see the index being created in the configured file location so it seems that enabled boolean resolving to true is a factual representation of the current state.
I have created an org.infinispan.query module in JBoss and it contains the following
avro-1.5.1.jar
hibernate-commons-annotations-4.0.1.Final.jar
hibernate-search-engine-4.1.1.Final.jar
infinispan-query-5.1.6.FINAL.jar
jackson-core-asl-1.9.2.jar
jackson-mapper-asl-1.9.2.jar
lucene-core-3.5.0.jar
paranamer-2.3.jar
slf4j-api-1.6.1.jar
snappy-java-1.0.4.1.jar
All of the above are defined in as resource-roots in the module.xml for that module.
I have modified the module.xml for the module org.infinispan to have a dependency on the module org.infinispan.query
I have declared dependencies on both those modules in my jboss-deployment-structure.xml
Does anyone have any ideas why this might be happening and perhaps have a solution?
Note: There is a very similar question here but he was ultimately unsuccessful and chose a different route.
NOTE: I started with a clean JBoss 7.1.1 instance and hence reverted from Infinispan 5.1.6 to 5.1.2
For my needs I modified the existing cluster cache so it looks like this
<cache-container name="cluster" aliases="ha-partition"
default-cache="default" start="EAGER">
<transport lock-timeout="60000" />
<replicated-cache name="default" mode="SYNC" batching="true"
indexing="LOCAL">
<locking isolation="REPEATABLE_READ" />
<store class="org.infinispan.loaders.file.FileCacheStore"
preload="true" passivation="false" fetch-state="true" purge="false">
<property name="location">
/tempCacheIndex
</property>
</store>
</replicated-cache>
Then to actually be able to query the cache create the org.infinispan.query module containing the jars mentioned in the following module.xml
<module xmlns="urn:jboss:module:1.1" name="org.infinispan.query">
<resources>
<resource-root path="avro-1.5.1.jar"/>
<resource-root path="hibernate-commons-annotations-4.0.1.Final.jar"/>
<resource-root path="hibernate-search-4.1.0.Beta1.jar"/>
<resource-root path="hibernate-search-analyzers-4.1.0.Beta1.jar"/>
<resource-root path="hibernate-search-engine-4.1.0.Beta1.jar"/>
<resource-root path="hibernate-search-orm-4.1.0.Beta1.jar"/>
<resource-root path="infinispan-query.jar"/>
<resource-root path="jackson-core-asl-1.9.2.jar"/>
<resource-root path="jackson-mapper-asl-1.9.2.jar"/>
<resource-root path="lucene-analyzers-3.5.0.jar"/>
<resource-root path="lucene-core-3.5.0.jar"/>
<resource-root path="lucene-grouping-3.5.0.jar"/>
<resource-root path="lucene-highlighter-3.5.0.jar"/>
<resource-root path="lucene-memory-3.5.0.jar"/>
<resource-root path="lucene-misc-3.5.0.jar"/>
<resource-root path="lucene-smartcn-3.5.0.jar"/>
<resource-root path="lucene-spatial-3.5.0.jar"/>
<resource-root path="lucene-spellchecker-3.5.0.jar"/>
<resource-root path="lucene-stempel-3.5.0.jar"/>
<resource-root path="paranamer-2.3.jar"/>
<resource-root path="slf4j-api-1.6.1.jar"/>
<resource-root path="snappy-java-1.0.4.1.jar"/>
<resource-root path="solr-analysis-extras-3.5.0.jar"/>
<resource-root path="solr-commons-csv-3.5.0.jar"/>
<resource-root path="solr-core-3.5.0.jar"/>
<resource-root path="solr-solrj-3.5.0.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
<module name="org.hibernate"/>
<module name="org.infinispan" services="import" export="true"/>
<module name="org.apache.commons.codec"/>
<module name="org.apache.commons.io"/>
<module name="org.apache.commons.lang"/>
<module name="com.google.guava"/>
<module name="org.slf4j" export="true"/>
<module name="org.jboss.logging"/>
</dependencies>
Modify the org.jboss.as.clustering.infinspan module xml to include a dependency on the new query module but also the org.hibernate module that already exists. So add the following to that file.
<module name="org.hibernate" services="import"/>
<module name="org.infinispan.query" services="import"/>
The jboss-deployment-structure.xml of your app needs to have the following dependencies added to it
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<dependencies>
<module export="true" name="org.hibernate" services="import"/>
<module export="true" name="org.infinispan" services="import"/>
<module export="true" name="org.infinispan.query" services="import"/>
</dependencies>
</deployment>
</jboss-deployment-structure>
For annotating your objects so they can be indexed and searched I suggest you look at the samples here
EDIT:
FURTHER NOTE:
To get indexed objects to actually share over the cache I now had to
Create a jar containing all the classes that you plan to put in the cache.
Make sure these entities do not contain anything too complex it terms of imports or you'll run into class loader issues.
Create a module from this jar, and give it a dependency on the Infinispan.query module.
Expose this module as a global module (is this actually needed?) in the standalone.xml or domain.xml whichever is appropriate.
Find the file modules/org/jboss/as/clustering/infinispan/main/module.xml
Add your new module containing your cachable entities to the list of dependencies

Unable to exclude logmanager module on JBoss 6 EAP

I'm trying to exclude all the logging modules from a jboss-deployment-structure.xml in JBoss 6 EAP.
My jboss-deployment-structure.xml is:
<jboss-deployment-structure>
<deployment>
<exclusions>
<module name="org.apache.log4j" />
<module name="org.jboss.logging" />
<module name="org.jboss.logmanager" />
<module name="org.jboss.log4j.logmanager" />
</exclusions>
</deployment>
</jboss-deployment-structure>
So after I deploy my .war with said configuration I get:
[ModuleClassLoader for Module "org.jboss.log4j.logmanager:main" from local module loader #10ab323 (roots: /home/me/dev/jboss-eap-6.0/modules)] whereas object of type "org.apache.log4j.ConsoleAppender" was loaded by [ModuleClassLoader for Module "deployment.myapp.war:main" from Service Module Loader].
So I generally want to make JBoss stop trying to load log4j and let my application load it.
Is it at all possible to disable the logmanager module ?
Thanks,
I was able to resolve this problem using this jboss-deployment-structure.xml
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
<deployment>
<exclusions>
<module name="org.apache.log4j"/>
<module name="org.apache.commons.logging"/>
</exclusions>
</deployment>
Which I have created under WEB-INF. You should also put your log4j.jar in WEB-INF/lib.

Categories

Resources