Configuring maven with EJB and JSF: Critical error during deployment - maven

I have been migrating an ear project from Ant to Maven and I found with this problem:
GRAVE: Critical error during deployment:
com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! The default implementation must override this method
The POM configuration from project web is the next:
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.alquilaweb</groupId>
<artifactId>Maven-ejb</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.1.7</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.1.7</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>${primefaces.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
I googled a lot, but I could not find any solution. Maybe it is an stupid thing, but I canĀ“t find where happens this exception.
Regards,
Sarang

I was also getting the same error. Then I updated my JDK Compiler version to 1.8 and it worked for me.

Related

org.springframework.aop.framework.AopConfigException

I'm trying to run Spring application with Hibernate on Wildly 13.
This is my POM configuration:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webflux</artifactId>
<version>5.0.7.RELEASE</version>
</dependency>
<dependency>
<groupId>io.projectreactor.ipc</groupId>
<artifactId>reactor-netty</artifactId>
<version>0.7.8.RELEASE</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.9.5</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
<version>2.9.5</version>
</dependency>
<dependency>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>woodstox-core-asl</artifactId>
<version>4.4.1</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.2.11</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.2.11</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>1.5.10.RELEASE</version>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>8.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
<version>1.5.10.RELEASE</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.5</version>
</dependency>
But when I deploy the package I get this error:
deployment.datalis_db.war//org.springframework.aop.framework.CglibAopProxy.getProxy(CglibAopProxy.java:201)
... 62 more
Caused by: java.lang.InstantiationException: org.springframework.boot.autoconfigure.web.HttpMessageConverters$$EnhancerBySpringCGLIB$$3ba87c15
at java.base/java.lang.Class.newInstance(Class.java:547)
at deployment.datalis_db.war//org.springframework.aop.framework.ObjenesisCglibAopProxy.createProxyClassAndInstance(ObjenesisCglibAopProxy.java:73)
... 63 more
Caused by: java.lang.NoSuchMethodException: org.springframework.boot.autoconfigure.web.HttpMessageConverters$$EnhancerBySpringCGLIB$$3ba87c15.<init>()
at java.base/java.lang.Class.getConstructor0(Class.java:3302)
Full log with error stack:
https://pastebin.com/fXSE1k7t
Do I need to exclude some dependency in my POM file?
Can you give e some advice how I can fix this issue?
A few of those dependencies should likely be marked as <scope>provided</scope>. For example javax.servlet:javax.servlet-api, both the JAXB API and implementation and javax.activation:acitivation should definitely be marked as provided.
Also Servlet 4.0 is only available if you enable Java EE 8 preview mode, by passing -Dee8.preview.mode=true. This can be passed on the command like when you launch the server, be placed as a system property in the configuration or added to the JAVA_OPTS.

Resolving same classes defined in different dependencies

I'm running into a strange issue where I have two dependencies in my Maven file that both define BasicLineFormatter.class. The issue that I am running into is that one of my dependencies obviously uses a different version that the code is expecting and it throws and error.
How can I tell Maven that I want to use my standard http-core dependency for this class rather than the one that is causing an issue.
RESOURCE LOCATION: jar:file:/var/lib/tomcat8/webapps/ROOT/WEB-INF/lib/tika-app-1.10.jar!/org/apache/http/message/BasicLineFormatter.class
My pom.xml looks like this:
<groupId>xxx</groupId>
<artifactId>xxx</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>xxx</name>
<dependencies>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-bundle</artifactId>
<version>1.18.3</version>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.8.3</version>
</dependency>
<dependency>
<groupId>com.mashape.unirest</groupId>
<artifactId>unirest-java</artifactId>
<version>1.4.6</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.3.3</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.3.6</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpasyncclient</artifactId>
<version>4.0.2</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.3.6</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20140107</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
<version>1.8.10</version>
</dependency>
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>fontbox</artifactId>
<version>1.8.10</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
</dependency>
<dependency>-->
<groupId>org.apache.tika</groupId>
<artifactId>tika-app</artifactId>
<version>1.10</version>
</dependency>
</dependencies>
My code is getting the BasicLineFormatter class from the Tika dependency which is causing the issue. I want it to be coming from my defined http-core which is the correct version. It also seems to be ignoring the ordering the dependencies in the file.
Use - Shade Plugin - https://maven.apache.org/plugins/maven-shade-plugin/examples/includes-excludes.html
Reference - Maven dependency: exclude one class

how to fix java.lang.ClassNotFoundException: org.apache.hadoop.hbase.HBaseConfiguration

I am using hadoop and hbase. the hbase version is 1.1.1.2.3. I try to use maven to compile, run the project. But it has the org.apache.hadoop.hbase.HBaseConfiguration not find problem.
Here is my pom.xml:
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-core</artifactId>
<version>0.20.2</version>
</dependency>
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
<version>3.4.6</version>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>2.4.0a</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>11.0.2</version>
</dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-client</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-common</artifactId>
<version>0.23.1</version>
</dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-protocol</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase</artifactId>
<version>0.94.27</version>
</dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-server</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-testing-util</artifactId>
<version>1.1.1</version>
</dependency>
</dependencies>
dependencies are as above, I really do not know what to add more. Could anyone help? with many thanks. I know there are many problems similar but none of them is using the newest version base and I tried there solution, does not work. thanks
Furthermore, I tried to add the dependency: http://mvnrepository.com/artifact/org.apache.hbase/hbase/1.1.1
but get error: Failed to execute goal on project hbaseTable: Could not resolve dependencies for project apache.hbase:hbaseTable:jar:0.0.1-SNAPSHOT: Failure to find org.apache.hbase:hbase:jar:1.1.1 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced

What are the minimal pom dependencies of Xpand?

I use Xpand for code generation inside a maven plugin project. So, I need to add the required libraries as dependencies in pom.xml in order to define and use Xpand templates. What is the minimum list of dependencies that should be added to the pom?
you may take the following as starting point
<dependencies>
<dependency>
<groupId>org.eclipse.xpand</groupId>
<artifactId>org.eclipse.xtend</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.xpand</groupId>
<artifactId>org.eclipse.xpand</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.xpand</groupId>
<artifactId>org.eclipse.xtend.typesystem.emf</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>org.eclipse.emf.mwe.utils</artifactId>
<version>1.3.5</version>
</dependency>
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>org.eclipse.emf.mwe.core</artifactId>
<version>1.3.5</version>
</dependency>
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>ecore</artifactId>
<version>2.3.0-v200706262000</version>
</dependency>
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>20040117.000000</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>org.eclipse.emf.mwe2.runtime</artifactId>
<version>2.7.1</version>
</dependency>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr-runtime</artifactId>
<version>3.5.2</version>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>icu4j</artifactId>
<version>55.1</version>
</dependency>
</dependencies>

Issue with Hibernate Search and Spring Integration

I have been trying to integrate Spring with Hibernate Search but getting different exceptions with different versions.
In my pom.xml I have following dependencies
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>2.1.8.1</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-spring-plugin</artifactId>
<version>2.1.8.1</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.9</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
<version>2.5.6</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>2.5.6</version>
</dependency>
<dependency>
<groupId>asm</groupId>
<artifactId>asm-all</artifactId>
<version>3.3</version>
</dependency>
<dependency>
<groupId>asm</groupId>
<artifactId>asm</artifactId>
<version>3.3</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>3.6.7.Final</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-convention-plugin</artifactId>
<version>2.1.8.1</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-tiles-plugin</artifactId>
<version>2.1.8.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.15</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
<version>1.6</version>
</dependency>
<dependency>
<groupId>com.jgeppert.struts2.jquery</groupId>
<artifactId>struts2-jquery-plugin</artifactId>
<version>3.5.1</version>
</dependency>
<dependency>
<groupId>com.jgeppert.struts2.jquery</groupId>
<artifactId>struts2-jquery-grid-plugin</artifactId>
<version>3.5.1</version>
</dependency>
<dependency>
<groupId>com.jgeppert.struts2.jquery</groupId>
<artifactId>struts2-jquery-richtext-plugin</artifactId>
<version>3.5.1</version>
</dependency>
<dependency>
<groupId>com.jgeppert.struts2.jquery</groupId>
<artifactId>struts2-jquery-tree-plugin</artifactId>
<version>3.5.1</version>
</dependency>
<dependency>
<groupId>com.jgeppert.struts2.jquery</groupId>
<artifactId>struts2-jquery-mobile-plugin</artifactId>
<version>3.5.1</version>
</dependency>
I have also tried to get the actual version of hibernate (3.2.0 Final) from my tests so that I can easily compare the compatibility of hiberante search with my application's hiberante version.
String hibernateVersion = org.hibernate.annotations.common.Version.VERSION;
System.out.println("Hibernate Version: "+ hibernateVersion);
But whenever I just add these lines into my pom file
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-search</artifactId>
<version>3.1.0.GA</version>
</dependency>
and try to deploy my application then it gives me an exception
ERROR org.springframework.web.context.ContextLoader.initWebApplicationContext:215 - Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource ....
....
....
Caused by: java.lang.NoSuchMethodError: org.hibernate.util.SoftLimitMRUCache.<init>(I)V
Mandatory:
Change all Struts2 jars from 2.1.8.1 to 2.3.16
Change struts2-jquery-plugin from 3.5.1 to 3.7.0 (or it won't work with 2.3.16, only with lower versions)
Suggested:
Upgrade Hibernate to 4.x
Upgrade Spring to 3.x
If possible, use Hibernate as JPA2 implementation, instead of using it as raw Hibernate (old way). Then you will discover that Spring is no longer needed (for persistence at least), especially if you are using JAVA EE 6.
P.S: you will need to upgrade also Apache Commons and other shared libraries according to the latest version, just use Maven Repository to get the proper version numbers.

Resources