Ошибка поиска JNDI для ресурса Тип: javax.sql.DataSource - PullRequest
0 голосов
/ 26 июня 2019

Ошибка в названии. Это очень странно, потому что я делал некоторые изменения в коде xhtml и его bean-компонентах, включал и выключал и снова включал сервер glassfish несколько раз, и внезапно появилась эта ошибка. Я не трогал web.xml или любой из этих типов файлов во время работы, только xhtml и его компоненты.

Сообщение об ошибке:

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[...]

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>

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>

Если есть что добавить, скажите, и я добавлю.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...