The error is in the title. It's very strange, because I was doing some modifications to the xhtml code and its beans, turning the glassfish server on and off and on again several times, and suddenly this error appeared. I did not touch the web.xml or any of those types of files while I was working, just the xhtml and its beans.
Error message:
Severe: JNDI lookup failed for the resource: Name: JPATestPU, Lookup: java:app/jpaDB, Type: javax.sql.DataSource.
Severe: Exception while deploying the app [JPAAdvanced]
Severe: Exception during lifecycle processing
org.glassfish.deployment.common.DeploymentException: JNDI lookup failed for the resource: Name: [JPATestPU], Lookup: [java:app/jpaDB], Type: [javax.sql.DataSource]
at[...]
Caused by: javax.naming.NamingException: Lookup failed for 'java:app/jpaDB' 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.NamingException: Invocation exception: Got null ComponentInvocation ]
at[...]
Caused by: javax.naming.NamingException: Invocation exception: Got null ComponentInvocation
at[...]
Severe: Exception while deploying the app [JPAAdvanced] : JNDI lookup failed for the resource: Name: [JPATestPU], Lookup: [java:app/jpaDB], Type: [javax.sql.DataSource]
javax.naming.NamingException: Lookup failed for 'java:app/jpaDB' 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.NamingException: Invocation exception: Got null ComponentInvocation ]
at[...]
Caused by: javax.naming.NamingException: Invocation exception: Got null ComponentInvocation
at[...]
The web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>faces/index.xhtml</welcome-file>
</welcome-file-list>
</web-app>
The glasfish-resources.xml
<?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 allow-non-component-callers="false" associate-with-thread="false" connection-creation-retry-attempts="0" connection-creation-retry-interval-in-seconds="10" connection-leak-reclaim="false" connection-leak-timeout-in-seconds="0" connection-validation-method="auto-commit" datasource-classname="org.postgresql.ds.PGSimpleDataSource" fail-all-connections="false" idle-timeout-in-seconds="300" is-connection-validation-required="false" is-isolation-level-guaranteed="true" lazy-connection-association="false" lazy-connection-enlistment="false" match-connections="false" max-connection-usage-count="0" max-pool-size="32" max-wait-time-in-millis="60000" name="post-gre-sql_jpaDB_postgresPool" non-transactional-connections="false" pool-resize-quantity="2" res-type="javax.sql.DataSource" statement-timeout-in-seconds="-1" steady-pool-size="8" validate-atmost-once-period-in-seconds="0" wrap-jdbc-objects="false">
<property name="serverName" value="localhost"/>
<property name="portNumber" value="5432"/>
<property name="databaseName" value="jpaDB"/>
<property name="User" value="postgres"/>
<property name="Password" value="*****"/>
<property name="URL" value="jdbc:postgresql://localhost:5432/jpaDB"/>
<property name="driverClass" value="org.postgresql.Driver"/>
</jdbc-connection-pool>
<jdbc-resource enabled="true" jndi-name="java:app/jpaDB" object-type="user" pool-name="post-gre-sql_jpaDB_postgresPool"/>
</resources>
If there is anything else to add, please say so and I will add it.
In my case I removed the eclipse jar file in netbeans. Click the eclipse jar file under libraries and click remove. Then Right on Libraries, choose add Jar and provide the location of the Eclipse jar file.
After try deploy you project it shall work
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.