0

我正在使用 glassfish 3.1.2.2 服务器和 idea 终极版 11(在 Ubuntu 12.04 上)。当我部署我的耳朵项目时,有一个例外,首先是空指针,然后是 nosuchmethod。在 glassfish 3.0.1 上它可以工作,但在 3.1.2 中不能。

服务器日志:

[#|2012-09-25T15:54:14.356+0300|WARNING|glassfish3.1.2|javax.enterprise.system.tools.deployment.org.glassfish.deployment.common|_ThreadID=45;_ThreadName=Thread-2;|DPL8027: Ignore WEB-INF/sun-web.xml in archive /home/kelevra/glassfish3/glassfish/domains/domain1/applications/MO-1.0.1-alpha1-SNAPSHOT/ViewController-1.0.1-alpha1-SNAPSHOT_war/, as GlassFish counterpart runtime xml WEB-INF/glassfish-web.xml is present in the same archive.|#]

[#|2012-09-25T15:54:14.565+0300|WARNING|glassfish3.1.2|javax.enterprise.resource.resourceadapter.com.sun.enterprise.connectors.util|_ThreadID=45;_ThreadName=Thread-2;|RAR8068: Using default datasource : __ds_jdbc_ra for pool : eFarmer-Pool|#]

[#|2012-09-25T15:54:14.591+0300|SEVERE|glassfish3.1.2|javax.enterprise.system.tools.deployment.org.glassfish.deployment.common|_ThreadID=78;_ThreadName=Thread-2;|Exception while visiting com/sun/gjc/util/SQLTraceTimerTask.class of size 570
java.lang.NullPointerException
    at org.glassfish.hk2.classmodel.reflect.impl.TypesImpl.getType(TypesImpl.java:78)
    at org.glassfish.hk2.classmodel.reflect.impl.ModelClassVisitor.visit(ModelClassVisitor.java:119)
    at org.objectweb.asm.ClassReader.accept(Unknown Source)
    at org.objectweb.asm.ClassReader.accept(Unknown Source)
    at org.glassfish.hk2.classmodel.reflect.Parser$5.on(Parser.java:363)
    at org.glassfish.hk2.classmodel.reflect.util.JarArchive.onSelectedEntries(JarArchive.java:125)
    at org.glassfish.hk2.classmodel.reflect.Parser.doJob(Parser.java:348)
    at org.glassfish.hk2.classmodel.reflect.Parser.access$300(Parser.java:70)
    at org.glassfish.hk2.classmodel.reflect.Parser$3.call(Parser.java:307)
    at org.glassfish.hk2.classmodel.reflect.Parser$3.call(Parser.java:296)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)
|#]

[#|2012-09-25T15:54:14.965+0300|WARNING|glassfish3.1.2|javax.enterprise.resource.resourceadapter.com.sun.enterprise.connectors.util|_ThreadID=45;_ThreadName=Thread-2;|RAR8068: Using default datasource : __ds_jdbc_ra for pool : eFarmer-Pool|#]

[#|2012-09-25T15:54:17.224+0300|WARNING|glassfish3.1.2|org.eclipse.persistence.session.file:/home/kelevra/glassfish3/glassfish/domains/domain1/applications/MO-1.0.1-alpha1-SNAPSHOT/DataModel-1.0.1-alpha1-SNAPSHOT_jar/_eFarmer.weaver|_ThreadID=45;_ThreadName=Thread-2;|Weaver encountered an exception while trying to weave class com/km/orgfrm/datamodel/entity/AbstractEntity.  The exception was: java.lang.RuntimeException: java.lang.ClassNotFoundException: com.km.orgfrm.datamodel.entity.AbstractEntity not found by org.eclipse.persistence.asm [232]|#]

java.lang.NoSuchMethodError: com.km.orgfrm.datamodel.entity.AbstractEntity.<init>(Lorg/eclipse/persistence/internal/descriptors/PersistenceObject;)V
    at com.km.efarmer.datamodel.entity.order.operation.OperationTrackGeometryEntity.<init>(OperationTrackGeometryEntity.java)
    at com.km.efarmer.datamodel.entity.order.operation.OperationTrackGeometryEntity._persistence_new(OperationTrackGeometryEntity.java)
    at org.eclipse.persistence.internal.descriptors.PersistenceObjectInstantiationPolicy.buildNewInstance(PersistenceObjectInstantiationPolicy.java:30)
    at org.eclipse.persistence.descriptors.ClassDescriptor.selfValidationAfterInitialization(ClassDescriptor.java:3870)
    at org.eclipse.persistence.descriptors.ClassDescriptor.validateAfterInitialization(ClassDescriptor.java:5688)
    at org.eclipse.persistence.descriptors.ClassDescriptor.postInitialize(ClassDescriptor.java:3547)
    at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:526)
    at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:476)
    at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:435)
    at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.postConnectDatasource(DatabaseSessionImpl.java:676)
    at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.login(DatabaseSessionImpl.java:634)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:208)
    at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:488)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:188)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:277)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:294)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:272)
    at org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(PersistenceUnitLoader.java:211)
    at org.glassfish.persistence.jpa.PersistenceUnitLoader.<init>(PersistenceUnitLoader.java:120)
    at org.glassfish.persistence.jpa.JPADeployer$1.visitPUD(JPADeployer.java:224)
    at org.glassfish.persistence.jpa.JPADeployer$PersistenceUnitDescriptorIterator.iteratePUDs(JPADeployer.java:495)
    at org.glassfish.persistence.jpa.JPADeployer.createEMFs(JPADeployer.java:233)
    at org.glassfish.persistence.jpa.JPADeployer.prepare(JPADeployer.java:168)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:871)
    at org.glassfish.javaee.full.deployment.EarDeployer.prepareBundle(EarDeployer.java:290)
    at org.glassfish.javaee.full.deployment.EarDeployer.access$200(EarDeployer.java:86)
    at org.glassfish.javaee.full.deployment.EarDeployer$1.doBundle(EarDeployer.java:141)
    at org.glassfish.javaee.full.deployment.EarDeployer$1.doBundle(EarDeployer.java:138)
    at org.glassfish.javaee.full.deployment.EarDeployer.doOnBundles(EarDeployer.java:215)
    at org.glassfish.javaee.full.deployment.EarDeployer.doOnAllTypedBundles(EarDeployer.java:224)
    at org.glassfish.javaee.full.deployment.EarDeployer.doOnAllBundles(EarDeployer.java:250)
    at org.glassfish.javaee.full.deployment.EarDeployer.prepare(EarDeployer.java:138)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:871)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:410)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
    at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:389)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:348)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:363)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1085)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:95)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1291)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1259)
    at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:461)
    at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:212)
    at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:179)
    at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
    at com.sun.enterprise.v3.services.impl.ContainerMapper$Hk2DispatcherCallable.call(ContainerMapper.java:354)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
    at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
    at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
    at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
    at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
    at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
    at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
    at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
    at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
    at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
    at java.lang.Thread.run(Thread.java:722)
|#]

[#|2012-09-25T15:54:18.366+0300|SEVERE|glassfish3.1.2|javax.enterprise.system.tools.admin.org.glassfish.deployment.admin|_ThreadID=45;_ThreadName=Thread-2;|Exception while preparing the app : com.km.orgfrm.datamodel.entity.AbstractEntity.<init>(Lorg/eclipse/persistence/internal/descriptors/PersistenceObject;)V|#]
4

1 回答 1

4

这种类型的错误通常是由于类路径中有同一个库的两个不同版本。

请检查新版本的 glassfish 是否没有包含您的应用程序正在使用和部署的库之一的标准版本。作为犯罪现场的第一人 :),应用程序服务器将加载第一个类(标准类),这与您的应用程序想要使用的不同。

强制使用不同的类加载器可以解决这类问题。但是,我没有使用 Glassfish 的经验,但在 Weblogic 上遇到过类似的问题。

于 2012-09-25T13:03:37.347 回答