Can't deploy war because ClassCastException: org.hibernate.jpa.HibernatePersistenceProvider incompatible javax.persistence.spi.PersistenceProvider - jpa-2.1

I got this error even i have created a shared lib on was 9, this lib contains all the hibernate 5.4.3 dependency including javax.persistence 2.2

Do you really needs JPA 2.2 ?
I was able to deploy my EAR under WAS 9 using hibernate 5.2.17 (starting from 5.3 hibernate is JPA 2.2 compliant)
WAS 9 it seems compatible only with JPA 2.0 and JPA 2.1
I created the shared lib using following lists of jars
E:\hibernate-release-5.2.17.Final\lib\envers\hibernate-envers-5.2.17.Final.jar
E:\hibernate-release-5.2.17.Final\lib\jpa-metamodel-generator\hibernate-jpamodelgen-5.2.17.Final.jar
E:\hibernate-release-5.2.17.Final\lib\optional\c3p0\c3p0-0.9.5.2.jar
E:\hibernate-release-5.2.17.Final\lib\optional\c3p0\hibernate-c3p0-5.2.17.Final.jar
E:\hibernate-release-5.2.17.Final\lib\optional\c3p0\mchange-commons-java-0.2.11.jar
E:\hibernate-release-5.2.17.Final\lib\optional\ehcache\ehcache-2.10.3.jar
E:\hibernate-release-5.2.17.Final\lib\optional\ehcache\hibernate-ehcache-5.2.17.Final.jar
E:\hibernate-release-5.2.17.Final\lib\optional\ehcache\slf4j-api-1.7.7.jar
E:\hibernate-release-5.2.17.Final\lib\optional\infinispan\hibernate-infinispan-5.2.17.Final.jar
E:\hibernate-release-5.2.17.Final\lib\optional\infinispan\infinispan-commons-8.2.5.Final.jar
E:\hibernate-release-5.2.17.Final\lib\optional\infinispan\infinispan-core-8.2.5.Final.jar
E:\hibernate-release-5.2.17.Final\lib\optional\infinispan\jboss-marshalling-osgi-1.4.10.Final.jar
E:\hibernate-release-5.2.17.Final\lib\optional\infinispan\jgroups-3.6.7.Final.jar
E:\hibernate-release-5.2.17.Final\lib\optional\proxool\hibernate-proxool-5.2.17.Final.jar
E:\hibernate-release-5.2.17.Final\lib\optional\proxool\proxool-0.8.3.jar
E:\hibernate-release-5.2.17.Final\lib\osgi\byte-buddy-1.6.14.jar
E:\hibernate-release-5.2.17.Final\lib\osgi\hibernate-osgi-5.2.17.Final.jar
E:\hibernate-release-5.2.17.Final\lib\osgi\javax.interceptor-api-1.2.jar
E:\hibernate-release-5.2.17.Final\lib\osgi\org.osgi.compendium-4.3.1.jar
E:\hibernate-release-5.2.17.Final\lib\osgi\org.osgi.core-4.3.1.jar
E:\hibernate-release-5.2.17.Final\lib\required\antlr-2.7.7.jar
E:\hibernate-release-5.2.17.Final\lib\required\classmate-1.3.0.jar
E:\hibernate-release-5.2.17.Final\lib\required\dom4j-1.6.1.jar
E:\hibernate-release-5.2.17.Final\lib\required\hibernate-commons-annotations-5.0.1.Final.jar
E:\hibernate-release-5.2.17.Final\lib\required\hibernate-core-5.2.17.Final.jar
E:\hibernate-release-5.2.17.Final\lib\required\jandex-2.0.3.Final.jar
E:\hibernate-release-5.2.17.Final\lib\required\javassist-3.22.0-GA.jar
E:\hibernate-release-5.2.17.Final\lib\required\jboss-logging-3.3.1.Final.jar
It is important on the Shared Lib def to check "Class Loading - Use an isolated class loader for this shared library"
and on the Applicatiion --> Class Loader --> Class Loader Order --> select Classes Loaded with Local Class Loader First (Parent Last)
I'm looking too to use up-to-date Hibernate 5.4.x (stable) and in the future the 6.x.. but having similar issue
If eventually you was able to use Hibernate 5.4.x.. can you share ?
Regards

