Deploying JPA 2 (OpenJPA) on Jboss 7.1.0-Final-Snapshot - openjpa

I have deployed axis2 on Jboss 7.1.0 Final Snapshot. We have a service (.aar) which uses OPenJPA 2.1.
All the OpenJPA jars are packaged within the service archive.
When I start the server I see this error message
Constructor threw exception; nested exception is java.lang.RuntimeException: javax.persistence.PersistenceException: No Persistence provider for EntityManager named example
I have defined the provider in the persistence.xml as org.apache.openjpa.persistence.PersistenceProviderImpl
Structure of my Service is as follows,
SampleOpenJPAService.aar
|-lib
|-myJPAClasses.jar
Can anyone help me in understanding What is going wrong here.
regards,
sathwik

Related

Trying to deploy EAR in JBOSS 7.3. EJB.jar is not being looked up by the application in classpath

The structure of EAR is like this
EAR - Contains lmsweb.war and lmsEJB.jar
After deploying , when the application is trying to lookup at the bean, getting error as below
Unable to Get NamingException :javax.naming.CommunicationException: EJBCLIENT000062: Failed to look up "lms/lmsEJB/ejb/TestHome!com.lms.ejb.test.TestHome" [Root exception is java.lang.ClassNotFoundException: com.lms.ejb.test.TestHome from [Module "deployment.lms.ear.lmsWeb.war" from Service Module Loader]]
This class is inside the ejb module i.e., "deployment.lms.ear.lmsEJB.jar"
Can someone throw light on how to make the application look into the ejb module to get the class.

How to use HibernateValidator with Java Modular System and JavaSE

I have a very simple JPA project based on eclipselink. All subprojects have module-info files, so they are java modules. And I have a huge problem with Hibernate Validator integration:
jakarta.persistence.PersistenceException: Exception [EclipseLink-28019] (Eclipse Persistence Services - 3.0.2.v202107160933): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Deployment of PersistenceUnit [TEST_RENT_PU] failed. Close all factories for this PersistenceUnit.
Internal Exception: Exception [EclipseLink-30014] (Eclipse Persistence Services - 3.0.2.v202107160933): org.eclipse.persistence.exceptions.PersistenceUnitLoadingException
Exception Description: The persistence unit specifies validation-mode as "CALLBACK" but a Bean Validation ValidatorFactory could not be initialized. Please refer to the nested exception for details. Please ensure that Bean Validation API and Bean Validation Provider is available in classpath.
Internal Exception: java.util.ServiceConfigurationError: jakarta.validation.spi.ValidationProvider: module jakarta.validation does not declare uses
without module-info.java file everything works perfectly (all required libraries are added to pom.xml). As you can see I changed validation settings in persistence.xml file to CALLBACK. With AUTO setting bean validation does not work at all. How should I change the project configuration to make Hibernate Validator working in JPMS environment?

java.lang.IllegalArgumentException: XNIO001001: No XNIO provider found when configuring JBoss EAP 7.1 Client

I am trying to configure my ESB server as a client for JBoss EAP 7.1 integrated Active MQ Artemis which will connect using the RemoteConnectionFactory. However, I couldn't use the JBoss client jar as it conflicts with the internal JARs. Therefore, I added all the necessary JARs separately.
Now an exception is being thrown saying no provider found.
I have added both xnio-api and xnio-nio jars.
Below is the exception.
Caused by: java.lang.IllegalArgumentException: XNIO001001: No XNIO provider found
at org.xnio.Xnio.doGetInstance(Xnio.java:226)
at org.xnio.Xnio.getInstance(Xnio.java:192)
at org.jboss.naming.remote.client.EndpointCache.get(EndpointCache.java:47)
at org.jboss.naming.remote.client.InitialContextFactory.createEndpoint(InitialContextFactory.java:226)
at org.jboss.naming.remote.client.InitialContextFactory.getOrCreateEndpoint(InitialContextFactory.java:207)
at org.jboss.naming.remote.client.InitialContextFactory.getOrCreateNamingStore(InitialContextFactory.java:170)
at org.jboss.naming.remote.client.InitialContextFactory.getInitialContext(InitialContextFactory.java:146)
... 50 more
How do I resolve this error?

#WebServiceRef wsdlLocation can not refer to a classpath entry in JBoss EAP 7 / Wildfly 10

When injecting a webservice client with #WebServiceRef in JBoss EAP, the wsdl is not found by the app server. The webservice client has been generated and the wsdl is bundled with the jar file. When trying to refer to the classpath of the wsdl in the wsdlLocation attribute of the #WebServiceRef annotation, JBoss will produce the following exception:
Caused by: java.io.IOException: WFLYWS0039: Child '/wsdl/mywsdlfile.wsdl' not found for VirtualFile: "/C:/jboss/standalone/deployments/mywebapp.war"
How do I correctly refer to the wsdl which resides in the webservice client jar?
Try this:
<wsdlLocation>/WEB-INF/classes/wsdl/*</wsdlLocation>
Works in my case.
Regards.

Not loading the persistence provider class in runtime

I have created RestService enabled with JPA(Generic 2.0 version). Using jersey jars and hibernate entity manager jar as dependencies.
Deployment is successfull in tomcat. But when any transaction is processed, getting below exception in runtime.
java.lang.ClassNotFoundException: javax.persistence.spi.PersistenceProvider
What could be the issue, not loading the persistence provider class even it is in the classpath ?
What do you mean with classpath? The library/jar of the Persistence Provider Hibernate and the JPA (javax.persistence) have to be in the ear/war file so that Tomcat is able to access them.
How do you create that ear/war file? With Maven? Then you have to set the dependencies at least to runtime.