Firstable sorry for my English, I have a Maven Project which is a Web Service (packaged into a war file)
I use this pom:
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>ec.gob.turismo</groupId>
<artifactId>mintur-bpm</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>mintur-bpm</name>
<description>Servicio Web que interactúa con los procesos del negocio</description>
<properties>
<jbpm.version>6.0.1.Final</jbpm.version>
</properties>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
<version>7.5.Final</version>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>ec.gob.turismo.siete.establecimientos</groupId>
<artifactId>establecimientos-dto</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-core</artifactId>
<version>2.7.11</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>2.7.11</version>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-api</artifactId>
<version>${jbpm.version}</version>
</dependency>
<dependency>
<groupId>org.kie.remote</groupId>
<artifactId>kie-services-client</artifactId>
<version>${jbpm.version}</version>
</dependency>
</dependencies>
</project>
I use JbossEAP 6.3, when I type mvn clean install, maven generates the war file and copy inside the standalone directory. Next when I see my console in my eclipse I see this error:
[DEBUG] Executing deployment
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 18.643s
[INFO] Finished at: Thu Oct 02 16:49:19 COT 2014
[INFO] Final Memory: 29M/358M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.jboss.as.plugins:jboss-as-maven-plugin:7.5.Final:deploy (default) on project mintur-bpm: Deployment failed and was rolled back. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.jboss.as.plugins:jboss-as-maven-plugin:7.5.Final:deploy (default) on project mintur-bpm: Deployment failed and was rolled back.
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.jboss.as.plugin.common.DeploymentExecutionException: Deployment failed and was rolled back.
at org.jboss.as.plugin.deployment.standalone.StandaloneDeployment.execute(StandaloneDeployment.java:180)
at org.jboss.as.plugin.deployment.AbstractDeployment.executeDeployment(AbstractDeployment.java:121)
at org.jboss.as.plugin.deployment.AbstractDeployment.doExecute(AbstractDeployment.java:146)
at org.jboss.as.plugin.deployment.AbstractAppDeployment.doExecute(AbstractAppDeployment.java:70)
at org.jboss.as.plugin.deployment.AbstractDeployment.execute(AbstractDeployment.java:111)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
[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 in Jboss log (server.log), I see this stack trace:
16:49:17,770 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC000001: Failed to start service jboss.deployment.unit."mintur-bpm-0.0.1-SNAPSHOT.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."mintur-bpm-0.0.1-SNAPSHOT.war".INSTALL: JBAS018733: Error al procesar la fase INSTALL de deployment "mintur-bpm-0.0.1-SNAPSHOT.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:127) [jboss-as-server-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_67]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_67]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_67]
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: ec.gob.turismo.siete.serviciosweb.bmp.BusinessProcessManagement from [Module "deployment.mintur-bpm-0.0.1-SNAPSHOT.war:main" from Service Module Loader]
at org.jboss.wsf.stack.cxf.metadata.MetadataBuilder.createDDEndpoint(MetadataBuilder.java:241)
at org.jboss.wsf.stack.cxf.metadata.MetadataBuilder.build(MetadataBuilder.java:82)
at org.jboss.wsf.stack.cxf.deployment.aspect.DescriptorDeploymentAspect.generateMetadataFromDeployment(DescriptorDeploymentAspect.java:135)
at org.jboss.wsf.stack.cxf.deployment.aspect.DescriptorDeploymentAspect.start(DescriptorDeploymentAspect.java:68)
at org.jboss.as.webservices.deployers.AspectDeploymentProcessor.deploy(AspectDeploymentProcessor.java:74)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:120) [jboss-as-server-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
... 5 more
Caused by: java.lang.ClassNotFoundException: ec.gob.turismo.siete.serviciosweb.bmp.BusinessProcessManagement from [Module "deployment.mintur-bpm-0.0.1-SNAPSHOT.war:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:197) [jboss-modules.jar:1.3.0.Final-redhat-2]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:443) [jboss-modules.jar:1.3.0.Final-redhat-2]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:431) [jboss-modules.jar:1.3.0.Final-redhat-2]
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:373) [jboss-modules.jar:1.3.0.Final-redhat-2]
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:118) [jboss-modules.jar:1.3.0.Final-redhat-2]
at org.jboss.wsf.stack.cxf.metadata.MetadataBuilder.createDDEndpoint(MetadataBuilder.java:237)
... 10 more
16:49:17,781 ERROR [org.jboss.as.server] (management-handler-thread - 29) JBAS015870: La implementaci▒n de "mintur-bpm-0.0.1-SNAPSHOT.war" se deshizo con el siguiente mensaje de fallo:
{"JBAS014671: Servicios fallidos" => {"jboss.deployment.unit.\"mintur-bpm-0.0.1-SNAPSHOT.war\".INSTALL" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"mintur-bpm-0.0.1-SNAPSHOT.war\".INSTALL: JBAS018733: Error al procesar la fase INSTALL de deployment \"mintur-bpm-0.0.1-SNAPSHOT.war\"
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: ec.gob.turismo.siete.serviciosweb.bmp.BusinessProcessManagement from [Module \"deployment.mintur-bpm-0.0.1-SNAPSHOT.war:main\" from Service Module Loader]
Caused by: java.lang.ClassNotFoundException: ec.gob.turismo.siete.serviciosweb.bmp.BusinessProcessManagement from [Module \"deployment.mintur-bpm-0.0.1-SNAPSHOT.war:main\" from Service Module Loader]"}}
16:49:19,100 INFO [org.jboss.as.server.deployment] (MSC service thread 1-6) JBAS015877: Se detuvo la implementaci▒nmintur-bpm-0.0.1-SNAPSHOT.war (runtime-name: mintur-bpm-0.0.1-SNAPSHOT.war) en 1317ms
The error above says that a Class is not found in my war file, which is incorrect because I have opened many times the war file and there are all the classes inside.
Could you help me please, because I can't find a solution?
Thanks.
PD: If you need more information, please let me know.
It was my fault, this package does not exist in my war file, that's why the error:
ec.gob.turismo.siete.serviciosweb.bmp.BusinessProcessManagement
The correct package is:
ec.gob.turismo.serviciosweb.bmp.BusinessProcessManagement
Aditional I have placed a web.xml file that makes references to the class that implements the BusinessProcessManagement interface.
Thanks.
Related
Getting a exception while trying to deploy my rest api project on
tomcat 9 using jersey framework , if i try to downgrade the version of
jersey i will end up getting error in pom .xml , any help would be
appreciated
Sep 23, 2020 6:31:08 PM org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet [Jersey Web Application] in web application [/messengerapi] threw load() exception
java.lang.ClassNotFoundException: jakarta.servlet.Filter
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1365)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1188)
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:151)
at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2418)
at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:865)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1334)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1188)
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:539)
at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:520)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:150)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1042)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:983)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4864)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5173)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:843)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:421)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.startup.Catalina.start(Catalina.java:772)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:342)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:473)
Sep 23, 2020 6:31:08 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8080"]
Sep 23, 2020 6:31:08 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in [4099] milliseconds
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.vijaykumar</groupId>
<artifactId>messengerapi</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>messengerapi</name>
<build>
<finalName>messengerapi</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<inherited>true</inherited>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.glassfish.jersey</groupId>
<artifactId>jersey-bom</artifactId>
<version>${jersey.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet-core</artifactId>
<!-- use the following artifactId if you don't need servlet 2.x compatibility -->
<!-- artifactId>jersey-container-servlet</artifactId -->
</dependency>
<dependency>
<groupId>org.glassfish.jersey.inject</groupId>
<artifactId>jersey-hk2</artifactId>
</dependency>
<!-- uncomment this to get JSON support
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-binding</artifactId>
</dependency>
-->
</dependencies>
<properties>
<jersey.version>3.0.0-M6</jersey.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
Getting a exception while trying to deploy my rest api project on
tomcat 9 using jersey framework , if i try to downgrade the version of
jersey i will end up getting error in pom .xml , any help would be
appreciated
I am implementing a basic REST API with Micorprofile 3.2 and deploying it with Open Liberty.
The server.xml,
<?xml version="1.0" encoding="UTF-8"?>
<server description="${project.name}">
<featureManager>
<feature>microProfile-3.2</feature>
<feature>jpa-2.2</feature>
<feature>jdbc-4.2</feature>
<feature>jndi-1.0</feature>
</featureManager>
<httpEndpoint id="defaultHttpEndpoint"
host="*"
httpPort="8080"
httpsPort="9443"/>
<webApplication location="${project.name}.war" contextRoot="/"/>
<mpMetrics authentication="false"/>
<dataSource id="DefaultDataSource"
jndiName="jdbc/postgresql">
<jdbcDriver jdbcDriverRef="postgresql-driver" libraryRef="postgresql-library"/>
<properties.postgres serverName="localhost"
portNumber="5432"
databaseName="postgres"
user="postgres"
password="postgres"/>
</dataSource>
<jdbcDriver id="postgresql-driver"
javax.sql.XADataSource="org.postgresql.xa.PGXADataSource"
javax.sql.ConnectionPoolDataSource="org.postgresql.ds.PGConnectionPoolDataSource"
libraryRef="postgresql-library"/>
<library id="postgresql-library">
<fileset id="PostgreSQLFileset" dir="${shared.resource.dir}/jdbc"
includes="postgresql-42.2.9.jar"/>
</library>
</server>
my persistence.xml,
<?xml version="1.0" encoding="UTF-8"?>
<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"
version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence">
<persistence-unit name="jpa-unit" transaction-type="JTA">
<jta-data-source>jdbc/postgresql</jta-data-source>
</persistence-unit>
</persistence>
The problem is everytime i try to use a EntityManager i get the following error:
[INFO] [ERROR ] CWWJP0015E: An error occurred in the org.eclipse.persistence.jpa.PersistenceProvider persistence provider when it attempted to create the container entity manager factory for the jpa-unit persistence unit. The following error occurred: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.7.5.v20191016-ea124dd158): org.eclipse.persistence.exceptions.EntityManagerSetupException
[INFO] Exception Description: Predeployment of PersistenceUnit [jpa-unit] failed.
[INFO] Internal Exception: javax.persistence.PersistenceException: CWWJP0013E: The server cannot locate the java:comp/DefaultDataSource data source for the jpa-unit persistence unit because it has encountered the following exception: javax.naming.NamingException [Root exception is java.sql.SQLNonTransientException: DSRA4000E: No implementations of [javax.sql.XADataSource, javax.sql.ConnectionPoolDataSource, javax.sql.DataSource, java.sql.Driver] are found for dataSource[DefaultDataSource] with library postgresql-library. The name or location of JDBC driver JAR files might be incorrect or inaccessible. Searched in: []. Searched under packages: [].].
[INFO] [ERROR ] CWOWB1000E: A CDI error has occurred: CWNEN0030E: The server was unable to obtain an object instance for the java:comp/env/xx.xx.demo.micro.pq.infrastructure.infrastructure.EntityManagerProducer/entityManagerFactory reference. The exception message was: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.7.5.v20191016-ea124dd158): org.eclipse.persistence.exceptions.EntityManagerSetupException
[INFO] Exception Description: Predeployment of PersistenceUnit [jpa-unit] failed.
[INFO] Internal Exception: javax.persistence.PersistenceException: CWWJP0013E: The server cannot locate the java:comp/DefaultDataSource data source for the jpa-unit persistence unit because it has encountered the following exception: javax.naming.NamingException [Root exception is java.sql.SQLNonTransientException: DSRA4000E: No implementations of [javax.sql.XADataSource, javax.sql.ConnectionPoolDataSource, javax.sql.DataSource, java.sql.Driver] are found for dataSource[DefaultDataSource] with library postgresql-library. The name or location of JDBC driver JAR files might be incorrect or inaccessible. Searched in: []. Searched under packages: [].].
[INFO] [ERROR ] CWOWB1000E: A CDI error has occurred: CWNEN0030E: The server was unable to obtain an object instance for the java:comp/env/xx.xx.demo.micro.pq.infrastructure.infrastructure.EntityManagerProducer/entityManagerFactory reference. The exception message was: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.7.5.v20191016-ea124dd158): org.eclipse.persistence.exceptions.EntityManagerSetupException
[INFO] Exception Description: Predeployment of PersistenceUnit [jpa-unit] failed.
[INFO] Internal Exception: javax.persistence.PersistenceException: CWWJP0013E: The server cannot locate the java:comp/DefaultDataSource data source for the jpa-unit persistence unit because it has encountered the following exception: javax.naming.NamingException [Root exception is java.sql.SQLNonTransientException: DSRA4000E: No implementations of [javax.sql.XADataSource, javax.sql.ConnectionPoolDataSource, javax.sql.DataSource, java.sql.Driver] are found for dataSource[DefaultDataSource] with library postgresql-library. The name or location of JDBC driver JAR files might be incorrect or inaccessible. Searched in: []. Searched under packages: [].].
[INFO] [WARNING ] CWMOT0009W: The OpenTracing exception mapper detected and is handling an unhandled exception from the JAX-RS application.
[INFO] java.lang.NullPointerException
[INFO] at xx.xx.demo.micro.pq.infrastructure.infrastructure.EntityManagerProducer.createEntityManager(EntityManagerProducer.java:21)
[INFO] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[INFO] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[INFO] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[INFO] at java.lang.reflect.Method.invoke(Method.java:498)
[INFO] at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:95)
[INFO] at [internal classes]
[INFO] at org.jboss.weldx.persistence.EntityManager$1152902288$Proxy$_$$_WeldClientProxy.getCriteriaBuilder(Unknown Source)
[INFO] at xx.xx.demo.micro.pq.domain.ProductRepository.findAll(ProductRepository.java:42)
[INFO] at xx.xx.demo.micro.pq.domain.ProductRepository$Proxy$_$$_WeldClientProxy.findAll(Unknown Source)
[INFO] at xx.xx.demo.micro.pq.application.ProductResource.getAllProduct(ProductResource.java:54)
[INFO] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[INFO] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[INFO] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[INFO] at java.lang.reflect.Method.invoke(Method.java:498)
[INFO] at com.ibm.ws.jaxrs20.cdi.component.JaxRsFactoryImplicitBeanCDICustomizer.serviceInvoke(JaxRsFactoryImplicitBeanCDICustomizer.java:304)
[INFO] at [internal classes]
I create the EntityManager the following way:
#(unitName = "jpa-unit")
private EntityManagerFactory entityManagerFactory;
#Produces
#RequestScoped
public EntityManager createEntityManager() {
return entityManagerFactory.createEntityManager();
}
I dont really understand why open liberty looks in here: Searched in: []. Searched under packages: [].].
EDIT: add pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>xx.xxx</groupId>
<artifactId>demo-micro-pq</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<openliberty.maven.version>3.1</openliberty.maven.version>
<final.name>demo-micro-pq</final.name>
<failOnMissingWebXml>false</failOnMissingWebXml>
<openliberty.version>[19.0.0.9,)</openliberty.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<version.javaee>8.0.1</version.javaee>
<version.slf4j>1.7.28</version.slf4j>
</properties>
<dependencies>
<dependency>
<groupId>org.eclipse.microprofile</groupId>
<artifactId>microprofile</artifactId>
<version>3.2</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>${version.javaee}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.4.10.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>5.4.10.Final</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${version.slf4j}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${version.slf4j}</version>
</dependency>
</dependencies>
<build>
<finalName>demo-micro-pq</finalName>
</build>
<profiles>
<profile>
<id>liberty</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>io.openliberty.tools</groupId>
<artifactId>liberty-maven-plugin</artifactId>
<version>${openliberty.maven.version}</version>
<executions>
<execution>
<id>package-server</id>
<phase>package</phase>
<goals>
<goal>create</goal>
<goal>install-feature</goal>
<goal>deploy</goal>
<goal>package</goal>
</goals>
<configuration>
<outputDirectory>target/wlp-package</outputDirectory>
</configuration>
</execution>
</executions>
<configuration>
<include>runnable</include>
<serverName>${final.name}</serverName>
<bootstrapProperties>
<project.name>${final.name}</project.name>
<jwt.issuer>https://server.example.com</jwt.issuer>
</bootstrapProperties>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<id>copy</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
</execution>
</executions>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.9</version>
<type>jar</type>
</artifactItem>
</artifactItems>
<outputDirectory>liberty/wlp/usr/shared/resources</outputDirectory>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Dependency plugin 'outputDirectory' must match server.xml directory
You need to align your server config with the location you copy the dependency to in your Maven build.
(Your problem seems to be you have an extra 'jdbc' subdir in your server config, compared to the location you're copying into from your Maven build).
E.g.
server.xml
<server>
<library id="postgresql-library">
<fileset id="PostgreSQLFileset" dir="${shared.resource.dir}/jdbc"
includes="postgresql-42.2.9.jar"/>
</library>
</server>
should point to the same directory as:
pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<outputDirectory>${project.build.directory}/liberty/wlp/usr/shared/resources/jdbc</outputDirectory>
Follow-up note
Note there is an open issue now where we're discussing different ideas to add support into the liberty-maven-plugin itself for copying dependencies into place.
Here's an odd one. I have a Spring Boot app, that uses Groovy and Web starters. If I run mvn spring-boot:run it starts fine, and if I run mvn package and then java -jar demo-0.0.1-SNAPSHOT.jar it also runs fine. But if I choose Run As -> Spring Boot Application I get this error:
12:16:22.200 ERROR [Tomcat-startStop-1 ] [ContainerBase] [] A child
container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].TomcatEmbeddedContext[]]
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:939)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:872)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].TomcatEmbeddedContext[]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
... 6 common frames omitted
Caused by: org.apache.catalina.LifecycleException: Failed to start component [Pipeline[StandardEngine[Tomcat].StandardHost[localhost].TomcatEmbeddedContext[]]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5117)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 6 common frames omitted
Caused by: org.apache.catalina.LifecycleException: Failed to start component [org.apache.catalina.authenticator.NonLoginAuthenticator[]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
at org.apache.catalina.core.StandardPipeline.startInternal(StandardPipeline.java:182)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 8 common frames omitted
Caused by: java.lang.NoSuchMethodError: javax.servlet.ServletContext.getVirtualServerName()Ljava/lang/String;
at org.apache.catalina.authenticator.AuthenticatorBase.startInternal(AuthenticatorBase.java:1141)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 10 common frames omitted
12:16:22.201 ERROR [main ] [ContainerBase] [] A child container failed during start
In Eclipe's POM editor I don't see the javax.servlet-api.jar file being brought in, so I added it, but no effect.
Eclipse: Oxygen 4.7.1a
STS: 3.9.1.201710100539-RELEASE
Java: 1.8.0_151
POM is straight from start.spring.io:
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.9.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-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.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<goals>
<goal>addSources</goal>
<goal>addTestSources</goal>
<goal>generateStubs</goal>
<goal>compile</goal>
<goal>testGenerateStubs</goal>
<goal>testCompile</goal>
<goal>removeStubs</goal>
<goal>removeTestStubs</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Any ideas how to fix this?
Ah ha! I had to remove the "Groovy Libraries" and "Groovy DSL Support" from the Java Build Path in Eclipse - they were bringing in a servlet-api-2.4.jar file.
I am migrating project from jBoss-eap-5.1 to jboss-eap-6.0. I have defined jersey jars in the modules directory of jboss as follows:
com
|_jersey
|_jersey-core
|_jersey-client
|_jersey-server
|_jersey-servlet
In my project .pom file i defined the jars as follows:
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-servlet</artifactId>
<version>1.10</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-core</artifactId>
<version>${jersey-version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
<version>${jersey-version}</version>
<scope>test</scope>
</dependency>
However, when I try to deploy, I get the following error on ServletContainer class:
13:03:29,908 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-5) MSC000001: Failed to start service jboss.deployment.subunit."ApiEar-2.0.0-SNAPSHOT.ear"."ApiService-2.
0.0-SNAPSHOT.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.subunit."ApiEar-2.0.0-SNAPSHOT.ear"."ApiService-2.0.0-SNAPSHOT.war".POST_MODULE
: JBAS018733: Failed to process phase POST_MODULE of subdeployment "ApiService-2.0.0-SNAPSHOT.war" of deployment "ApiEar-2.0.0-SNAPSHOT.ear"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:123) [jboss-as-server-7.1.2.Final-redhat-1.jar:7.1.2.Final-redhat-1]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA-redhat-1.jar:1.0.2.GA-redhat-1]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA-redhat-1.jar:1.0.2.GA-redhat-1]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_32-ea]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_32-ea]
at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_32-ea]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: java.lang.ClassNotFoundException: com.sun.jersey.spi.container.servlet.ServletContainer from [Modu
le "deployment.ApiEar-2.0.0-SNAPSHOT.ear.ApiService-2.0.0-SNAPSHOT.war:main" from Service Module Loader]
at org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.checkDeclaredApplicationClassAsServlet(JaxrsScanningProcessor.java:295)
at org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.scanWebDeployment(JaxrsScanningProcessor.java:160)
at org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.deploy(JaxrsScanningProcessor.java:109)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:116) [jboss-as-server-7.1.2.Final-redhat-1.jar:7.1.2.Final-redhat-1]
... 5 more
Initially, I was getting this error when I did not define jersey-servlet, but I did some searching, and presumably, jersey-servlet.jar is the one that contains that class. However, that did solve the error.
I have solved the issue by adding this dependencies into my manifest.mf file. In my .pom file I added the build plugin:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<Dependencies>com.jersey.jersey-server,com.jersey.jersey-client,com.jersey.jersey-json</Dependencies>
</manifestEntries>
</archive>
</configuration>
</plugin>
that added references to the needed .jar files in my manifest file
Not an answer, but I believe this was implemented in jersey in version 10. That is when big overhaul of library happened
I am building a JBoss Application Server module, on JBossAS 7.1.1. While trying to modify the classpath in the manifest file, I ran into this error:
12:30:53,097 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015876: Starting deployment of "MyDeployableProject.war"
12:30:53,141 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC00001: Failed to start service jboss.deployment.unit."MyDeployableProject.war".STRUCTURE: org.jboss.msc.service.StartException in service jboss.deployment.unit."MyDeployableProject.war".STRUCTURE: Failed to process phase STRUCTURE of deployment "MyDeployableProject.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
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$Worker.runTask(ThreadPoolExecutor.java:886) [classes.jar:1.6.0_31]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [classes.jar:1.6.0_31]
at java.lang.Thread.run(Thread.java:680) [classes.jar:1.6.0_31]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: Failed to get manifest for deployment "/opt/server/bin/jboss-as-7.1.1.Final/standalone/deployments/MyDeployableProject.war"
at org.jboss.as.server.deployment.module.ManifestAttachmentProcessor.deploy(ManifestAttachmentProcessor.java:73) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
... 5 more
Caused by: java.io.IOException: invalid header field
at java.util.jar.Attributes.read(Attributes.java:393) [classes.jar:1.6.0_31]
at java.util.jar.Manifest.read(Manifest.java:182) [classes.jar:1.6.0_31]
at java.util.jar.Manifest.<init>(Manifest.java:52) [classes.jar:1.6.0_31]
at org.jboss.vfs.VFSUtils.readManifest(VFSUtils.java:216)
at org.jboss.vfs.VFSUtils.getManifest(VFSUtils.java:199)
at org.jboss.as.server.deployment.module.ManifestAttachmentProcessor.deploy(ManifestAttachmentProcessor.java:69) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
... 6 more
It turns out, a slight bug in MANIFEST.MF was causing this issue. The file was:
Manifest-Version: 1.0
Class-Path:
Turns out, the bug was due to there being no space after Class-Path:. This (only a space different) is what works:
Manifest-Version: 1.0
Class-Path:
Hopefully this will stop others from wondering.
Also, you could have something as:
Manifest-Version: 1.0
Dependencies: org.slf4j,org.apache.commons.logging
**,org.joda.time**
Built-By: Pablo
Build-Jdk: 1.6.0_30
Created-By: Apache Maven
Archiver-Version: Plexus Archiver
instead of
Manifest-Version: 1.0
Dependencies: org.slf4j,org.apache.commons.logging,org.joda.time
Built-By: Pablo
Build-Jdk: 1.6.0_30
Created-By: Apache Maven
Archiver-Version: Plexus Archiver
In this case, review pom.xml
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.2</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<archive>
<manifestEntries>
<!-- IMPORTANT: All dependencies in te same line --> <Dependencies>org.slf4j,org.apache.commons.logging,org.joda.time</Dependencies>
</manifestEntries>
</archive>
</configuration>
</plugin>