2

我有一个带有 eclipselink 和 mongodb 的 jee6 应用程序。我使用 nosql 扩展 org.eclipse.persistence.nosql

当我在本地 glassfish 实例上部署我的应用程序时,一切正常。

当我在远程 glassfish 上部署应用程序时,出现以下错误

glassfish 版本在两个位置都相同 mongodb 驱动程序 jar 在 WEB-INF/lib 中

但是在远程服务器上我得到了一个"java.lang.NoClassDefFoundError: com/mongodb/ServerAddress"

问题出在哪里 ???

[#|2012-12-03T19:19:36.281+0000|CONFIG|glassfish3.1.2|org.eclipse.persistence.session.file:/usr/glassfish3/glassfish3/glassfish/domains/domain1/applications/ForecastWebApp-0.0.1-SNAPSHOT/WEB-INF/classes/_forecastMongoDB.connection|_ThreadID=1306;_ThreadName=Thread-2;|connecting(EISLogin(
        platform=> MongoPlatform
        user name=> ""
        MongoConnectionSpec()
))|#]

[#|2012-12-03T19:19:36.288+0000|SEVERE|glassfish3.1.2|org.eclipse.persistence.session.file:/usr/glassfish3/glassfish3/glassfish/domains/domain1/applications/ForecastWebApp-0.0.1-SNAPSHOT/WEB-INF/classes/_forecastMongoDB.ejb|_ThreadID=1306;_ThreadName=Thread-2;|java.lang.NoClassDefFoundError: com/mongodb/ServerAddress
        at org.eclipse.persistence.internal.nosql.adapters.mongo.MongoConnectionFactory.getConnection(MongoConnectionFactory.java:74)
        at org.eclipse.persistence.eis.EISConnectionSpec.connectToDataSource(EISConnectionSpec.java:150)
        at org.eclipse.persistence.nosql.adapters.mongo.MongoConnectionSpec.connectToDataSource(MongoConnectionSpec.java:150)
        at org.eclipse.persistence.eis.EISLogin.connectToDatasource(EISLogin.java:73)
        at org.eclipse.persistence.internal.databaseaccess.DatasourceAccessor.connectInternal(DatasourceAccessor.java:330)
        at org.eclipse.persistence.internal.databaseaccess.DatasourceAccessor.connect(DatasourceAccessor.java:418)
        at org.eclipse.persistence.sessions.server.ConnectionPool.buildConnection(ConnectionPool.java:216)
        at org.eclipse.persistence.sessions.server.ConnectionPool.startUp(ConnectionPool.java:504)
        at org.eclipse.persistence.sessions.server.ServerSession.connect(ServerSession.java:484)
        at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.login(DatabaseSessionImpl.java:734)
        at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:217)
        at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:542)
        at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:186)
        at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:278)
        at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:304)
        at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:282)
        at org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(PersistenceUnitLoader.java:211)
        at org.glassfish.persistence.jpa.PersistenceUnitLoader.<init>(PersistenceUnitLoader.java:120)
4

1 回答 1

2

好的,我发现了问题

org.eclipse.persistence.nosql_2.4.1.v20121003-ad44345.jar 和 mongodb 驱动程序 jar 在 /WEB-INF/lib

但在远程服务器 org.eclipse.persistence.nosql_2.4.1.v20121003-ad44345.jar 上,../glassfish/modules directory 但这里没有 mongodb 驱动程序

当我org.eclipse.persistence.nosql_2.4.1.v20121003-ad44345.jar../glassfish/modules directory

或者

添加mongodb驱动jar到../glassfish/modules directory

一切正常

于 2012-12-04T09:22:20.360 回答