Date: Sat, 10 May 2014 13:21:58 +0100
From: akudinobi.stanley_at_gmail.com
To: users_at_glassfish.java.net; dev_at_glassfish.java.net
Subject: [gf-users] DEPLOYMENT EROOR
Good day every body!
MG>Hello Stan
I recently encountered a deployment error on my Glass Fish Server while trying to deploy my application.
Intially I configured the database( mysql) in my platform (Netbeans) on the Java EE through JNDI i.e I Right Clicked Source Package/New/Entity Classes from Database/Data Source/New Data/Database Connection → jdbc:mysql………/JNDI Name → (jdbc/zoodatabase)/Ok.
When I deployed the application, I got the following info:
1) ON MY RUN(APP) I GOT THE RESULT BELOW
NetBeans: Deploying on GlassFish Server 4
profile mode: false
debug mode: false
force redeploy: true
In-place deployment at C:\Users\user\Documents\NetBeansProjects\MyApp\target\classes
GlassFish Server 4, deploy, null, false
cd C:\Users\user\Documents\NetBeansProjects\MyApp; "JAVA_HOME=C:\\Program Files\\Java\\jdk1.7.0_40" cmd /c "\"\"C:\\Program Files\\NetBeans 8.0\\java\\maven\\bin\\mvn.bat\" -Dnetbeans.deploy=true -Dmaven.ext.class.path=\"C:\\Program Files\\NetBeans 8.0\\java\\maven-nblib\\netbeans-eventspy.jar\" -Dfile.encoding=UTF-8 package\""
Scanning for projects...
Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
------------------------------------------------------------------------
Building MyApp 1.0-SNAPSHOT
------------------------------------------------------------------------
--- maven-dependency-plugin:2.6:copy (default) @ MyApp ---
--- maven-resources-plugin:2.6:resources (default-resources) @ MyApp ---
Using 'UTF-8' encoding to copy filtered resources.
Copying 2 resources
--- maven-compiler-plugin:3.1:compile (default-compile) @ MyApp ---
Nothing to compile - all classes are up to date
--- maven-resources-plugin:2.6:testResources (default-testResources) @ MyApp ---
Using 'UTF-8' encoding to copy filtered resources.
skip non existing resourceDirectory C:\Users\user\Documents\NetBeansProjects\MyApp\src\test\resources
--- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ MyApp ---
No sources to compile
--- maven-surefire-plugin:2.12.4:test (default-test) @ MyApp ---
--- maven-ejb-plugin:2.3:ejb (default-ejb) @ MyApp ---
Building EJB MyApp-1.0-SNAPSHOT with EJB version 3.1
Building jar: C:\Users\user\Documents\NetBeansProjects\MyApp\target\MyApp-1.0-SNAPSHOT.jar
------------------------------------------------------------------------
BUILD SUCCESS
------------------------------------------------------------------------
Total time: 46.828 s
Finished at: 2014-05-09T04:05:49-08:00
Final Memory: 8M/21M
------------------------------------------------------------------------
NetBeans: Deploying on GlassFish Server 4
profile mode: false
debug mode: false
force redeploy: true
In-place deployment at C:\Users\user\Documents\NetBeansProjects\MyApp\target\classes
GlassFish Server 4, deploy, null, false
2) ON MY GLASS FISH SERVER I GOT THIS ERROR REPORT
SEVERE: Exception while invoking class org.glassfish.persistence.jpa.JPADeployer prepare method
SEVERE: Exception while preparing the app
SEVERE: Exception during lifecycle processing
java.lang.RuntimeException: Invalid resource : jdbc/zoodatabase__pm
at com.sun.enterprise.connectors.ConnectorRuntime.lookupDataSourceInDAS(ConnectorRuntime.java:593)
at com.sun.enterprise.connectors.ConnectorRuntime.lookupPMResource(ConnectorRuntime.java:517)
at org.glassfish.persistence.common.PersistenceHelper.lookupPMResource(PersistenceHelper.java:63)
atorg.glassfish.persistence.jpa.ProviderContainerContractInfoBase.lookupDataSource(ProviderContainerContractInfoBase.java:71)
at org.glassfish.persistence.jpa.PersistenceUnitInfoImpl.<init>(PersistenceUnitInfoImpl.java:108)
at org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(PersistenceUnitLoader.java:142)
at org.glassfish.persistence.jpa.PersistenceUnitLoader.<init>(PersistenceUnitLoader.java:107)
at org.glassfish.persistence.jpa.JPADeployer$1.visitPUD(JPADeployer.java:223)
atorg.glassfish.persistence.jpa.JPADeployer$PersistenceUnitDescriptorIterator.iteratePUDs(JPADeployer.java:510)
SEVERE: java.lang.RuntimeException: Invalid resource : jdbc/zoodatabase__pm
MG>Glassfish cannot find the JNDI resource identified by jdbc/zoodatabase___pm
MG>Here is a complete example of configuring a JDBC reference via GF Persistence Unit
MG>
https://glassfish.java.net/javaee5/persistence/persistence-example.html
MG>when your app makes a JNDI reference do NOT change the JNDI reference name
MG>specifically
MG>jdbc/zoodatabase != jdbc/zoodatabase__pm
Atcom.sun.enterprise.connectors.ConnectorRuntime.lookupDataSourceInDAS(ConnectorRuntime.java:593)
Atcom.sun.enterprise.connectors.ConnectorRuntime.lookupPMResource(ConnectorRuntime.java:517)
atorg.glassfish.persistence.common.PersistenceHelper.lookupPMResource(PersistenceHelper.java:63)
atorg.glassfish.persistence.jpa.ProviderContainerContractInfoBase.lookupDataSource(ProviderContainerContractInfoBase.java:71)
at org.glassfish.persistence.jpa.PersistenceUnitInfoImpl.<init>(PersistenceUnitInfoImpl.java:108)
at org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(PersistenceUnitLoader.java:142)
at org.glassfish.persistence.jpa.PersistenceUnitLoader.<init>(PersistenceUnitLoader.java:107)
Caused by: com.sun.appserv.connectors.internal.api.ConnectorRuntimeException: Invalid resource : jdbc/zoodatabase__pm
SEVERE: Exception while preparing the app : Invalid resource : jdbc/zoodatabase__pm
com.sun.appserv.connectors.internal.api.ConnectorRuntimeException: Invalid resource : jdbc/zoodatabase__pm
at org.glassfish.jdbcruntime.service.JdbcDataSource.validateResource(JdbcDataSource.java:81)
at org.glassfish.jdbcruntime.service.JdbcDataSource.setResourceInfo(JdbcDataSource.java:62)
atorg.glassfish.jdbcruntime.JdbcRuntimeExtension.lookupDataSourceInDAS(JdbcRuntimeExtension.java:136)
atcom.sun.enterprise.connectors.ConnectorRuntime.lookupDataSourceInDAS(ConnectorRuntime.java:589)
at com.sun.enterprise.connectors.ConnectorRuntime.lookupPMResource(ConnectorRuntime.java:517)
at org.glassfish.persistence.common.PersistenceHelper.lookupPMResource(PersistenceHelper.java:63)
INFO: visiting unvisited references
INFO: visiting unvisited references
SEVERE: Exception while invoking class org.glassfish.persistence.jpa.JPADeployer prepare method
SEVERE: java.lang.RuntimeException: Invalid resource : jdbc/zoodatabase__pm
Atcom.sun.enterprise.connectors.ConnectorRuntime.lookupDataSourceInDAS(ConnectorRuntime.java:593)
at com.sun.enterprise.connectors.ConnectorRuntime.lookupPMResource(ConnectorRuntime.java:517)
at org.glassfish.persistence.common.PersistenceHelper.lookupPMResource(PersistenceHelper.java:63)
atorg.glassfish.persistence.jpa.ProviderContainerContractInfoBase.lookupDataSource(ProviderContainerContractInfoBase.java:71)
at org.glassfish.persistence.jpa.PersistenceUnitInfoImpl.<init>(PersistenceUnitInfoImpl.java:108)
at org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(PersistenceUnitLoader.java:142)
at org.glassfish.persistence.jpa.PersistenceUnitLoader.<init>(PersistenceUnitLoader.java:107
SEVERE: Exception while preparing the app
SEVERE: Exception during lifecycle processing
java.lang.RuntimeException: Invalid resource : jdbc/zoodatabase__pm
atcom.sun.enterprise.connectors.ConnectorRuntime.lookupDataSourceInDAS(ConnectorRuntime.java:593)
at com.sun.enterprise.connectors.ConnectorRuntime.lookupPMResource(ConnectorRuntime.java:517)
at org.glassfish.persistence.common.PersistenceHelper.lookupPMResource(PersistenceHelper.java:63)
atorg.glassfish.persistence.jpa.ProviderContainerContractInfoBase.lookupDataSource(ProviderContainerContractInfoBase.java:71)
SEVERE: Exception while preparing the app : Invalid resource : jdbc/zoodatabase__pm
com.sun.appserv.connectors.internal.api.ConnectorRuntimeException: Invalid resource : jdbc/zoodatabase__pm
at org.glassfish.jdbcruntime.service.JdbcDataSource.validateResource(JdbcDataSource.java:81)
at org.glassfish.jdbcruntime.service.JdbcDataSource.setResourceInfo(JdbcDataSource.java:62)
atorg.glassfish.jdbcruntime.JdbcRuntimeExtension.lookupDataSourceInDAS(JdbcRuntimeExtension.java:136)
atcom.sun.enterprise.connectors.ConnectorRuntime.lookupDataSourceInDAS(ConnectorRuntime.java:589)at com.sun.enterprise.connectors.ConnectorRuntime.lookupPMResource(ConnectorRuntime.java:517)
I would be grateful if someone can proffer solutions to the above challenge and at the same time educate me on how to create data source on Glass Fish Server manually using admin console.
Best regards!