My EAR application runs fine when i don't use openJpa. Once i use open JPA i get the "SLF4J fail to load class blaaa ". How to configure the openJpa module to use the SL4J which i provide from pom.xml and avoid that error?
I use JBOSS 7.1.1
pom.xml
<properties>
<slf4j.version>1.7.3</slf4j.version>
<logback.version>1.0.10</logback.version>
</properties>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>${logback.version}</version>
</dependency>
.......
openjpa module.xml
<module xmlns="urn:jboss:module:1.1" name="org.apache.openjpa">
<resources>
<resource-root path="openjpa-2.2.0.jar"/>
<resource-root path="openjpa-all-2.2.0.jar"/>
</resources>
<dependencies>
<module name="javax.persistence.api"/>
<module name="javax.transaction.api"/>
<module name="javax.validation.api"/>
<module name="org.apache.commons.lang"/>
<module name="org.apache.commons.collections"/>
<module name="org.slf4j"/>
</dependencies>
</module>
jboss-deployment-structure.xml
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<!-- Exclusions allow you to prevent the server from automatically adding some dependencies -->
<exclusions>
<module name="org.slf4j" />
<module name="org.slf4j.impl" />
</exclusions>
</deployment>
</jboss-deployment-structure>
error
10:17:53,854 ERROR [stderr] (MSC service thread 1-4) SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
10:17:53,860 ERROR [stderr] (MSC service thread 1-4) SLF4J: Defaulting to no-operation (NOP) logger implementation
10:17:53,866 ERROR [stderr] (MSC service thread 1-4) SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
10:17:53,873 SEVERE [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-4) Critical error during deployment: : java.lang.LinkageError: loader constraint violation: when resolving interface method "org.slf4j.ILoggerFactory.getLogger(Ljava/lang/String;)Lorg/slf4j/Logger;" the class loader (instance of org/jboss/modules/ModuleClassLoader) of the current class, org/slf4j/LoggerFactory, and the class loader (instance of org/jboss/modules/ModuleClassLoader) for resolved class, org/slf4j/ILoggerFactory, have different Class objects for the type org/slf4j/Logger used in the signature
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:242) [openjpa-all-2.2.0.jar:2.2.0]
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:254) [openjpa-all-2.2.0.jar:2.2.0]
at net.sf.ehcache.CacheManager.<clinit>(CacheManager.java:131) [ehcache-ee-2.6.2.jar:]
at com.zreflect.emyed.whiteboard.controller.CacheController.<init>(CacheController.java:39) [classes:]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [rt.jar:1.6.0_25]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) [rt.jar:1.6.0_25]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) [rt.jar:1.6.0_25]
at java.lang.reflect.Constructor.newInstance(Constructor.java:513) [rt.jar:1.6.0_25]
at java.lang.Class.newInstance0(Class.java:355) [rt.jar:1.6.0_25]
at java.lang.Class.newInstance(Class.java:308) [rt.jar:1.6.0_25]
at com.sun.faces.mgbean.BeanBuilder.newBeanInstance(BeanBuilder.java:188) [jsf-impl-2.1.7-jbossorg-2.jar:]
at com.sun.faces.mgbean.BeanBuilder.build(BeanBuilder.java:102) [jsf-impl-2.1.7-jbossorg-2.jar:]
at com.sun.faces.mgbean.BeanManager.createAndPush(BeanManager.java:409) [jsf-impl-2.1.7-jbossorg-2.jar:]
at com.sun.faces.mgbean.BeanManager.create(BeanManager.java:269) [jsf-impl-2.1.7-jbossorg-2.jar:]
at com.sun.faces.mgbean.BeanManager.create(BeanManager.java:256) [jsf-impl-2.1.7-jbossorg-2.jar:]
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:255) [jsf-impl-2.1.7-jbossorg-2.jar:]
at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3392) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3850) [jbossweb-7.0.13.Final.jar:]
at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_25]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_25]
at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_25]
10:17:54,007 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/emyed-whiteboard]] (MSC service thread 1-4) Exception sending context initialized event to listener instance of class com.sun.faces.config.ConfigureListener: java.lang.RuntimeException: java.lang.LinkageError: loader constraint violation: when resolving interface method "org.slf4j.ILoggerFactory.getLogger(Ljava/lang/String;)Lorg/slf4j/Logger;" the class loader (instance of org/jboss/modules/ModuleClassLoader) of the current class, org/slf4j/LoggerFactory, and the class loader (instance of org/jboss/modules/ModuleClassLoader) for resolved class, org/slf4j/ILoggerFactory, have different Class objects for the type org/slf4j/Logger used in the signature
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:292) [jsf-impl-2.1.7-jbossorg-2.jar:]
at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3392) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3850) [jbossweb-7.0.13.Final.jar:]
at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_25]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_25]
at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_25]
Caused by: java.lang.LinkageError: loader constraint violation: when resolving interface method "org.slf4j.ILoggerFactory.getLogger(Ljava/lang/String;)Lorg/slf4j/Logger;" the class loader (instance of org/jboss/modules/ModuleClassLoader) of the current class, org/slf4j/LoggerFactory, and the class loader (instance of org/jboss/modules/ModuleClassLoader) for resolved class, org/slf4j/ILoggerFactory, have different Class objects for the type org/slf4j/Logger used in the signature
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:242) [openjpa-all-2.2.0.jar:2.2.0]
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:254) [openjpa-all-2.2.0.jar:2.2.0]
at net.sf.ehcache.CacheManager.<clinit>(CacheManager.java:131) [ehcache-ee-2.6.2.jar:]
at com.zreflect.emyed.whiteboard.controller.CacheController.<init>(CacheController.java:39) [classes:]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [rt.jar:1.6.0_25]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) [rt.jar:1.6.0_25]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) [rt.jar:1.6.0_25]
at java.lang.reflect.Constructor.newInstance(Constructor.java:513) [rt.jar:1.6.0_25]
at java.lang.Class.newInstance0(Class.java:355) [rt.jar:1.6.0_25]
at java.lang.Class.newInstance(Class.java:308) [rt.jar:1.6.0_25]
at com.sun.faces.mgbean.BeanBuilder.newBeanInstance(BeanBuilder.java:188) [jsf-impl-2.1.7-jbossorg-2.jar:]
at com.sun.faces.mgbean.BeanBuilder.build(BeanBuilder.java:102) [jsf-impl-2.1.7-jbossorg-2.jar:]
at com.sun.faces.mgbean.BeanManager.createAndPush(BeanManager.java:409) [jsf-impl-2.1.7-jbossorg-2.jar:]
at com.sun.faces.mgbean.BeanManager.create(BeanManager.java:269) [jsf-impl-2.1.7-jbossorg-2.jar:]
at com.sun.faces.mgbean.BeanManager.create(BeanManager.java:256) [jsf-impl-2.1.7-jbossorg-2.jar:]
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:255) [jsf-impl-2.1.7-jbossorg-2.jar:]
... 8 more
It looks like you're probably getting two different versions of sfl4j. Add <scope>provided</scope> to your slf4j dependency. The other option would be to provide a jboss-deployment-structure.xml to exclude the servers slf4j.
Example jboss-deployment-structure.xml:
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
<deployment>
<exclusions>
<module name="org.slf4j" />
</exclusions>
</deployment>
</jboss-deployment-structure>
Also make sure you don't have a transitive slf4j dependencies, like sfl4j-jdk14.jar.
Related
I'm having troubles generating the initial changelog from the JPA Entities of my Spring-Boot project.
My pom.xml is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.6.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>eu.project</groupId>
<artifactId>organization</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>organization</name>
<description>Project Organization</description>
<properties>
<java.version>14</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!--======================================== OAuth2 Resource Server ========================================-->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>5.3.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-oauth2-jose</artifactId>
<version>5.3.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-oauth2-resource-server</artifactId>
<version>5.3.1.RELEASE</version>
</dependency>
<!--=============================================== Database ===============================================-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
<version>3.8.9</version>
</dependency>
<dependency>
<groupId>org.liquibase.ext</groupId>
<artifactId>liquibase-hibernate5</artifactId>
<version>3.8</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>3.8.9</version>
<configuration>
<propertyFile>./src/main/resources/database/liquibase/isolated/liquibase.properties</propertyFile>
</configuration>
<dependencies>
<dependency>
<groupId>org.liquibase.ext</groupId>
<artifactId>liquibase-hibernate5</artifactId>
<version>3.8</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
and the following is the liquibase.properties file:
changeLogFile=src/main/resources/database/liquibase/isolated/master.xml
outputChangeLogFile=src/main/resources/database/liquibase/isolated/init.xml
url=hibernate:spring:eu.project.organization.domain.isolated?dialect=liquibase.ext.hibernate.database.HibernateGenericDialect
defaultSchemaName=public
driver=liquibase.ext.hibernate.database.connection.HibernateDriver
verbose=true
When I run the command
mvn liquibase:generateChangeLog -X
It keeps getting a NullPointerException on the catalogs of the DB [Full log on Pastebin]:
[DEBUG] com.datical.liquibase.ext.storedlogic.checkconstraint.postgres.PostgresCheckConstraintSnapshotGenerator matches liquibase.snapshot.SnapshotGenerator
[DEBUG] com.datical.liquibase.ext.storedlogic.trigger.postgres.PostgresTriggerSnapshotGenerator matches liquibase.snapshot.SnapshotGenerator
[DEBUG] Computed checksum for 1586893861875 as 5a982a4378e869d59b22108df3d2b645
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.192 s
[INFO] Finished at: 2020-04-14T21:51:01+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:3.8.9:generateChangeLog (default-cli) on project organization:
[ERROR] Error setting up or running Liquibase:
[ERROR] liquibase.command.CommandExecutionException: java.lang.NullPointerException
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.liquibase:liquibase-maven-plugin:3.8.9:generateChangeLog (default-cli) on project organization:
Error setting up or running Liquibase:
liquibase.command.CommandExecutionException: java.lang.NullPointerException
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:567)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException:
Error setting up or running Liquibase:
liquibase.command.CommandExecutionException: java.lang.NullPointerException
at org.liquibase.maven.plugins.AbstractLiquibaseMojo.execute (AbstractLiquibaseMojo.java:405)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:567)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: liquibase.exception.LiquibaseException: liquibase.command.CommandExecutionException: java.lang.NullPointerException
at liquibase.integration.commandline.CommandLineUtils.doGenerateChangeLog (CommandLineUtils.java:289)
at liquibase.integration.commandline.CommandLineUtils.doGenerateChangeLog (CommandLineUtils.java:258)
at org.liquibase.maven.plugins.LiquibaseGenerateChangeLogMojo.performLiquibaseTask (LiquibaseGenerateChangeLogMojo.java:122)
at org.liquibase.maven.plugins.AbstractLiquibaseMojo.execute (AbstractLiquibaseMojo.java:401)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:567)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: liquibase.command.CommandExecutionException: java.lang.NullPointerException
at liquibase.command.AbstractCommand.execute (AbstractCommand.java:24)
at liquibase.integration.commandline.CommandLineUtils.doGenerateChangeLog (CommandLineUtils.java:287)
at liquibase.integration.commandline.CommandLineUtils.doGenerateChangeLog (CommandLineUtils.java:258)
at org.liquibase.maven.plugins.LiquibaseGenerateChangeLogMojo.performLiquibaseTask (LiquibaseGenerateChangeLogMojo.java:122)
at org.liquibase.maven.plugins.AbstractLiquibaseMojo.execute (AbstractLiquibaseMojo.java:401)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:567)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: java.lang.NullPointerException
at liquibase.snapshot.jvm.JdbcSnapshotGenerator.getDatabaseCatalogNames (JdbcSnapshotGenerator.java:147)
at liquibase.snapshot.jvm.CatalogSnapshotGenerator.snapshotObject (CatalogSnapshotGenerator.java:35)
at liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot (JdbcSnapshotGenerator.java:66)
at liquibase.snapshot.SnapshotGeneratorChain.snapshot (SnapshotGeneratorChain.java:49)
at liquibase.snapshot.DatabaseSnapshot.include (DatabaseSnapshot.java:316)
at liquibase.snapshot.DatabaseSnapshot.init (DatabaseSnapshot.java:101)
at liquibase.snapshot.DatabaseSnapshot.<init> (DatabaseSnapshot.java:60)
at liquibase.snapshot.JdbcDatabaseSnapshot.<init> (JdbcDatabaseSnapshot.java:39)
at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot (SnapshotGeneratorFactory.java:217)
at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot (SnapshotGeneratorFactory.java:190)
at liquibase.command.core.DiffCommand.createReferenceSnapshot (DiffCommand.java:229)
at liquibase.command.core.DiffCommand.createDiffResult (DiffCommand.java:151)
at liquibase.command.core.GenerateChangeLogCommand.run (GenerateChangeLogCommand.java:60)
at liquibase.command.AbstractCommand.execute (AbstractCommand.java:19)
at liquibase.integration.commandline.CommandLineUtils.doGenerateChangeLog (CommandLineUtils.java:287)
at liquibase.integration.commandline.CommandLineUtils.doGenerateChangeLog (CommandLineUtils.java:258)
at org.liquibase.maven.plugins.LiquibaseGenerateChangeLogMojo.performLiquibaseTask (LiquibaseGenerateChangeLogMojo.java:122)
at org.liquibase.maven.plugins.AbstractLiquibaseMojo.execute (AbstractLiquibaseMojo.java:401)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:567)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Apparently the changelog is being generated correcltly because it shows the computed checksum, but it fails in the end at
Caused by: java.lang.NullPointerException
at liquibase.snapshot.jvm.JdbcSnapshotGenerator.getDatabaseCatalogNames (JdbcSnapshotGenerator.java:147)
How can I fix this problem in order to have it generating the changelog based on the JPA entities without having to use a real Database?
UPDATE
After adding
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<version>2.2.6.RELEASE</version>
</dependency>
the error message changed and now it is:
Caused by: java.lang.ClassNotFoundException: Could not load requested class : eu.project.organization.domain.isolated.Employee
at org.hibernate.boot.registry.classloading.internal.AggregatedClassLoader.findClass (AggregatedClassLoader.java:210)
at java.lang.ClassLoader.loadClass (ClassLoader.java:588)
at java.lang.ClassLoader.loadClass (ClassLoader.java:521)
at java.lang.Class.forName0 (Native Method)
at java.lang.Class.forName (Class.java:416)
at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.classForName (ClassLoaderServiceImpl.java:130)
at org.hibernate.boot.model.source.internal.annotations.AnnotationMetadataSourceProcessorImpl.<init> (AnnotationMetadataSourceProcessorImpl.java:109)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess$1.<init> (MetadataBuildingProcess.java:155)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete (MetadataBuildingProcess.java:149)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata (EntityManagerFactoryBuilderImpl.java:900)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build (EntityManagerFactoryBuilderImpl.java:931)
at liquibase.ext.hibernate.database.HibernateEjb3Database.buildMetadataFromPath (HibernateEjb3Database.java:58)
at liquibase.ext.hibernate.database.HibernateDatabase.buildMetadata (HibernateDatabase.java:145)
at liquibase.ext.hibernate.database.HibernateDatabase.setConnection (HibernateDatabase.java:85)
at liquibase.database.DatabaseFactory.findCorrectDatabaseImplementation (DatabaseFactory.java:129)
at liquibase.database.DatabaseFactory.openDatabase (DatabaseFactory.java:149)
at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject (CommandLineUtils.java:97)
at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject (CommandLineUtils.java:67)
at org.liquibase.maven.plugins.AbstractLiquibaseMojo.execute (AbstractLiquibaseMojo.java:349)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:567)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Finally got it working by adding the Bean Validation API & Javassist dependencies to the liquibase plugin.
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>3.8.9</version>
<configuration>
<propertyFile>./src/main/resources/database/liquibase/isolated/liquibase.properties</propertyFile>
</configuration>
<dependencies>
<dependency>
<groupId>org.liquibase.ext</groupId>
<artifactId>liquibase-hibernate5</artifactId>
<version>3.8</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<version>2.2.6.RELEASE</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.1.Final</version>
</dependency>
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.27.0-GA</version>
</dependency>
</dependencies>
</plugin>
The liquibase.properties file is as follows:
changeLogFile=src/main/resources/database/liquibase/isolated/master.xml
outputChangeLogFile=src/main/resources/database/liquibase/isolated/init.xml
url=hibernate:spring:eu.project.organization.domain.isolated?dialect=liquibase.ext.hibernate.database.HibernateGenericDialect&hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy
driver=liquibase.ext.hibernate.database.connection.HibernateDriver
Now, running the command mvn liquibase:generateChangeLog correctly generates the initial changelog in the init.xml file.
I am trying using Hibernate-Search for add full text search capabilities but when i try deploy the ear proyect on glashfish application server i get the Lucene40PostingsFormat classCastException.
here it is the complete server log:
Información: HHH000412: Hibernate Core {[WORKING]}
Información: HHH000206: hibernate.properties not found
Información: HHH000021: Bytecode provider name : javassist
Información: HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
Información: HHH000400: Using dialect: org.hibernate.dialect.DerbyDialect
WARN: HHH000430: The DerbyDialect dialect has been deprecated; use one of the version-specific dialects instead
Información: HSEARCH000034: Hibernate Search 5.5.4.Final
Información: HHH000476: Executing import script 'org.hibernate.tool.schema.internal.exec.ScriptSourceInputNonExistentImpl#50ae9aef'
Grave: java.lang.ExceptionInInitializerError
at org.apache.lucene.codecs.PostingsFormat.forName(PostingsFormat.java:112)
at org.apache.lucene.codecs.lucene40.Lucene40Codec.<init>(Lucene40Codec.java:115)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at java.lang.Class.newInstance(Class.java:442)
at org.apache.lucene.util.NamedSPILoader.reload(NamedSPILoader.java:67)
at org.apache.lucene.util.NamedSPILoader.<init>(NamedSPILoader.java:45)
at org.apache.lucene.util.NamedSPILoader.<init>(NamedSPILoader.java:37)
at org.apache.lucene.codecs.Codec$Holder.<clinit>(Codec.java:47)
at org.apache.lucene.codecs.Codec.getDefault(Codec.java:140)
at org.apache.lucene.index.LiveIndexWriterConfig.<init>(LiveIndexWriterConfig.java:120)
at org.apache.lucene.index.IndexWriterConfig.<init>(IndexWriterConfig.java:140)
at org.hibernate.search.store.spi.DirectoryHelper.initializeIndexIfNeeded(DirectoryHelper.java:54)
at org.hibernate.search.store.impl.DirectoryProviderHelper.createFSIndex(DirectoryProviderHelper.java:128)
at org.hibernate.search.store.impl.FSDirectoryProvider.initialize(FSDirectoryProvider.java:53)
at org.hibernate.search.store.spi.BaseDirectoryProviderService.initialize(BaseDirectoryProviderService.java:64)
at org.hibernate.search.store.spi.BaseDirectoryProviderService.create(BaseDirectoryProviderService.java:52)
at org.hibernate.search.indexes.spi.DirectoryBasedIndexManager.createDirectoryProvider(DirectoryBasedIndexManager.java:230)
at org.hibernate.search.indexes.spi.DirectoryBasedIndexManager.initialize(DirectoryBasedIndexManager.java:90)
at org.hibernate.search.indexes.impl.IndexManagerHolder.createIndexManager(IndexManagerHolder.java:256)
at org.hibernate.search.indexes.impl.IndexManagerHolder.createIndexManager(IndexManagerHolder.java:513)
at org.hibernate.search.indexes.impl.IndexManagerHolder.createIndexManagers(IndexManagerHolder.java:482)
at org.hibernate.search.indexes.impl.IndexManagerHolder.buildEntityIndexBinding(IndexManagerHolder.java:91)
at org.hibernate.search.spi.SearchIntegratorBuilder.initDocumentBuilders(SearchIntegratorBuilder.java:358)
at org.hibernate.search.spi.SearchIntegratorBuilder.buildNewSearchFactory(SearchIntegratorBuilder.java:199)
at org.hibernate.search.spi.SearchIntegratorBuilder.buildSearchIntegrator(SearchIntegratorBuilder.java:117)
at org.hibernate.search.hcore.impl.HibernateSearchSessionFactoryObserver.sessionFactoryCreated(HibernateSearchSessionFactoryObserver.java:75)
at org.hibernate.internal.SessionFactoryObserverChain.sessionFactoryCreated(SessionFactoryObserverChain.java:35)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:364)
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:490)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:878)
at org.hibernate.jpa.HibernatePersistenceProvider.createContainerEntityManagerFactory(HibernatePersistenceProvider.java:151)
at org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(PersistenceUnitLoader.java:199)
at org.glassfish.persistence.jpa.PersistenceUnitLoader.<init>(PersistenceUnitLoader.java:107)
at org.glassfish.persistence.jpa.JPADeployer$1.visitPUD(JPADeployer.java:223)
at org.glassfish.persistence.jpa.JPADeployer$PersistenceUnitDescriptorIterator.iteratePUDs(JPADeployer.java:510)
at org.glassfish.persistence.jpa.JPADeployer.createEMFs(JPADeployer.java:230)
at org.glassfish.persistence.jpa.JPADeployer.prepare(JPADeployer.java:168)
at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:925)
at org.glassfish.javaee.full.deployment.EarDeployer.prepareBundle(EarDeployer.java:309)
at org.glassfish.javaee.full.deployment.EarDeployer.access$200(EarDeployer.java:88)
at org.glassfish.javaee.full.deployment.EarDeployer$1.doBundle(EarDeployer.java:155)
at org.glassfish.javaee.full.deployment.EarDeployer$1.doBundle(EarDeployer.java:152)
at org.glassfish.javaee.full.deployment.EarDeployer.doOnBundles(EarDeployer.java:232)
at org.glassfish.javaee.full.deployment.EarDeployer.doOnAllTypedBundles(EarDeployer.java:241)
at org.glassfish.javaee.full.deployment.EarDeployer.doOnAllBundles(EarDeployer.java:267)
at org.glassfish.javaee.full.deployment.EarDeployer.prepare(EarDeployer.java:152)
at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:925)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:434)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:539)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:535)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:534)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:565)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:557)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:556)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1464)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:109)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1846)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1722)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534)
at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224)
at org.glassfish.grizzly.http.server.StaticHttpHandlerBase.service(StaticHttpHandlerBase.java:189)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(Abstra
Grave: ctThreadPool.java:545)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassCastException: class org.apache.lucene.codecs.lucene40.Lucene40PostingsFormat
at java.lang.Class.asSubclass(Class.java:3404)
at org.apache.lucene.util.SPIClassIterator.next(SPIClassIterator.java:141)
at org.apache.lucene.util.NamedSPILoader.reload(NamedSPILoader.java:65)
at org.apache.lucene.util.NamedSPILoader.<init>(NamedSPILoader.java:47)
at org.apache.lucene.util.NamedSPILoader.<init>(NamedSPILoader.java:37)
at org.apache.lucene.codecs.PostingsFormat$Holder.<clinit>(PostingsFormat.java:49)
... 89 more
Grave: Exception while preparing the app
Grave: Exception during lifecycle processing
java.lang.ExceptionInInitializerError
at org.apache.lucene.codecs.PostingsFormat.forName(PostingsFormat.java:112)
at org.apache.lucene.codecs.lucene40.Lucene40Codec.<init>(Lucene40Codec.java:115)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at java.lang.Class.newInstance(Class.java:442)
at org.apache.lucene.util.NamedSPILoader.reload(NamedSPILoader.java:67)
at org.apache.lucene.util.NamedSPILoader.<init>(NamedSPILoader.java:45)
at org.apache.lucene.util.NamedSPILoader.<init>(NamedSPILoader.java:37)
at org.apache.lucene.codecs.Codec$Holder.<clinit>(Codec.java:47)
at org.apache.lucene.codecs.Codec.getDefault(Codec.java:140)
at org.apache.lucene.index.LiveIndexWriterConfig.<init>(LiveIndexWriterConfig.java:120)
at org.apache.lucene.index.IndexWriterConfig.<init>(IndexWriterConfig.java:140)
at org.hibernate.search.store.spi.DirectoryHelper.initializeIndexIfNeeded(DirectoryHelper.java:54)
at org.hibernate.search.store.impl.DirectoryProviderHelper.createFSIndex(DirectoryProviderHelper.java:128)
at org.hibernate.search.store.impl.FSDirectoryProvider.initialize(FSDirectoryProvider.java:53)
at org.hibernate.search.store.spi.BaseDirectoryProviderService.initialize(BaseDirectoryProviderService.java:64)
at org.hibernate.search.store.spi.BaseDirectoryProviderService.create(BaseDirectoryProviderService.java:52)
at org.hibernate.search.indexes.spi.DirectoryBasedIndexManager.createDirectoryProvider(DirectoryBasedIndexManager.java:230)
at org.hibernate.search.indexes.spi.DirectoryBasedIndexManager.initialize(DirectoryBasedIndexManager.java:90)
at org.hibernate.search.indexes.impl.IndexManagerHolder.createIndexManager(IndexManagerHolder.java:256)
at org.hibernate.search.indexes.impl.IndexManagerHolder.createIndexManager(IndexManagerHolder.java:513)
at org.hibernate.search.indexes.impl.IndexManagerHolder.createIndexManagers(IndexManagerHolder.java:482)
at org.hibernate.search.indexes.impl.IndexManagerHolder.buildEntityIndexBinding(IndexManagerHolder.java:91)
at org.hibernate.search.spi.SearchIntegratorBuilder.initDocumentBuilders(SearchIntegratorBuilder.java:358)
at org.hibernate.search.spi.SearchIntegratorBuilder.buildNewSearchFactory(SearchIntegratorBuilder.java:199)
at org.hibernate.search.spi.SearchIntegratorBuilder.buildSearchIntegrator(SearchIntegratorBuilder.java:117)
at org.hibernate.search.hcore.impl.HibernateSearchSessionFactoryObserver.sessionFactoryCreated(HibernateSearchSessionFactoryObserver.java:75)
at org.hibernate.internal.SessionFactoryObserverChain.sessionFactoryCreated(SessionFactoryObserverChain.java:35)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:364)
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:490)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:878)
at org.hibernate.jpa.HibernatePersistenceProvider.createContainerEntityManagerFactory(HibernatePersistenceProvider.java:151)
at org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(PersistenceUnitLoader.java:199)
at org.glassfish.persistence.jpa.PersistenceUnitLoader.<init>(PersistenceUnitLoader.java:107)
at org.glassfish.persistence.jpa.JPADeployer$1.visitPUD(JPADeployer.java:223)
at org.glassfish.persistence.jpa.JPADeployer$PersistenceUnitDescriptorIterator.iteratePUDs(JPADeployer.java:510)
at org.glassfish.persistence.jpa.JPADeployer.createEMFs(JPADeployer.java:230)
at org.glassfish.persistence.jpa.JPADeployer.prepare(JPADeployer.java:168)
at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:925)
at org.glassfish.javaee.full.deployment.EarDeployer.prepare
the dependencies on the pom file for ejb modules are the following:
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.2.2.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-search-orm</artifactId>
<version>5.5.4.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>5.0.9.Final</version>
</dependency>
</dependencies>
if I exclude the artifact lucene-backward-codecs on hibernate-search artifact I get the error:
java.lang.ClassCastException: class org.apache.lucene.codecs.lucene50.Lucene50PostingsFormat
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-search-orm</artifactId>
<version>${hibernate.search.version}</version>
<exclusions>
<exclusion> <!-- declare the exclusion here -->
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-backward-codecs</artifactId>
</exclusion>
</exclusions>
</dependency>
The persistence unit configuration is the following:
<?xml version="1.0" encoding="UTF-8"?>
<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="ejercicio4_PU" transaction-type="JTA">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<jta-data-source>jdbc/books</jta-data-source>
<class>models.Book</class>
<class>models.Author</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="hibernate.search.lucene_version" value="LUCENE_CURRENT"/>
<property name="hibernate.search.default.directory_provider" value="filesystem"/>
<property name="hibernate.search.default.indexBase" value="./lucene/indexes"/>
<property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.SunOneJtaPlatform"/>
<property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/>
</properties>
</persistence-unit>
</persistence>
I used the plugin-finder duplicate-maven-plugin
to find to find possible diferent versions of lucene
<plugin>
<groupId>com.ning.maven.plugins</groupId>
<artifactId>maven-duplicate-finder-plugin</artifactId>
<version>1.0.8</version>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
This is an excerpt of the result obtained to build the project:
Checking compile classpath
Found duplicate and different classes in [javax:javaee-api:7.0,org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.0.Final] :
javax.persistence.Access
javax.persistence.AccessType
javax.persistence.AssociationOverride
javax.persistence.AssociationOverrides
javax.persistence.AttributeConverter
javax.persistence.AttributeNode
javax.persistence.AttributeOverride
javax.persistence.AttributeOverrides
javax.persistence.Basic
javax.persistence.Cache
javax.persistence.CacheRetrieveMode
javax.persistence.CacheStoreMode
javax.persistence.Cacheable
javax.persistence.CascadeType
javax.persistence.CollectionTable
javax.persistence.Column
javax.persistence.ColumnResult
javax.persistence.ConstraintMode
javax.persistence.ConstructorResult
javax.persistence.Convert
javax.persistence.Converter
javax.persistence.Converts
javax.persistence.DiscriminatorColumn
javax.persistence.DiscriminatorType
javax.persistence.DiscriminatorValue
javax.persistence.ElementCollection
javax.persistence.Embeddable
javax.persistence.Embedded
javax.persistence.EmbeddedId
javax.persistence.Entity
javax.persistence.EntityExistsException
javax.persistence.EntityGraph
javax.persistence.EntityListeners
javax.persistence.EntityManager
javax.persistence.EntityManagerFactory
javax.persistence.EntityNotFoundException
javax.persistence.EntityResult
javax.persistence.EntityTransaction
javax.persistence.EnumType
javax.persistence.Enumerated
javax.persistence.ExcludeDefaultListeners
javax.persistence.ExcludeSuperclassListeners
javax.persistence.FetchType
javax.persistence.FieldResult
javax.persistence.FlushModeType
javax.persistence.ForeignKey
javax.persistence.GeneratedValue
javax.persistence.GenerationType
javax.persistence.Id
javax.persistence.IdClass
javax.persistence.Index
javax.persistence.Inheritance
javax.persistence.InheritanceType
javax.persistence.JoinColumn
javax.persistence.JoinColumns
javax.persistence.JoinTable
javax.persistence.Lob
javax.persistence.LockModeType
javax.persistence.LockTimeoutException
javax.persistence.ManyToMany
javax.persistence.ManyToOne
javax.persistence.MapKey
javax.persistence.MapKeyClass
javax.persistence.MapKeyColumn
javax.persistence.MapKeyEnumerated
javax.persistence.MapKeyJoinColumn
javax.persistence.MapKeyJoinColumns
javax.persistence.MapKeyTemporal
javax.persistence.MappedSuperclass
javax.persistence.MapsId
javax.persistence.NamedAttributeNode
javax.persistence.NamedEntityGraph
javax.persistence.NamedEntityGraphs
javax.persistence.NamedNativeQueries
javax.persistence.NamedNativeQuery
javax.persistence.NamedQueries
javax.persistence.NamedQuery
javax.persistence.NamedStoredProcedureQueries
javax.persistence.NamedStoredProcedureQuery
javax.persistence.NamedSubgraph
javax.persistence.NoResultException
javax.persistence.NonUniqueResultException
javax.persistence.OneToMany
javax.persistence.OneToOne
javax.persistence.OptimisticLockException
javax.persistence.OrderBy
javax.persistence.OrderColumn
javax.persistence.Parameter
javax.persistence.ParameterMode
javax.persistence.Persistence
javax.persistence.PersistenceContext
javax.persistence.PersistenceContextType
javax.persistence.PersistenceContexts
javax.persistence.PersistenceException
javax.persistence.PersistenceProperty
javax.persistence.PersistenceUnit
javax.persistence.PersistenceUnitUtil
javax.persistence.PersistenceUnits
javax.persistence.PersistenceUtil
javax.persistence.PessimisticLockException
javax.persistence.PessimisticLockScope
javax.persistence.PostLoad
javax.persistence.PostPersist
javax.persistence.PostRemove
javax.persistence.PostUpdate
javax.persistence.PrePersist
javax.persistence.PreRemove
javax.persistence.PreUpdate
javax.persistence.PrimaryKeyJoinColumn
javax.persistence.PrimaryKeyJoinColumns
javax.persistence.Query
javax.persistence.QueryHint
javax.persistence.QueryTimeoutException
javax.persistence.RollbackException
javax.persistence.SecondaryTable
javax.persistence.SecondaryTables
javax.persistence.SequenceGenerator
javax.persistence.SharedCacheMode
javax.persistence.SqlResultSetMapping
javax.persistence.SqlResultSetMappings
javax.persistence.StoredProcedureParameter
javax.persistence.StoredProcedureQuery
javax.persistence.Subgraph
javax.persistence.SynchronizationType
javax.persistence.Table
javax.persistence.TableGenerator
javax.persistence.Temporal
javax.persistence.TemporalType
javax.persistence.TransactionRequiredException
javax.persistence.Transient
javax.persistence.Tuple
javax.persistence.TupleElement
javax.persistence.TypedQuery
javax.persistence.UniqueConstraint
javax.persistence.ValidationMode
javax.persistence.Version
javax.persistence.criteria.AbstractQuery
javax.persistence.criteria.CollectionJoin
javax.persistence.criteria.CommonAbstractCriteria
javax.persistence.criteria.CompoundSelection
javax.persistence.criteria.CriteriaBuilder
javax.persistence.criteria.CriteriaDelete
javax.persistence.criteria.CriteriaQuery
javax.persistence.criteria.CriteriaUpdate
javax.persistence.criteria.Expression
javax.persistence.criteria.Fetch
javax.persistence.criteria.FetchParent
javax.persistence.criteria.From
javax.persistence.criteria.Join
javax.persistence.criteria.JoinType
javax.persistence.criteria.ListJoin
javax.persistence.criteria.MapJoin
javax.persistence.criteria.Order
javax.persistence.criteria.ParameterExpression
javax.persistence.criteria.Path
javax.persistence.criteria.PluralJoin
javax.persistence.criteria.Predicate
javax.persistence.criteria.Root
javax.persistence.criteria.Selection
javax.persistence.criteria.SetJoin
javax.persistence.criteria.Subquery
javax.persistence.metamodel.Attribute
javax.persistence.metamodel.BasicType
javax.persistence.metamodel.Bindable
javax.persistence.metamodel.CollectionAttribute
javax.persistence.metamodel.EmbeddableType
javax.persistence.metamodel.EntityType
javax.persistence.metamodel.IdentifiableType
javax.persistence.metamodel.ListAttribute
javax.persistence.metamodel.ManagedType
javax.persistence.metamodel.MapAttribute
javax.persistence.metamodel.MappedSuperclassType
javax.persistence.metamodel.Metamodel
javax.persistence.metamodel.PluralAttribute
javax.persistence.metamodel.SetAttribute
javax.persistence.metamodel.SingularAttribute
javax.persistence.metamodel.StaticMetamodel
javax.persistence.metamodel.Type
javax.persistence.spi.ClassTransformer
javax.persistence.spi.LoadState
javax.persistence.spi.PersistenceProvider
javax.persistence.spi.PersistenceProviderResolver
javax.persistence.spi.PersistenceProviderResolverHolder
javax.persistence.spi.PersistenceUnitInfo
javax.persistence.spi.PersistenceUnitTransactionType
javax.persistence.spi.ProviderUtil
I am using Glassfish server 4.1 and Netbeans 8.0.2.
I hope someone can help me, thanks.
The error you have is the result of attempting to open a Lucene index written by Apache Lucene version 4.0.x.
If you are migrating an application using an older version of Hibernate Search which was using Lucene 4, then I'd suggest to delete the index and rebuild it using the MassIndexer.
If you need to read the old index format for any reason, you can add the following dependency to your application to be able to read it:
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-backward-codecs</artifactId>
<version>5.3.1</version>
</dependency>
Also - unrelated but will cause you trouble - I see you have set hibernate-core and hibernate-entitymanager to two different versions: never do this!
Since Hibernate Search is not yet compatible with Hibernate ORM 5.2.x, I'd suggest to set both versions to 5.1.1.Final, which are compatible with Hibernate Search 5.5.4.Final.
I'm trying to deploy a sar file, but I'm getting an error related to java.lang.ClassNotFoundException.
My sar file is
10:46:27,697 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7) MSC00001: Failed to start service jboss.mbean.service."backend.actipstation:service=SnmpStationService1".start: org.jboss.msc.service.StartException in service jboss.mbean.service."backend.actipstation:service=SnmpStationService1".start: JBAS017222: Failed to execute legacy service start() method
at org.jboss.as.service.StartStopService.start(StartStopService.java:56)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_65]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_65]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_65]
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_65]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_65]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_65]
at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_65]
at org.jboss.as.service.AbstractService.invokeLifecycleMethod(AbstractService.java:52)
at org.jboss.as.service.StartStopService.start(StartStopService.java:54)
... 5 more
Caused by: java.lang.NoClassDefFoundError: org/snmp4j/smi/Variable
at cl.auter.sictrav.comunicacion.snmp.backend.SnmpStation.startService(SnmpStation.java:154)
at cl.auter.sictrav.comunicacion.snmp.backend.SnmpStationService.start(SnmpStationService.java:11)
... 11 more
Caused by: java.lang.ClassNotFoundException: org.snmp4j.smi.Variable from [Module "deployment.sictrav3_actstationservice.sar:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) [jboss-modules.jar:1.1.1.GA]
... 13 more
My sar file has this structure
+ actstationservice.sar
|-cl/
|- /* compiled class files here */
| snmp4j-1.11.1.jar
|-META-INF/
|- jboss-service.xml
|- jboss-deployment-structure.xml
jboss-deployment-structure.xml
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<resources>
<resource-root path="snmp4j-1.11.1.jar"></resource-root>
</resources>
<dependencies>
<module name="org.snmp4j" export="true" />
</dependencies>
</deployment>
</jboss-deployment-structure>
My Manifest.MF
Manifest-Version: 1.0
Dependencies: org.snmp4j export,org.hibernate
Also I have the library inside /lib folder
What am I missing?
The sar file wasn't including the jboss-deployment-structure.xml inside META-INF. I Added it and it worked as a charm.
I have a simple sling mock test that is loading json data
public class Test {
#Rule
public final SlingContext context = new SlingContext(ResourceResolverType.JCR_MOCK);
#Before
public void setUp() {
context.load().json("/test-1.json", "/content/test");
}
#Test
public void testLoad() {
Resource resource = context.resourceResolver().getResource("/content/test");
}
}
I have the following dependencies added to my pom.xml
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.testing.sling-mock</artifactId>
<version>1.2.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.commons.testing</artifactId>
<version>2.0.16</version>
<scope>test</scope>
</dependency>
When i execute this, I get the following exception, even though sling.api (v2.2) is an existing dependency in the pom
java.lang.RuntimeException: Unable to initialize JCR_MOCK resource resolver factory.
at org.apache.sling.testing.mock.sling.context.ContextResourceResolverFactory.get(ContextResourceResolverFactory.java:66)
at org.apache.sling.testing.mock.sling.context.SlingContextImpl.newResourceResolverFactory(SlingContextImpl.java:103)
at org.apache.sling.testing.mock.sling.context.SlingContextImpl.setUp(SlingContextImpl.java:94)
at org.apache.sling.testing.mock.sling.junit.SlingContext.access$000(SlingContext.java:32)
at org.apache.sling.testing.mock.sling.junit.SlingContext$1.before(SlingContext.java:113)
at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:46)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: java.lang.NoClassDefFoundError: org/apache/sling/api/resource/ResourceProviderFactory
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at org.apache.sling.testing.mock.sling.MockJcrResourceResolverFactory.getResourceResolverInternal(MockJcrResourceResolverFactory.java:74)
at org.apache.sling.testing.mock.sling.MockJcrResourceResolverFactory.getResourceResolver(MockJcrResourceResolverFactory.java:111)
at org.apache.sling.testing.mock.sling.context.ContextResourceResolverFactory.initializeJcrMock(ContextResourceResolverFactory.java:72)
at org.apache.sling.testing.mock.sling.context.ContextResourceResolverFactory.get(ContextResourceResolverFactory.java:52)
... 21 more
Caused by: java.lang.ClassNotFoundException: org.apache.sling.api.resource.ResourceProviderFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 37 more
Can someone please help?
You are missing a dependency on org.apache.sling.api ( as shown by a search by class name on search.maven.org )
I'm having trouble with adding Richfaces to my Maven project, which is deploying to JBoss AS 6. Here is my pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.test</groupId>
<artifactId>WyreBase</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>Wyre Base</name>
<url>http://maven.apache.org</url>
<properties>
<jbossHome>/home/drew/Development/Servers/jboss/</jbossHome>
<arquillian.version>1.0.0.Alpha2</arquillian.version>
<org.richfaces.ui.version>4.0.0.20100715-M1</org.richfaces.ui.version>
</properties>
<repositories>
<repository>
<id>java.net2</id>
<name>Repository hosting the jee6 artifacts</name>
<url>http://download.java.net/maven/2</url>
</repository>
<repository>
<id>jboss-public-repository-group</id>
<name>JBoss Public Maven Repository Group</name>
<url>https://repository.jboss.org/nexus/content/groups/public/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>jboss-public-repository-group</id>
<name>JBoss Public Maven Repository Group</name>
<url>https://repository.jboss.org/nexus/content/groups/public/</url>
</pluginRepository>
</pluginRepositories>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.richfaces.ui</groupId>
<artifactId>richfaces-components-bom</artifactId>
<version>${org.richfaces.ui.version}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-6.0</artifactId>
<version>1.0.0.Beta5</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.1.0.Beta1</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.richfaces.ui</groupId>
<artifactId>richfaces-components-ui</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.12</version>
</dependency>
<dependency>
<groupId>org.jasypt</groupId>
<artifactId>jasypt</artifactId>
<version>1.6</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-junit</artifactId>
<version>${arquillian.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jboss-maven-plugin</artifactId>
<version>1.4</version>
<configuration>
<jbossHome>${jbossHome}</jbossHome>
<serverName>default</serverName>
<fileName>target/${project.artifactId}.war</fileName>
</configuration>
</plugin>
</plugins>
<finalName>${project.artifactId}</finalName>
</build>
<profiles>
<profile>
<id>jbossas-local-60</id>
<dependencies>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-jbossas-local-60</artifactId>
<version>1.0.0.Alpha2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.jbossas</groupId>
<artifactId>jboss-server-manager</artifactId>
<version>1.0.3.GA</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.jbossas</groupId>
<artifactId>jboss-as-client</artifactId>
<version>6.0.0.20100429-M3</version>
<type>pom</type>
<scope>test</scope>
</dependency>
</dependencies>
</profile>
</profiles>
</project>
Here are the, hopefully, more relevant portions of the stack trace (too big to put it all in here.)
02:30:57,314 INFO [javax.enterprise.resource.webcontainer.jsf.config] Initializing Mojarra 2.0.2 (FCS b10) for context '/WyreBase'
02:30:57,831 SEVERE [javax.enterprise.resource.webcontainer.jsf.config] Unable to process annotations for url, vfs:/home/drew/Development/Servers/jboss-6.0.0.20100429-M3/server/default/deploy/WyreBase.war/WEB-INF/lib/richfaces-core-impl-4.0.0.20100715-M1.jar/META-INF/initialization-listener.faces-config.xml. Reason: java.util.zip.ZipException: error in opening zip file
02:30:57,831 SEVERE [javax.enterprise.resource.webcontainer.jsf.config] : java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method) [:1.6.0_18]
at java.util.zip.ZipFile.<init>(ZipFile.java:131) [:1.6.0_18]
at java.util.jar.JarFile.<init>(JarFile.java:150) [:1.6.0_18]
at sun.net.www.protocol.jar.URLJarFile.<init>(URLJarFile.java:85) [:1.6.0_18]
at sun.net.www.protocol.jar.URLJarFile$1.run(URLJarFile.java:232) [:1.6.0_18]
at java.security.AccessController.doPrivileged(Native Method) [:1.6.0_18]
at sun.net.www.protocol.jar.URLJarFile.retrieve(URLJarFile.java:216) [:1.6.0_18]
at sun.net.www.protocol.jar.URLJarFile.getJarFile(URLJarFile.java:68) [:1.6.0_18]
at sun.net.www.protocol.jar.JarFileFactory.get(JarFileFactory.java:86) [:1.6.0_18]
at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:122) [:1.6.0_18]
at sun.net.www.protocol.jar.JarURLConnection.getJarFile(JarURLConnection.java:89) [:1.6.0_18]
at com.sun.faces.config.AnnotationScanner.processClasspath(AnnotationScanner.java:290) [:2.0.2-FCS]
at com.sun.faces.config.AnnotationScanner.getAnnotatedClasses(AnnotationScanner.java:215) [:2.0.2-FCS]
at com.sun.faces.config.ConfigManager$AnnotationScanTask.call(ConfigManager.java:765) [:2.0.2-FCS]
at com.sun.faces.config.ConfigManager$AnnotationScanTask.call(ConfigManager.java:736) [:2.0.2-FCS]
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) [:1.6.0_18]
at java.util.concurrent.FutureTask.run(FutureTask.java:166) [:1.6.0_18]
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:329) [:2.0.2-FCS]
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:223) [:2.0.2-FCS]
at org.jboss.web.jsf.integration.config.JBossJSFConfigureListener.contextInitialized(JBossJSFConfigureListener.java:72) [:6.0.0.20100429-M3]
...more
02:30:57,842 SEVERE [javax.enterprise.resource.webcontainer.jsf.config] Unable to process annotations for url, vfs:/home/drew/Development/Servers/jboss-6.0.0.20100429-M3/server/default/deploy/WyreBase.war/WEB-INF/lib/richfaces-components-ui-4.0.0.20100715-M1.jar/META-INF/behaviors-handler-delegate.faces-config.xml. Reason: java.util.zip.ZipException: error in opening zip file
02:30:57,843 SEVERE [javax.enterprise.resource.webcontainer.jsf.config] : java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method) [:1.6.0_18]
at java.util.zip.ZipFile.<init>(ZipFile.java:131) [:1.6.0_18]
at java.util.jar.JarFile.<init>(JarFile.java:150) [:1.6.0_18]
at sun.net.www.protocol.jar.URLJarFile.<init>(URLJarFile.java:85) [:1.6.0_18]
at sun.net.www.protocol.jar.URLJarFile$1.run(URLJarFile.java:232) [:1.6.0_18]
at java.security.AccessController.doPrivileged(Native Method) [:1.6.0_18]
at sun.net.www.protocol.jar.URLJarFile.retrieve(URLJarFile.java:216) [:1.6.0_18]
at sun.net.www.protocol.jar.URLJarFile.getJarFile(URLJarFile.java:68) [:1.6.0_18]
at sun.net.www.protocol.jar.JarFileFactory.get(JarFileFactory.java:86) [:1.6.0_18]
at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:122) [:1.6.0_18]
at sun.net.www.protocol.jar.JarURLConnection.getJarFile(JarURLConnection.java:89) [:1.6.0_18]
at com.sun.faces.config.AnnotationScanner.processClasspath(AnnotationScanner.java:290) [:2.0.2-FCS]
at com.sun.faces.config.AnnotationScanner.getAnnotatedClasses(AnnotationScanner.java:215) [:2.0.2-FCS]
at com.sun.faces.config.ConfigManager$AnnotationScanTask.call(ConfigManager.java:765) [:2.0.2-FCS]
at com.sun.faces.config.ConfigManager$AnnotationScanTask.call(ConfigManager.java:736) [:2.0.2-FCS]
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) [:1.6.0_18]
at java.util.concurrent.FutureTask.run(FutureTask.java:166) [:1.6.0_18]
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:329) [:2.0.2-FCS]
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:223) [:2.0.2-FCS]
at org.jboss.web.jsf.integration.config.JBossJSFConfigureListener.contextInitialized(JBossJSFConfigureListener.java:72) [:6.0.0.20100429-M3]
...more
02:30:57,849 INFO [javax.enterprise.resource.webcontainer.jsf.config] Unsanitized stacktrace from failed start...: com.sun.faces.config.ConfigurationException: Factory 'javax.faces.application.ApplicationFactory' was not configured properly.
at com.sun.faces.config.processor.FactoryConfigProcessor.verifyFactoriesExist(FactoryConfigProcessor.java:305) [:2.0.2-FCS]
at com.sun.faces.config.processor.FactoryConfigProcessor.process(FactoryConfigProcessor.java:220) [:2.0.2-FCS]
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:335) [:2.0.2-FCS]
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:223) [:2.0.2-FCS]
at org.jboss.web.jsf.integration.config.JBossJSFConfigureListener.contextInitialized(JBossJSFConfigureListener.java:72) [:6.0.0.20100429-M3]
...more
Caused by: javax.faces.FacesException: org.jboss.weld.integration.webtier.jsf.WeldApplicationFactory
at javax.faces.FactoryFinder.getImplGivenPreviousImpl(FactoryFinder.java:593) [:2.0.2-FCS]
at javax.faces.FactoryFinder.getImplementationInstance(FactoryFinder.java:472) [:2.0.2-FCS]
at javax.faces.FactoryFinder.access$400(FactoryFinder.java:139) [:2.0.2-FCS]
at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:796) [:2.0.2-FCS]
at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:306) [:2.0.2-FCS]
at com.sun.faces.config.processor.FactoryConfigProcessor.verifyFactoriesExist(FactoryConfigProcessor.java:303) [:2.0.2-FCS]
... 70 more
Caused by: java.lang.IllegalArgumentException: argument type mismatch
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [:1.6.0_18]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) [:1.6.0_18]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [:1.6.0_18]
at java.lang.reflect.Constructor.newInstance(Constructor.java:532) [:1.6.0_18]
at javax.faces.FactoryFinder.getImplGivenPreviousImpl(FactoryFinder.java:586) [:2.0.2-FCS]
... 75 more
02:30:57,854 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/WyreBase]] Exception sending context initialized event to listener instance of class org.jboss.web.jsf.integration.config.JBossJSFConfigureListener: com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! argument type mismatch
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:354) [:2.0.2-FCS]
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:223) [:2.0.2-FCS]
at org.jboss.web.jsf.integration.config.JBossJSFConfigureListener.contextInitialized(JBossJSFConfigureListener.java:72) [:6.0.0.20100429-M3]
at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3733) [:6.0.0.20100429-M3]
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4197) [:6.0.0.20100429-M3]
...more
Caused by: java.lang.IllegalArgumentException: argument type mismatch
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [:1.6.0_18]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) [:1.6.0_18]
... more
02:30:57,858 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/WyreBase]] Exception sending context initialized event to listener instance of class com.sun.faces.config.ConfigureListener: java.lang.ClassCastException: com.sun.faces.config.WebConfiguration cannot be cast to com.sun.faces.config.WebConfiguration
at com.sun.faces.config.WebConfiguration.getInstance(WebConfiguration.java:170) [:2.0.2-FCS]
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:161) [:2.0.2-FCS]
at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3733) [:6.0.0.20100429-M3]
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4197) [:6.0.0.20100429-M3]
... more
02:30:57,860 ERROR [org.apache.catalina.core.StandardContext] Error listenerStart
02:30:57,860 ERROR [org.apache.catalina.core.StandardContext] Context [/WyreBase] startup failed due to previous errors
02:30:57,863 SEVERE [javax.enterprise.resource.webcontainer.jsf.config] Unexpected exception when attempting to tear down the Mojarra runtime: java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.application.ApplicationFactory
You have several corrupted JARs that can't be opened, namely richfaces-core-impl-4.0.0.20100715-M1.jar and richfaces-components-ui-4.0.0.20100715-M1.jar. Try to delete them from your local repository and to redownload them.
Apparently this is a bug in JBossAS6.M3. https://jira.jboss.org/browse/JBAS-8024
Upgrading to JBossAS6.M4 solves the problem (but, naturally, introduces new ones. ;)