GlassFish Version (and build number)
8.0.0
JDK version
25
OS
Ubuntu 24.04.4 LTS
Database
Postgres
Problem Description
I am using application scoped resources registered in glassfish-resources.xml. When deploying the application(asadmin deploy ...), everything works well. When I restart the server(asadmin restart domain or asadmin stop-domain, asadin start-domain), the deployed apps are not accessible on the browser just an HTTP Status 404 - Not Found error page.
During restart, the below error is logged:
Exception during lifecycle processing
org.glassfish.deployment.common.DeploymentException: JNDI lookup failed for the resource: Name: my_persistence_unit, Lookup: java:app/jdbc/mydb, Type: javax.sql.DataSource
at com.sun.enterprise.deployment.util.ResourceValidator.validateJNDIRefs(ResourceValidator.java:886)
at com.sun.enterprise.deployment.util.ResourceValidator.validateResources(ResourceValidator.java:748)
at com.sun.enterprise.deployment.util.ResourceValidator.event(ResourceValidator.java:173)
at org.glassfish.kernel.event.EventsImpl$Listener.event(EventsImpl.java:185)
at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:142)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:485)
at com.sun.enterprise.v3.server.ApplicationLoaderService.processApplication(ApplicationLoaderService.java:405)
at com.sun.enterprise.v3.server.ApplicationLoaderService.postConstruct(ApplicationLoaderService.java:243)
at org.jvnet.hk2.internal.ClazzCreator.postConstructMe(ClazzCreator.java:356)
at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:410)
at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:479)
at org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.findOrCreate(AsyncRunLevelContext.java:288)
at org.glassfish.hk2.runlevel.RunLevelContext.findOrCreate(RunLevelContext.java:65)
at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2111)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:98)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:68)
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.oneJob(CurrentTaskFuture.java:1366)
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.run(CurrentTaskFuture.java:1294)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1090)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:614)
at java.base/java.lang.Thread.run(Thread.java:1474)
Caused by: javax.naming.NamingException: Lookup failed for java:app/jdbc/mydb in SerialContext[myEnv={java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming}] [Root exception is javax.naming.NameNotFoundException: No object bound for java:app/jdbc/mydb]
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:836)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:257)
at java.naming/javax.naming.InitialContext.lookup(InitialContext.java:409)
at java.naming/javax.naming.InitialContext.lookup(InitialContext.java:409)
at java.naming/javax.naming.InitialContext.doLookup(InitialContext.java:282)
at com.sun.enterprise.deployment.util.ResourceValidator.validateJNDIRefs(ResourceValidator.java:882)
... 20 more
Caused by: javax.naming.NameNotFoundException: No object bound for java:app/jdbc/mydb
at com.sun.enterprise.naming.impl.JavaURLContext.lookup(JavaURLContext.java:135)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:818)
... 25 more
Suppressed: javax.naming.NamingException: Invocation exception: Got null ComponentInvocation!
at com.sun.enterprise.naming.impl.GlassfishNamingManagerImpl.getComponentInvocation(GlassfishNamingManagerImpl.java:721)
at com.sun.enterprise.naming.impl.GlassfishNamingManagerImpl.getComponentId(GlassfishNamingManagerImpl.java:703)
at com.sun.enterprise.naming.impl.GlassfishNamingManagerImpl.lookup(GlassfishNamingManagerImpl.java:586)
at com.sun.enterprise.naming.impl.JavaURLContext.lambda$lookup$0(JavaURLContext.java:153)
at com.sun.enterprise.naming.impl.JavaURLContext.lookupOrCollectException(JavaURLContext.java:550)
at com.sun.enterprise.naming.impl.JavaURLContext.lookup(JavaURLContext.java:153)
... 26 more
]]
Sample config:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE resources PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Resource Definitions//EN" "http://glassfish.org/dtds/glassfish-resources_1_5.dtd">
<resources>
<jdbc-connection-pool datasource-classname="org.postgresql.ds.PGSimpleDataSource"
is-isolation-level-guaranteed="false"
name="dbPool"
res-type="javax.sql.DataSource">
<property name="serverName" value="localhost"/>
<property name="PortNumber" value="5432"/>
<property name="DatabaseName" value="mydb"/>
<property name="User" value="user"/>
<property name="Password" value="password"/>
</jdbc-connection-pool>
<jdbc-resource enabled="true" jndi-name="java:app/jdbc/mydb" object-type="user" pool-name="dbPool">
</jdbc-resource>
</resources>
Steps to reproduce
Create an app and add resource in glassfish-resources.xml like the sample config above.
Impact of Issue
Whenever I restart the server on prod or locally, I have to deploy the apps again for them to be accessible.
GlassFish Version (and build number)
8.0.0
JDK version
25
OS
Ubuntu 24.04.4 LTS
Database
Postgres
Problem Description
I am using application scoped resources registered in
glassfish-resources.xml. When deploying the application(asadmin deploy ...), everything works well. When I restart the server(asadmin restart domainorasadmin stop-domain,asadin start-domain), the deployed apps are not accessible on the browser just anHTTP Status 404 - Not Founderror page.During restart, the below error is logged:
Sample config:
Steps to reproduce
Create an app and add resource in
glassfish-resources.xmllike the sample config above.Impact of Issue
Whenever I restart the server on prod or locally, I have to deploy the apps again for them to be accessible.