Closed inad9300 closed 1 year ago
This can happen if the liberty-maven-plugin deploys the app in two different ways, roughly speaking.
Next time it happens please gather and share
target/liberty/wlp/usr/servers/defaultServer/configDropins/
, some of the contents of which may be generated by the liberty-maven-pluginapps
and dropins
, directoriesas well as your best description of what you were doing.
It might be possible for us to make a suggestion if you were to just share the pom.xml and server.xml, though that might not really show anything conclusive.
I will keep this in mind for next time (it doesn't happen too often). For the pom.xml and server.xml files, please refer to https://github.com/OpenLiberty/ci.maven/issues/1587#issuecomment-1242933252.
Alright, it has happened again.
Your server config: server.xml, as well as the configDropins directory, e.g.
target/liberty/wlp/usr/servers/defaultServer/configDropins/
I can't find that directory, only target/liberty/wlp/usr/servers/defaultServer/dropins/
, which is completely empty.
Your liberty-maven-plugin config (pom.xml, etc.)
I have nothing extraordinary in this regard. Please, refer to the other ticket.
The contents of your server's apps and dropins, directories
"dropins" is empty. "apps" contains a single file, "app.war.xml", with the following content:
<?xml version="1.0" encoding="UTF-8"?>
<archive>
<dir sourceOnDisk="/app/target/classes" targetInArchive="/WEB-INF/classes"/>
<!-- A few entries have been omitted... -->
<file sourceOnDisk="/app/.mvn/repository/org/apache/commons/commons-csv/1.9.0/commons-csv-1.9.0.jar" targetInArchive="/WEB-INF/lib/commons-csv-1.9.0.jar"/>
<file sourceOnDisk="/app/.mvn/repository/jakarta/json/bind/jakarta.json.bind-api/2.0.0/jakarta.json.bind-api-2.0.0.jar" targetInArchive="/WEB-INF/lib/jakarta.json.bind-api-2.0.0.jar"/>
<file sourceOnDisk="/app/.mvn/repository/jakarta/json/jakarta.json-api/2.0.1/jakarta.json-api-2.0.1.jar" targetInArchive="/WEB-INF/lib/jakarta.json-api-2.0.1.jar"/>
<file sourceOnDisk="/app/.mvn/repository/jakarta/annotation/jakarta.annotation-api/2.0.0/jakarta.annotation-api-2.0.0.jar" targetInArchive="/WEB-INF/lib/jakarta.annotation-api-2.0.0.jar"/>
<file sourceOnDisk="/app/.mvn/repository/org/checkerframework/checker-qual/3.5.0/checker-qual-3.5.0.jar" targetInArchive="/WEB-INF/lib/checker-qual-3.5.0.jar"/>
<file sourceOnDisk="/app/.mvn/repository/org/jgroups/jgroups/5.2.0.Final/jgroups-5.2.0.Final.jar" targetInArchive="/WEB-INF/lib/jgroups-5.2.0.Final.jar"/>
<file sourceOnDisk="/app/.mvn/repository/io/netty/netty-transport-native-epoll/4.1.77.Final/netty-transport-native-epoll-4.1.77.Final-linux-x86_64.jar" targetInArchive="/WEB-INF/lib/netty-transport-native-epoll-4.1.77.Final-linux-x86_64.jar"/>
<file sourceOnDisk="/app/.mvn/repository/io/netty/netty-transport-native-unix-common/4.1.77.Final/netty-transport-native-unix-common-4.1.77.Final.jar" targetInArchive="/WEB-INF/lib/netty-transport-native-unix-common-4.1.77.Final.jar"/>
<file sourceOnDisk="/app/.mvn/repository/io/netty/netty-transport-classes-epoll/4.1.77.Final/netty-transport-classes-epoll-4.1.77.Final.jar" targetInArchive="/WEB-INF/lib/netty-transport-classes-epoll-4.1.77.Final.jar"/>
<file sourceOnDisk="/app/.mvn/repository/io/netty/netty-transport-native-kqueue/4.1.77.Final/netty-transport-native-kqueue-4.1.77.Final-osx-x86_64.jar" targetInArchive="/WEB-INF/lib/netty-transport-native-kqueue-4.1.77.Final-osx-x86_64.jar"/>
<file sourceOnDisk="/app/.mvn/repository/io/netty/netty-transport-classes-kqueue/4.1.77.Final/netty-transport-classes-kqueue-4.1.77.Final.jar" targetInArchive="/WEB-INF/lib/netty-transport-classes-kqueue-4.1.77.Final.jar"/>
<file sourceOnDisk="/app/.mvn/repository/io/netty/netty-codec-http/4.1.77.Final/netty-codec-http-4.1.77.Final.jar" targetInArchive="/WEB-INF/lib/netty-codec-http-4.1.77.Final.jar"/>
<file sourceOnDisk="/app/.mvn/repository/io/netty/netty-buffer/4.1.77.Final/netty-buffer-4.1.77.Final.jar" targetInArchive="/WEB-INF/lib/netty-buffer-4.1.77.Final.jar"/>
<file sourceOnDisk="/app/.mvn/repository/io/netty/netty-transport/4.1.77.Final/netty-transport-4.1.77.Final.jar" targetInArchive="/WEB-INF/lib/netty-transport-4.1.77.Final.jar"/>
<file sourceOnDisk="/app/.mvn/repository/io/netty/netty-resolver/4.1.77.Final/netty-resolver-4.1.77.Final.jar" targetInArchive="/WEB-INF/lib/netty-resolver-4.1.77.Final.jar"/>
<file sourceOnDisk="/app/.mvn/repository/io/netty/netty-handler/4.1.77.Final/netty-handler-4.1.77.Final.jar" targetInArchive="/WEB-INF/lib/netty-handler-4.1.77.Final.jar"/>
<file sourceOnDisk="/app/.mvn/repository/io/netty/netty-handler-proxy/4.1.77.Final/netty-handler-proxy-4.1.77.Final.jar" targetInArchive="/WEB-INF/lib/netty-handler-proxy-4.1.77.Final.jar"/>
<file sourceOnDisk="/app/.mvn/repository/io/netty/netty-codec/4.1.77.Final/netty-codec-4.1.77.Final.jar" targetInArchive="/WEB-INF/lib/netty-codec-4.1.77.Final.jar"/>
<file sourceOnDisk="/app/.mvn/repository/io/netty/netty-codec-socks/4.1.77.Final/netty-codec-socks-4.1.77.Final.jar" targetInArchive="/WEB-INF/lib/netty-codec-socks-4.1.77.Final.jar"/>
<file sourceOnDisk="/app/.mvn/repository/io/netty/netty-common/4.1.77.Final/netty-common-4.1.77.Final.jar" targetInArchive="/WEB-INF/lib/netty-common-4.1.77.Final.jar"/>
<file sourceOnDisk="/app/.mvn/repository/org/jboss/logging/jboss-logging/3.5.0.Final/jboss-logging-3.5.0.Final.jar" targetInArchive="/WEB-INF/lib/jboss-logging-3.5.0.Final.jar"/>
<file sourceOnDisk="/app/.mvn/repository/commons-beanutils/commons-beanutils/1.9.4/commons-beanutils-1.9.4.jar" targetInArchive="/WEB-INF/lib/commons-beanutils-1.9.4.jar"/>
<file sourceOnDisk="/app/.mvn/repository/commons-logging/commons-logging/1.2/commons-logging-1.2.jar" targetInArchive="/WEB-INF/lib/commons-logging-1.2.jar"/>
<file sourceOnDisk="/app/.mvn/repository/commons-collections/commons-collections/3.2.2/commons-collections-3.2.2.jar" targetInArchive="/WEB-INF/lib/commons-collections-3.2.2.jar"/>
<file sourceOnDisk="/app/.mvn/repository/jakarta/jms/jakarta.jms-api/3.1.0/jakarta.jms-api-3.1.0.jar" targetInArchive="/WEB-INF/lib/jakarta.jms-api-3.1.0.jar"/>
<file sourceOnDisk="/app/.mvn/repository/org/eclipse/persistence/org.eclipse.persistence.jpa.modelgen.processor/3.0.3/org.eclipse.persistence.jpa.modelgen.processor-3.0.3.jar" targetInArchive="/WEB-INF/lib/org.eclipse.persistence.jpa.modelgen.processor-3.0.3.jar"/>
<file sourceOnDisk="/app/.mvn/repository/org/eclipse/persistence/org.eclipse.persistence.jpa/3.0.3/org.eclipse.persistence.jpa-3.0.3.jar" targetInArchive="/WEB-INF/lib/org.eclipse.persistence.jpa-3.0.3.jar"/>
<file sourceOnDisk="/app/.mvn/repository/org/eclipse/persistence/org.eclipse.persistence.asm/9.3.0/org.eclipse.persistence.asm-9.3.0.jar" targetInArchive="/WEB-INF/lib/org.eclipse.persistence.asm-9.3.0.jar"/>
<file sourceOnDisk="/app/.mvn/repository/org/eclipse/persistence/org.eclipse.persistence.core/3.0.3/org.eclipse.persistence.core-3.0.3.jar" targetInArchive="/WEB-INF/lib/org.eclipse.persistence.core-3.0.3.jar"/>
<file sourceOnDisk="/app/.mvn/repository/org/eclipse/persistence/org.eclipse.persistence.jpa.jpql/3.0.3/org.eclipse.persistence.jpa.jpql-3.0.3.jar" targetInArchive="/WEB-INF/lib/org.eclipse.persistence.jpa.jpql-3.0.3.jar"/>
<file sourceOnDisk="/app/.mvn/repository/jakarta/persistence/jakarta.persistence-api/3.0.0/jakarta.persistence-api-3.0.0.jar" targetInArchive="/WEB-INF/lib/jakarta.persistence-api-3.0.0.jar"/>
<file sourceOnDisk="/app/.mvn/repository/org/eclipse/yasson/2.0.4/yasson-2.0.4.jar" targetInArchive="/WEB-INF/lib/yasson-2.0.4.jar"/>
<file sourceOnDisk="/app/.mvn/repository/org/glassfish/jakarta.json/2.0.0/jakarta.json-2.0.0-module.jar" targetInArchive="/WEB-INF/lib/jakarta.json-2.0.0-module.jar"/>
<file sourceOnDisk="/app/.mvn/repository/org/apache/ant/ant/1.10.12/ant-1.10.12.jar" targetInArchive="/WEB-INF/lib/ant-1.10.12.jar"/>
<file sourceOnDisk="/app/.mvn/repository/org/apache/ant/ant-junit/1.10.12/ant-junit-1.10.12.jar" targetInArchive="/WEB-INF/lib/ant-junit-1.10.12.jar"/>
<file sourceOnDisk="/app/.mvn/repository/org/apache/ant/ant-launcher/1.10.12/ant-launcher-1.10.12.jar" targetInArchive="/WEB-INF/lib/ant-launcher-1.10.12.jar"/>
<file sourceOnDisk="/app/.mvn/repository/org/apache/ant/ant-antlr/1.10.12/ant-antlr-1.10.12.jar" targetInArchive="/WEB-INF/lib/ant-antlr-1.10.12.jar"/>
<file sourceOnDisk="/app/.mvn/repository/info/picocli/picocli/4.6.3/picocli-4.6.3.jar" targetInArchive="/WEB-INF/lib/picocli-4.6.3.jar"/>
<file sourceOnDisk="/app/.mvn/repository/com/github/javaparser/javaparser-core/3.24.2/javaparser-core-3.24.2.jar" targetInArchive="/WEB-INF/lib/javaparser-core-3.24.2.jar"/>
<file sourceOnDisk="/app/.mvn/repository/org/ow2/asm/asm-util/9.3/asm-util-9.3.jar" targetInArchive="/WEB-INF/lib/asm-util-9.3.jar"/>
<file sourceOnDisk="/app/.mvn/repository/org/ow2/asm/asm/9.3/asm-9.3.jar" targetInArchive="/WEB-INF/lib/asm-9.3.jar"/>
<file sourceOnDisk="/app/.mvn/repository/org/ow2/asm/asm-tree/9.3/asm-tree-9.3.jar" targetInArchive="/WEB-INF/lib/asm-tree-9.3.jar"/>
<file sourceOnDisk="/app/.mvn/repository/org/ow2/asm/asm-analysis/9.3/asm-analysis-9.3.jar" targetInArchive="/WEB-INF/lib/asm-analysis-9.3.jar"/>
<file sourceOnDisk="/app/.mvn/repository/org/abego/treelayout/org.abego.treelayout.core/1.0.3/org.abego.treelayout.core-1.0.3.jar" targetInArchive="/WEB-INF/lib/org.abego.treelayout.core-1.0.3.jar"/>
<file sourceOnDisk="/app/.mvn/repository/org/apache/ivy/ivy/2.5.0/ivy-2.5.0.jar" targetInArchive="/WEB-INF/lib/ivy-2.5.0.jar"/>
<file sourceOnDisk="/app/.mvn/repository/com/thoughtworks/qdox/qdox/1.12.1/qdox-1.12.1.jar" targetInArchive="/WEB-INF/lib/qdox-1.12.1.jar"/>
<file sourceOnDisk="/app/.mvn/repository/jline/jline/2.14.6/jline-2.14.6.jar" targetInArchive="/WEB-INF/lib/jline-2.14.6.jar"/>
<file sourceOnDisk="/app/.mvn/repository/junit/junit/4.13.2/junit-4.13.2.jar" targetInArchive="/WEB-INF/lib/junit-4.13.2.jar"/>
<file sourceOnDisk="/app/.mvn/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar" targetInArchive="/WEB-INF/lib/hamcrest-core-1.3.jar"/>
<file sourceOnDisk="/app/.mvn/repository/org/junit/platform/junit-platform-launcher/1.8.2/junit-platform-launcher-1.8.2.jar" targetInArchive="/WEB-INF/lib/junit-platform-launcher-1.8.2.jar"/>
<file sourceOnDisk="/app/.mvn/repository/com/fasterxml/jackson/dataformat/jackson-dataformat-yaml/2.13.3/jackson-dataformat-yaml-2.13.3.jar" targetInArchive="/WEB-INF/lib/jackson-dataformat-yaml-2.13.3.jar"/>
<file sourceOnDisk="/app/.mvn/repository/org/yaml/snakeyaml/1.30/snakeyaml-1.30.jar" targetInArchive="/WEB-INF/lib/snakeyaml-1.30.jar"/>
<file sourceOnDisk="/app/.mvn/repository/com/fasterxml/jackson/core/jackson-core/2.13.3/jackson-core-2.13.3.jar" targetInArchive="/WEB-INF/lib/jackson-core-2.13.3.jar"/>
<file sourceOnDisk="/app/.mvn/repository/com/fasterxml/jackson/core/jackson-databind/2.13.3/jackson-databind-2.13.3.jar" targetInArchive="/WEB-INF/lib/jackson-databind-2.13.3.jar"/>
<file sourceOnDisk="/app/.mvn/repository/com/fasterxml/jackson/core/jackson-annotations/2.13.3/jackson-annotations-2.13.3.jar" targetInArchive="/WEB-INF/lib/jackson-annotations-2.13.3.jar"/>
<file sourceOnDisk="/app/.mvn/repository/org/junit/jupiter/junit-jupiter-api/5.9.0/junit-jupiter-api-5.9.0.jar" targetInArchive="/WEB-INF/lib/junit-jupiter-api-5.9.0.jar"/>
<file sourceOnDisk="/app/.mvn/repository/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar" targetInArchive="/WEB-INF/lib/opentest4j-1.2.0.jar"/>
<file sourceOnDisk="/app/.mvn/repository/org/junit/platform/junit-platform-commons/1.9.0/junit-platform-commons-1.9.0.jar" targetInArchive="/WEB-INF/lib/junit-platform-commons-1.9.0.jar"/>
<file sourceOnDisk="/app/.mvn/repository/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar" targetInArchive="/WEB-INF/lib/apiguardian-api-1.1.2.jar"/>
<file sourceOnDisk="/app/.mvn/repository/org/junit/jupiter/junit-jupiter-engine/5.9.0/junit-jupiter-engine-5.9.0.jar" targetInArchive="/WEB-INF/lib/junit-jupiter-engine-5.9.0.jar"/>
<file sourceOnDisk="/app/.mvn/repository/org/junit/platform/junit-platform-engine/1.9.0/junit-platform-engine-1.9.0.jar" targetInArchive="/WEB-INF/lib/junit-platform-engine-1.9.0.jar"/>
<file sourceOnDisk="/app/target/tmp/META-INF/MANIFEST.MF" targetInArchive="/META-INF/MANIFEST.MF"/>
</archive>
your best description of what you were doing.
I was doing nothing more than making changes to a single source code file – admittedly at a rapid pace, with some undo/redo involved. I was also running unit tests by pressing "Enter" after some of those changes.
Here is the contents of my terminal when the error ocurred:
[INFO] Unit tests finished.
[INFO]
[INFO] Running integration tests...
[INFO] Tests are skipped.
[INFO] Tests are skipped.
[INFO] Integration tests finished.
[INFO]
[INFO] To run tests on demand, press Enter.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
[INFO] Source compilation was successful.
[INFO] Tests compilation was successful.
[INFO] [ERROR ] CWWKS9110E: During application startup, the application failed to start because multiple applications were found to have the name of app. Security authorization policies require that names be unique. Review the application configuration in the server.xml.
[INFO] [ERROR ] CWWKZ0004E: An exception occurred while starting the application app. The exception message was: com.ibm.ws.container.service.metadata.MetaDataException: CWWKS9110E: Multiple applications have the name app. Security authorization policies requires that names be unique.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
[INFO] Source compilation was successful.
[INFO] Tests compilation was successful.
[INFO] [WARNING ] CWWJP0019W: The app application has already started.
[INFO] [AUDIT ] CWWKT0016I: Web application available (default_host): http://6d33ea13a3bb:9080/
[INFO] [ERROR ] CWOWB1000E: A CDI error has occurred: CWNEN0030E: The server was unable to obtain an object instance for the java:comp/env/org.example.util.BaseRepository/em reference. The exception message was: jakarta.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 3.0.2.v202107120736): org.eclipse.persistence.exceptions.EntityManagerSetupException
[INFO] Exception Description: Predeployment of PersistenceUnit [app-persistence-unit] failed.
[INFO] Internal Exception: Exception [EclipseLink-7250] (Eclipse Persistence Services - 3.0.2.v202107120736): org.eclipse.persistence.exceptions.ValidationException
[INFO] Exception Description: [class org.example.Example] uses a non-entity [class org.example.OtherExample] as target entity in the relationship attribute [field otherExample].
[INFO] [ERROR ] CWOWB1000E: A CDI error has occurred: CWNEN0030E: The server was unable to obtain an object instance for the java:comp/env/org.example.util.BaseRepository/em reference. The exception message was: jakarta.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 3.0.2.v202107120736): org.eclipse.persistence.exceptions.EntityManagerSetupException
[INFO] Exception Description: Predeployment of PersistenceUnit [app-persistence-unit] failed.
[INFO] Internal Exception: Exception [EclipseLink-7250] (Eclipse Persistence Services - 3.0.2.v202107120736): org.eclipse.persistence.exceptions.ValidationException
[INFO] Exception Description: [class org.example.Example] uses a non-entity [class org.example.OtherExample] as target entity in the relationship attribute [field otherExample].
[INFO] [ERROR ] SRVE0283E: Exception caught while initializing context: java.lang.NullPointerException: Cannot invoke "jakarta.persistence.EntityManager.getCriteriaBuilder()" because "this.em" is null
[INFO] at org.example.util.BaseRepository.onInit(BaseRepository.java:35)
[INFO] at jdk.internal.reflect.GeneratedMethodAccessor3159.invoke(Unknown Source)
[INFO] at java.base/java.lang.reflect.Method.invoke(Method.java:568)
[INFO] at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:95)
[INFO] at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:85)
[INFO] at org.jboss.weld.injection.MethodInvocationStrategy$SimpleMethodInvocationStrategy.invoke(MethodInvocationStrategy.java:168)
[INFO] at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:330)
[INFO] at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:308)
[INFO] at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:286)
[INFO] at jakarta.enterprise.inject.spi.ObserverMethod.notify(ObserverMethod.java:125)
[INFO] at org.jboss.weld.util.Observers.notify(Observers.java:166)
[INFO] at org.jboss.weld.event.ObserverNotifier.notifySyncObservers(ObserverNotifier.java:285)
[INFO] at org.jboss.weld.event.ObserverNotifier.notify(ObserverNotifier.java:273)
[INFO] at org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:177)
[INFO] at org.jboss.weld.bootstrap.BeanDeploymentModule.fireEvent(BeanDeploymentModule.java:93)
[INFO] at org.jboss.weld.module.web.servlet.HttpContextLifecycle.fireEventForApplicationScope(HttpContextLifecycle.java:161)
[INFO] at org.jboss.weld.module.web.servlet.HttpContextLifecycle.contextInitialized(HttpContextLifecycle.java:147)
[INFO] at org.jboss.weld.module.web.servlet.WeldInitialListener.contextInitialized(WeldInitialListener.java:99)
[INFO] at com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:2447)
[INFO] at [internal classes]
[INFO]
[INFO] [ERROR ] SRVE0265E: Error occured while notifying listeners of web application start: java.lang.NullPointerException: Cannot invoke "jakarta.persistence.EntityManager.getCriteriaBuilder()" because "this.em" is null
[INFO] at org.example.util.BaseRepository.onInit(BaseRepository.java:35)
[INFO] at jdk.internal.reflect.GeneratedMethodAccessor3159.invoke(Unknown Source)
[INFO] at java.base/java.lang.reflect.Method.invoke(Method.java:568)
[INFO] at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:95)
[INFO] at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:85)
[INFO] at org.jboss.weld.injection.MethodInvocationStrategy$SimpleMethodInvocationStrategy.invoke(MethodInvocationStrategy.java:168)
[INFO] at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:330)
[INFO] at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:308)
[INFO] at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:286)
[INFO] at jakarta.enterprise.inject.spi.ObserverMethod.notify(ObserverMethod.java:125)
[INFO] at org.jboss.weld.util.Observers.notify(Observers.java:166)
[INFO] at org.jboss.weld.event.ObserverNotifier.notifySyncObservers(ObserverNotifier.java:285)
[INFO] at org.jboss.weld.event.ObserverNotifier.notify(ObserverNotifier.java:273)
[INFO] at org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:177)
[INFO] at org.jboss.weld.bootstrap.BeanDeploymentModule.fireEvent(BeanDeploymentModule.java:93)
[INFO] at org.jboss.weld.module.web.servlet.HttpContextLifecycle.fireEventForApplicationScope(HttpContextLifecycle.java:161)
[INFO] at org.jboss.weld.module.web.servlet.HttpContextLifecycle.contextInitialized(HttpContextLifecycle.java:147)
[INFO] at org.jboss.weld.module.web.servlet.WeldInitialListener.contextInitialized(WeldInitialListener.java:99)
[INFO] at com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:2447)
[INFO] at [internal classes]
[INFO]
[INFO] [AUDIT ] CWWKZ0020I: Application app not updated.
The onInit()
method mentioned above is defined like so:
private void onInit(@Observes @Initialized(ApplicationScoped.class) Object __) {
// Do something with injected field `em` (instance of `EntityManager`)...
}
It would seem that an exception within a method annotated to be called at application startup is rendering the plugin unable to redeploy any new versions of the application. I get this particular exception often when making changes to database entities – I believe it's related to the automated generation of metamodel classes with EclipseLink, which is quite a messy business. In this case I had changed a model, but many, many minutes before seeing the error, so I don't really know what to think. In fact, I hadn't changed at all the classes referenced in the error message (here "Example" and "OtherExample"). Regardless of the exact cause, the fact that an exception was raised within onInit()
seems to be the relevant part.
I have found a way to reproduce this issue consistently. Making the following JPA mapping mistake, the server isn't able to recover even after fixing it:
@Entity
@Inheritance(strategy = JOINED)
@DiscriminatorColumn(discriminatorType = INTEGER)
@DiscriminatorValue("0")
public class Parent {}
@Entity
// @DiscriminatorValue("1")
public class Child extends Parent {}
@DiscriminatorValue
is required in this context, but I forgot to add it. Even after adding it, the server continued stuck in the "multiple applications with the same name" error.
@inad9300 that's interesting.
Reading back over your comments I tried to recreate the issue with a simpler example without using a DB or JPA.
I experimented enough to make me believe that we probably don't have an issue specifically with dev mode.
That is, I don't think that there's one, general issue with recovering from errors that cause an app failure. I suspect there could be issues with individual components, e.g. the JPA implementation.
Building on your example, I created this simple class and enabled the CDI feature:
@ApplicationScoped
public class MyObserver {
public void onInit(@Observes @Initialized(ApplicationScoped.class) Object bean ) {
Class clazz = this.getClass();
// Uncomment to cause failure
//clazz = null;
System.out.println("From onInit(), in " + clazz.toString());
}
}
Running in dev mode, with this class I was able to easily toggle back and forth between a working and non-working app, i.e. recover from its failure when I forced the NPE.
If you are interested to pursue this further, we could isolate the app in the server runtime and take dev mode out of the equation and see if your problem persists. If it does we could open an issue with the Open Liberty runtime.
It would be relatively easy. All you'd need to do is:
mvn liberty:run
# Wait for server and app to complete startup. The 'run' goal includes the "all-in-one" aspect of 'dev' (install + configure Liberty, deploy app) but it doesn't run in the "watcher" loop. It just runs the server in the foreground.mvn compile
# watch app updatemvn compile
# watch app update again
..... and so on...That's right...because 'run' uses the same "loose application" format to deploy the app to Liberty, you'd typically be able to update the deployed app simply with a compile.
(If this doesn't work, you could have a server config that could be adjusted and I could get into that if needed).
I found yet another area where there may be an issue when I was investigating. I had run the very simple sample observer above tacked on to our JPA guide (https://openliberty.io/guides/jpa-intro.html). This config uses a fairly simple WAR with "quickStartSecurity" enabled.
The security aspect did not "recycle" cleanly across the app failure. I saw:
[INFO] [ERROR ] CWWKS9110E: During application startup, the application failed to start because multiple applications were found to have the name of backendServices. Security authorization policies re quire that names be unique. Review the application configuration in the server.xml. [INFO] [ERROR ] CWWKZ0004E: An exception occurred while starting the application backendServices. The exception message was: com.ibm.ws.container.service.metadata.MetaDataException: CWWKS9110E: Multip le applications have the name backendServices. Security authorization policies requires that names be unique.
So this too seems to speak to the fact that there may be components in the runtime that do not recover well from application failures, even if it's not dev mode itself.
Thank you again for all the detail and help recreating.
So, I've done as you suggested:
mvn liberty:run
and wait for it to start. Everything seems normal.mvn compile
. Got the NPE from within onInit()
(following your simpler method to reproduce the issue), then this:
[INFO] [AUDIT ] CWWKZ0020I: Application backend not updated.
[INFO] [AUDIT ] CWWKT0017I: Web application removed (default_host): http://79792387ab37:9080/
[INFO] [ERROR ] CWWKS9110E: During application startup, the application failed to start because multiple applications were found to have the name of backend. Security authorization policies require that names be unique. Review the application configuration in the server.xml.
[INFO] [ERROR ] CWWKZ0004E: An exception occurred while starting the application backend. The exception message was: com.ibm.ws.container.service.metadata.MetaDataException: CWWKS9110E: Multiple applications have the name backend. Security authorization policies requires that names be unique.
mvn compile
again. Got the same name uniqueness problem.Is that what you were interested in seen? :slightly_smiling_face:
Yes, that's exactly what I'd suggested. So, based on that, IMHO, it seems legitimate to open an issue on the Open Liberty runtime: https://github.com/OpenLiberty/open-liberty/issues, if you'd like. The more recreate detail you can provide the better and the server.xml feature set in particular would be helpful.
The Open Liberty issue was addressed back in March. So I am closing this issue.
From time to time, I would see the following error printed in the console during development:
After which my only option is to manually stop and restart liberty:dev. There might be some exceptional condition under which it fails to unregister/re-register the application. Let me know what more information I can give you.