Hibernate does not work in the app console - java

There was a problem after I connected the hibernate dependency to my project via the maven. Everything works in IntelliJ Idea, but if I run the jar from the console, then it throws me an error.
Exception in thread "main" java.lang.ExceptionInInitializerError
at org.hibernate.boot.registry.BootstrapServiceRegistryBuilder.build(BootstrapServiceRegistryBuilder.java:218)
at org.hibernate.boot.registry.StandardServiceRegistryBuilder.<init>(StandardServiceRegistryBuilder.java:87)
Caused by: java.lang.IllegalArgumentException: Invalid logger interface org.hibernate.internal.CoreMessageLogger (implementation not found in sun.misc.Launcher$AppClassLoader#7f31245a)
I can’t understand what the reason for this behavior is. Here is the version I'm using
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.5.7.Final</version>
</dependency>

Related

Http 500 error in soap API java due to jaxb jar file

One of my soapAPI was giving HTTP 500 error. when we searched in log we got the below issue.
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'validator'. Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628)
To remove this issue we put below jar in our pom.xml
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.2.11</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.2.11</version>
</dependency>
and this issue gone. But unfortunately code is creating problem in other places. The functionality which were working earlier now giving http 500 error. When we remove the above jar the original issues comes but new issue vanished.
Are we doing some mistake by including above jar files? is there any guess to get it done? I know issue seems somewhat strange but it is coming like this only. We are using java 8 , jsp and struts.
We did not do any code changes.

ClassCastException on JAXBContext after upgrading to Java 11

After upgrading to Java 11 my PDF generation stop working (using Apache FOP) with the following error.
Caused by: jakarta.xml.bind.JAXBException: ClassCastException: attempting to cast
jar:file:jakarta.xml.bind-api-3.0.0.jar!/jakarta/xml/bind/JAXBContext.class to
jar:file:jakarta.xml.bind-api-3.0.0.jar!/jakarta/xml/bind/JAXBContext.class.
Please make sure that you are specifying the proper ClassLoader.
Which make no sense at all since it's the same file. Previous problems solved migrating to jakarta but this remains.
Adding the following dependency solves de issue
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>3.0.0</version>
</dependency>

Elasticsearch client java.lang.ExceptionInInitializerError in 5.3

Following code listed here on TransportClient.
Using elasticsearch and client dependencies.
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>5.3.0</version>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>transport</artifactId>
<version>5.3.0</version>
</dependency>
Exception:
Exception in thread "main" java.lang.ExceptionInInitializerError
at org.elasticsearch.common.logging.DeprecationLogger.<clinit>(DeprecationLogger.java:138)
at org.elasticsearch.common.xcontent.support.AbstractXContentParser.<init>(AbstractXContentParser.java:57)
at org.elasticsearch.common.xcontent.json.JsonXContentParser.<init>(JsonXContentParser.java:44)
at org.elasticsearch.common.xcontent.json.JsonXContent.createParser(JsonXContent.java:103)
at org.elasticsearch.common.settings.Setting.parseableStringToList(Setting.java:832)
at org.elasticsearch.common.settings.Setting.lambda$listSetting$27(Setting.java:786)
at org.elasticsearch.common.settings.Setting.listSetting(Setting.java:791)
at org.elasticsearch.common.settings.Setting.listSetting(Setting.java:786)
at org.elasticsearch.common.network.NetworkService.<clinit>(NetworkService.java:50)
at org.elasticsearch.client.transport.TransportClient.newPluginService(TransportClient.java:98)
at org.elasticsearch.client.transport.TransportClient.buildTemplate(TransportClient.java:126)
at org.elasticsearch.client.transport.TransportClient.<init>(TransportClient.java:268)
at org.elasticsearch.transport.client.PreBuiltTransportClient.<init>(PreBuiltTransportClient.java:125)
at org.elasticsearch.transport.client.PreBuiltTransportClient.<init>(PreBuiltTransportClient.java:111)
at org.elasticsearch.transport.client.PreBuiltTransportClient.<init>(PreBuiltTransportClient.java:101)
at xxx.test.runner.ESRunner.initESClient(ESRunner.java:120)
at xxx.test.runner.ESRunner.inti(ESRunner.java:62)
at xxx.test.runner.ESRunner.main(ESRunner.java:46)
Caused by: java.lang.IllegalStateException: Error finding the build shortHash. Stopping Elasticsearch now so it doesn't run in subtly broken ways. This is likely a build bug.
at org.elasticsearch.Build.<clinit>(Build.java:62)
... 18 more
Could it missing some dependency, or something else? Any help is appreciated. Thanks.
i had the same problem. use 5.2.2 instead. the problem is (at least for me) that the transportClient of 5.3 reads the manifest file of the jar which isn't possible because the application runs on wildfly (the jar file is on a virtual file system)

org.apache.commons.validator.EmailValidator

I am trying to validate the email: hello.world#cir.care
boolean isValidEmail = EmailValidator.getInstance().isValid("hello.world#cir.care")
It throws error when I use commonvalidator 1.14 but its works with 1.5.1
Error StackTrace:
org.apache.axis2.engine.AxisEngine receive null org.apache.axis2.AxisFault
Caused by: java.lang.reflect.InvocationTargetException
Caused by: java.lang.NoClassDefFoundError: org/apache/oro/text/perl/Perl5Util
boths the jars are available in server path.
Please suggest me if I miss any thing?
Download and add the following jar in your server path apache-jakarta-oro.jar
Also refer the following link for more options
NoClassDefFoundError problems with help of Apache Commons Validator
If you are using maven add this dependency to the project repository
<dependency>
<groupId>oro</groupId>
<artifactId>oro</artifactId>
<version>2.0.8</version>
</dependency>

Maven compilation and run time error java.lang.AbstractMethodError: oracle.jdbc.driver.T4CConnection.isValid(I)Z on Tomcat 8 Server

I've been converting a large Java Web App to a maven project, but I've run into an error in a handful of classes originating from the tomcat-dbcp jar. I get the following error messages from any class that needs to use BasicDataSource objects:
javax.servlet.ServletException: java.lang.AbstractMethodError: oracle.jdbc.driver.T4CConnection.isValid(I)Z
java.lang.AbstractMethodError: oracle.jdbc.driver.T4CConnection.isValid(I)Z
Now I know this jar is present on the server (as it is default in our Tomcat8 installation). So in maven I declared this dependency as such:
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-dbcp</artifactId>
<version>8.0.26</version>
<scope>provided</scope>
</dependency>
But I'm still seeing this error. What can I do to eliminate this error?
This error did go away, though I have no idea why. The pom entry is still the same and still running on Tomcat 8. We did find a hacky temporary fix:
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.1</version>
<scope>system</scope>
<systemPath>${basedir}/lib/ojdbc7-12.1.0.1.jar</systemPath>
</dependency>
But we reverted back at some point and it is working fine.

Categories

Resources