Related

Spring Kafka 2.9.3 NoClassDefFound - AlterIsrRequest$Builder on EmbeddedKafka Start up

Trying to upgrade the springboot application which uses spring kafka to version 2.9.3 from 2.8.4.
I have followed the instructions here to pulldown kafka-client version 3.2.3 as a separate dependency.
My dependencies looks like this
implementation("org.springframework.kafka:spring-kafka:2.9.3") {
exclude group: "org.apache.kafka", module: "kafka-streams"
exclude group: "org.apache.kafka", module: "kafka-clients"
}
implementation("org.apache.kafka:kafka-clients:3.2.3")
testImplementation("org.springframework.kafka:spring-kafka-test:2.9.3")
When I try to kick off a test which makes use of EmbeddedKafka.
I am getting this NoClassDefFound error
Caused by: java.lang.NoClassDefFoundError: org/apache/kafka/common/requests/AlterIsrRequest$Builder
at kafka.server.KafkaServer.startup(KafkaServer.scala:313)
at kafka.utils.TestUtils$.createServer(TestUtils.scala:177)
at kafka.utils.TestUtils$.createServer(TestUtils.scala:172)
at kafka.utils.TestUtils.createServer(TestUtils.scala)
at org.springframework.kafka.test.EmbeddedKafkaBroker.afterPropertiesSet(EmbeddedKafkaBroker.java:350)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800)
... 87 more
Caused by: java.lang.ClassNotFoundException: org.apache.kafka.common.requests.AlterIsrRequest$Builder
at java.net.URLClassLoader.findClass(URLClassLoader.java:387)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
... 94 more
I think I am missing a dependency?
You have a version mis-match between the kafka-clients and other kafka jars. All kafka jars must be the same version since the server uses classes from the clients jar.
I don't see AlterIsrRequest in jars since 3.1.2 - so it looks like, somehow, you have older kafka server jars on the class path.
spring-kafka-test:2.9.3 should pull in 3.2.3 transitively.
Since you are using Spring Boot, it will pull in 3.1.2 instead.
See the documentation (https://docs.spring.io/spring-kafka/docs/2.9.3/reference/html/#update-deps) for how to override the dependencies when using Spring Boot.

spring annotation based configuration of appengine-web.xml

I want to convert my spring and hibernate based project into gce project.
but don't know how to convert appengine-web.xml into annotation.
Didn't find any source with annotation based configuration.
i tried to add xml in project but it throws an error:
Unable to stage:
java.lang.IllegalArgumentException: Class file is Java 8 but max supported is Java 7 com/mysql/cj/api/CacheAdapter.class
i checked and found similar problem:
how to Fix Class file is Java 8 but max supported is Java 7
but solution over there is not able to solve my issue.
then i changed project configuration into java 7 but problem remains same.
google app engine by default supports java 7. Add <vm>true</vm> into your appengine-web.xml and use flexible environment to work with java 8.
appengine-web.xml
<!-- [START config] -->
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>xxxxxxxxxxxx</application>
<vm>true</vm>
<threadsafe>true</threadsafe>
<use-google-connector-j>true</use-google-connector-j>
<system-properties>
<property name="ae-cloudsql.cloudsql-database-url" value="jdbc:google:mysql://connectionName:instanceName/DBName?user=USER&password=PASSWORD;" />
</system-properties>
</appengine-web-app>
<!-- [END config] -->

Namespace 3.6 in the application descriptor file should be equal or higher than the minimum version 13.0 required by the Flex SDK

I am new to Flash Builder and setup the 4.7 environment according to these instructions: http://www.adobe.com/devnet/air/articles/ane-android-devices.html
The end of the tutorial involves "Export Release Build" of ANESampleTest (a Flex project) and I am getting this error:
"Namespace 3.6 in the application descriptor file should be equal or higher than the minimum version 13.0 required by the Flex SDK"
I do not have a good understanding of Flash/Flex/Air/etc, but following the tutorial to the letter to install Flash Builder, updating the SDK to 3.6, and the partial 'overlay' steps. How do I resolve this error message?
The fix: Change the namespace on the second line of /src/ANESampleTest-app.xml
FROM: <application xmlns="http://ns.adobe.com/air/application/3.6">
TO: <application xmlns="http://ns.adobe.com/air/application/13.0">
A brief and incomplete background:
The file /src/ANESampleTest-app.xml is the ‘application descriptor file’. When using the project files downloaded with the tutorial (that contained the 3.6 reference), the builder did not find this compatible with the configuration on my computer (a trial version I installed today - 5/3/2014 - and patched according to the tutorial). I never did figure out how to lookup valid namespaces and am still confused about how all the sdk’s relate to each other. I stumbled upon this solution by creating a fresh new project and found that the namespace specified by the new project wizard was “13.0” on this line of this file.

forEach is not working with Spring3 + Tiles 2+ Jstl 1.2 + Weblogic 9.2

whenever I use a c:foreach tag in my jspx files I'm getting below error
Caused by: java.lang.NoSuchMethodError: javax.servlet.jsp.PageContext.getELContext()Ljavax/el/ELContext;
at javax.servlet.jsp.jstl.core.LoopTagSupport.unExposeVariables(LoopTagSupport.java:587)
at javax.servlet.jsp.jstl.core.LoopTagSupport.doFinally(LoopTagSupport.java:323)
at jsp_servlet._web_45_inf._views.__matchdriverpopup_jspx._jspService(__matchdriverpopup_jspx.java:1160)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:225)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:127)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
at weblogic.servlet.internal.RequestDispatcherImpl.invokeServlet(RequestDispatcherImpl.java:496)
at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:245)
at org.apache.tiles.servlet.context.ServletTilesRequestContext.forward(ServletTilesRequestContext.java:241)
How can I solve this? This is only related to c:forEach. All other tags are working fine. I have follwing jar files in APP-INF/lib folder of EAR and tiles-jsp-2.2.0.jar and jstl-1.2.jar in my WEB-INF/lib of WAR file. web.xml version - 2.4
tiles-api-2.2.0
tiles-core-2.2.0
tiles-jsp-2.2.0
tiles-servlet-2.2.0
tiles-template-2.2.0
Please help, Thanks in advance
This exception indicates that the JSTL API is of a newer version than the JSTL impl. And indeed, Weblogic already ships with JSTL bundled. It's apparently of an older version than the one in your webapp. The newer JSTL API is been loaded from your webapp, but the older JSTL impl is been loaded from Weblogic.
Remove the JSTL libraries from your webapp so that the webapp will just use Weblogic's own ones.

