2015-10-19 81 views
0

我有一個小的JavaEE JSF應用程序,通過持久性JPA訪問MySQL數據庫,它在我的NetBeans和Glassfish環境中工作良好。事情是,克隆在具有相同配置的其他機器(netbeans,glasfish,相同的數據庫)後,它不會運行。我想這是由數據庫配置引起的,但我試圖在新機器上配置它,這是無望的。它總是給了同樣的錯誤:com.sun.appserv.connectors.internal.api.ConnectorRuntimeException:無效的資源:javaee__pm

GlassFish Server 4.1, deploy, null, false 
/home/alvarob/NetBeansProjects/WordPracticeJavaEE/nbproject/build-impl.xml:1032: The module has not been deployed. 
See the server log for details. 
BUILD FAILED (total time: 0 seconds) 

而且這是在GlassFish日誌的一部分:

[2015-10-19T14:47:13.556+0300] [glassfish 4.1] [SEVERE] [] [javax.enterprise.system.core] [tid: _ThreadID=44 _ThreadName=admin-listener(4)] [timeMillis: 1445255233556] [levelValue: 1000] [[ 
    Exception while preparing the app : Invalid resource : javaee__pm 
    com.sun.appserv.connectors.internal.api.ConnectorRuntimeException: Invalid resource : javaee__pm 
    at org.glassfish.jdbcruntime.service.JdbcDataSource.validateResource(JdbcDataSource.java:81) 
    at org.glassfish.jdbcruntime.service.JdbcDataSource.setResourceInfo(JdbcDataSource.java:62) 
    at org.glassfish.jdbcruntime.JdbcRuntimeExtension.lookupDataSourceInDAS(JdbcRuntimeExtension.java:136) 
    at com.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) 
    at org.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) 
    at org.glassfish.persistence.jpa.JPADeployer$PersistenceUnitDescriptorIterator.iteratePUDs(JPADeployer.java:510) 
    at org.glassfish.persistence.jpa.JPADeployer.createEMFs(JPADeployer.java:230) 
    at org.glassfish.persistence.jpa.JPADeployer.prepare(JPADeployer.java:168) 
... *it continues* 

,這是我的.gitignore(也許我錯過了一些重要的文件?)

nbproject/private/ 
build/ 
nbbuild/ 
dist/ 
nbdist/ 
nbactions.xml 
nb-configuration.xml 
.nb-gradle/ 

*.class 

.mtj.tmp/ 

*.janr 
*.war 
*.ear 
+0

@BalusC你爲什麼要修改我的標題?我總是看到標題是關於一個問題的問題或摘要。相反,修改我的標題可以幫助我解決問題本身嗎? – ABR

+0

你有個例外。這是問題。我只是把具體問題放在標題中。在例外的情況下,程序員通常會針對異常+消息來尋找答案/線索。讓他們擁有標題可以讓他們更容易地找到他們(也爲你...) – BalusC

+0

好吧,我沒意識到這是走標題的路,每天我都會學到新的東西。謝謝。 – ABR

回答

0

我終於通過在目標機器上創建一個JDBC池和JSBC資源來完成它的解決方案,它的命名和配置與我的電腦完全相同。