gpt4 book ai didi

mongodb - java.lang.NoClassDefFoundError : com/mongodb/ServerAddress 错误

转载 作者:可可西里 更新时间:2023-11-01 10:33:53 26 4
gpt4 key购买 nike

我有一个带有 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)

最佳答案

好的,我找到问题了

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 目录中但是这里没有 mongodb 驱动程序

当我删除 org.eclipse.persistence.nosql_2.4.1.v20121003-ad44345.jar来自 ../glassfish/modules 目录

添加mongodb驱动jar到 ../glassfish/modules 目录

一切正常

关于mongodb - java.lang.NoClassDefFoundError : com/mongodb/ServerAddress 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13690453/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com