seam solder (former weld-extensions project) is not initialized

I want to use logger in my java web application.
I'm using JBossAS 6.0.0.final, cdi (weld), jsf ... etc. Seam solder proposes to use an abstract logger is not tying to a concrete implementation (slf4j, log4j, etc) using jboss-logging api.
In order to get this logger in your code will need to write
# Inject
org.jboss.logging.Logger log
seam-solder.jar has the producer for this logger.
package org.jboss.seam.solder.log;
...
class LoggerProducers
{
# Produces
org.jboss.logging.Logger produceLog (InjectionPoint injectionPoint) {}
}
When I deploying my application, I get an error
15:51:18,300 ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] Error installing to Start: name=vfs:///C:/Java/jboss-6.0.0.Final/server/default/deploy/kamis-web-client.5.0.0-SNAPSHOT.ear_WeldBootstrapBean state=Create: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [Logger] with qualifiers [#Default] at injection point [[field] #Inject private ru.kamis.suite.webclient.web.breadcrumbs.BreadcrumbsManager.log]
This is due to the seam-solder.jar has not META-INF/beans.xml file, and it is necessary for cdi container.
If to add beans.xml file in seam-solder.jar manually, then the application works WELL.
How to do without hacks?
To build my application I use maven, so my solution is not comfortable and NOT fine.
PS: Former weld-extensions project contained META-INF/beans.xml file in jar.
with seam-solder-3.0.0.Beta1 there should be no need to modify the jar

Resources