CDI(Weld)/ Seam 3持久性模块/ Glassfish 3 - 启动服务器时无法解释的异常

时间:2010-10-28 22:22:12

标签: glassfish-3 jboss-weld seam3

好的,所以我遇到一个异常,开始让我感到沮丧。让我设置场景。

我正在使用Weld,Jboss实施的CDI。 JPA / Hibernate用于持久化。对于不同的东西,我在Glassfish 3上给它一个裂缝,我以前没用过。我正在使用Maven进行依赖管理。

无论如何,由于CDI没有包含开箱即用的事务管理,我决定使用Seam 3 Persistence模块而不是自己编辑。现在,我很清楚,目前这只是在阿尔法,所以也许我在寻找麻烦,但请与我同行。我希望别人看到这个,可以帮我解决这个问题,或者至少让我知道为什么我会遇到问题。

因此,在添加持久性模块之前,所有内容都可以构建并运行良好。我可以打开应用程序的主页。但是,当我将Seam 3持久性模块添加到我的pom.xml时,应用程序在启动时会抛出异常。工作和不工作之间的唯一区别是我添加到pom.xml的一个依赖

我添加到pom.xml的依赖项是:

<dependency>
  <groupId>org.jboss.seam.persistence</groupId>
  <artifactId>seam-persistence-impl</artifactId>
  <version>3.0.0.Alpha1</version>
</dependency>

我根据http://seamframework.org/Seam3/PersistenceModule的说明添加了此依赖项。我知道当点击这个页面上的文档时,它提到了一些其他依赖项,但是在添加它们时我也遇到了同样的问题。这是我将问题缩小到的依赖关系。

因此,在添加上面的依赖项并启动服务器后,我在启动时得到以下内容:

INFO: Launching GlassFish on Felix platform
Welcome to Felix
================
INFO: Perform lazy SSL initialization for the listener 'http-listener-2'
INFO: Grizzly Framework 1.9.18-o started in: 113ms listening on port 8080
INFO: Grizzly Framework 1.9.18-o started in: 33ms listening on port 4848
INFO: Grizzly Framework 1.9.18-o started in: 76ms listening on port 8181
INFO: Starting Grizzly Framework 1.9.18-o - Thu Oct 28 23:06:04 BST 2010
INFO: Grizzly Framework 1.9.18-o started in: 10ms listening on port 3700
INFO: Starting Grizzly Framework 1.9.18-o - Thu Oct 28 23:06:04 BST 2010
INFO: Grizzly Framework 1.9.18-o started in: 7ms listening on port 7676
INFO: The Admin Console is already installed, but not yet loaded.
INFO: GlassFish Server Open Source Edition 3.0.1 (22) startup time : Felix(4429ms) startup services(1530ms) total(5959ms)
INFO: Hibernate Validator bean-validator-3.0-JBoss-4.0.2
INFO: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
INFO: Grizzly Framework 1.9.18-o started in: 16ms listening on port 8080
INFO: Binding RMI port to *:8686
INFO: JMXStartupService: Started JMXConnector, JMXService URL = service:jmx:rmi://192.168.1.73:8686/jndi/rmi://192.168.1.73:8686/jmxrmi
INFO: Using com.sun.enterprise.transaction.jts.JavaEETransactionManagerJTSDelegate as the delegate
INFO: [Thread[GlassFish Kernel Main Thread,5,main]] started
INFO: {felix.fileinstall.poll (ms) = 5000, felix.fileinstall.dir = /Applications/NetBeans/glassfish-3.0.1/glassfish/domains/domain1/autodeploy/bundles, felix.fileinstall.debug = 1, felix.fileinstall.bundles.new.start = true, felix.fileinstall.tmpdir = /var/folders/Q0/Q00qqJF1Gi8VesnYN54iM++++TI/-Tmp-/fileinstall-2957414086269585283, felix.fileinstall.filter = null}
INFO: {felix.fileinstall.poll (ms) = 5000, felix.fileinstall.dir = /Applications/NetBeans/glassfish-3.0.1/glassfish/modules/autostart, felix.fileinstall.debug = 1, felix.fileinstall.bundles.new.start = true, felix.fileinstall.tmpdir = /var/folders/Q0/Q00qqJF1Gi8VesnYN54iM++++TI/-Tmp-/fileinstall--8933010182761076907, felix.fileinstall.filter = null}
INFO: Started bundle: file:/Applications/NetBeans/glassfish-3.0.1/glassfish/modules/autostart/org.apache.felix.scr.jar
INFO: Started bundle: file:/Applications/NetBeans/glassfish-3.0.1/glassfish/modules/autostart/osgi-web-container.jar
INFO: SEC1002: Security Manager is OFF.
INFO: Security startup service called
INFO: SEC1143: Loading policy provider com.sun.enterprise.security.provider.PolicyWrapper.
INFO: Realm admin-realm of classtype com.sun.enterprise.security.auth.realm.file.FileRealm successfully created.
INFO: Realm file of classtype com.sun.enterprise.security.auth.realm.file.FileRealm successfully created.
INFO: Realm certificate of classtype com.sun.enterprise.security.auth.realm.certificate.CertificateRealm successfully created.
INFO: Security service(s) started successfully....
INFO: Created HTTP listener http-listener-1 on port 8080
INFO: Created HTTP listener http-listener-2 on port 8181
INFO: Created HTTP listener admin-listener on port 4848
INFO: Created virtual server server
INFO: Created virtual server __asadmin
INFO: Virtual server server loaded system default web module
INFO: Updating configuration from org.apache.felix.fileinstall-autodeploy-bundles.cfg
INFO: Installed /Applications/NetBeans/glassfish-3.0.1/glassfish/modules/autostart/org.apache.felix.fileinstall-autodeploy-bundles.cfg
INFO: {felix.fileinstall.poll (ms) = 5000, felix.fileinstall.dir = /Applications/NetBeans/glassfish-3.0.1/glassfish/domains/domain1/autodeploy/bundles, felix.fileinstall.debug = 1, felix.fileinstall.bundles.new.start = true, felix.fileinstall.tmpdir = /var/folders/Q0/Q00qqJF1Gi8VesnYN54iM++++TI/-Tmp-/fileinstall-9012588867170808207, felix.fileinstall.filter = null}
INFO: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
INFO: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
INFO: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
INFO: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
INFO: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
INFO: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
INFO: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
INFO: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
INFO: Portable JNDI names for EJB EjbSynchronizations : [java:global/com.coffeesnobs_web_war_1.0-SNAPSHOT/EjbSynchronizations, java:global/com.coffeesnobs_web_war_1.0-SNAPSHOT/EjbSynchronizations!org.jboss.seam.persistence.transaction.LocalEjbSynchronizations]
INFO: WELD-000900 1.0.1 (SP3)
INFO: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
SEVERE: Exception while loading the app
org.glassfish.deployment.common.DeploymentException: Exception #0 :null
        at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:167)
        at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:125)
        at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:224)
        at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:338)
        at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:183)
        at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:272)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:305)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:320)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1176)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$900(CommandRunnerImpl.java:83)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1235)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1224)
        at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:365)
        at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:204)
        at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:166)
        at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:100)
        at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:245)
        at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
        at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
        at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
        at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
        at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
        at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
        at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
        at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
        at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
        at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
        at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
        at java.lang.Thread.run(Thread.java:680)
Caused by: org.jboss.weld.exceptions.DefinitionException: Exception #0 :null
        at org.jboss.weld.bootstrap.events.AbstractDefinitionContainerEvent.fire(AbstractDefinitionContainerEvent.java:45)
        at org.jboss.weld.bootstrap.events.ProcessAnnotatedTypeImpl.fire(ProcessAnnotatedTypeImpl.java:44)
        at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:61)
        at org.jboss.weld.bootstrap.BeanDeployer.addClasses(BeanDeployer.java:88)
        at org.jboss.weld.bootstrap.BeanDeployment.deployBeans(BeanDeployment.java:134)
        at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:377)
        at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:165)
        ... 30 more

INFO: Perform lazy SSL initialization for the listener 'http-listener-2'
INFO: Created HTTP listener http-listener-2 on port 8181
INFO: Grizzly Framework 1.9.18-o started in: 14ms listening on port 8181

正如你所看到的,真的没什么可去的。

你以前见过这个例外吗?你知道是什么原因造成的吗?最后,你知道如何解决它吗?

提前致谢...

2 个答案:

答案 0 :(得分:1)

我也一直在看这个。我增加了对Glassfish的登录,发现了以下内容。

FINER: loadClass(org.jboss.logging.MessageLogger)
FINER:   Delegating to classloader1 org.glassfish.internal.api.DelegatingClassLoader@6f9240a4
FINER:   Searching local repositories
FINER:     findClass(org.jboss.logging.MessageLogger)
FINER:       findClassInternal(org.jboss.logging.MessageLogger)
FINER:     --> Passing on ClassNotFoundException
SEVERE: Exception while loading the app
org.glassfish.deployment.common.DeploymentException: Exception #0 :null
        at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:167)
        at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:125)
        at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:224)
        at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:338)
        at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:183)
        at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:272)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:305)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:320)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1176)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$900(CommandRunnerImpl.java:83)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1235)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1224)
        at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:365)
        at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:204)
        at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:166)
        at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:100)
        at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:245)
        at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
        at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
        at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
        at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
        at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
        at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
        at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
        at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
        at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
        at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
        at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
        at java.lang.Thread.run(Thread.java:637)
Caused by: org.jboss.weld.exceptions.DefinitionException: Exception #0 :null
        at org.jboss.weld.bootstrap.events.AbstractDefinitionContainerEvent.fire(AbstractDefinitionContainerEvent.java:45)
        at org.jboss.weld.bootstrap.events.ProcessAnnotatedTypeImpl.fire(ProcessAnnotatedTypeImpl.java:44)
        at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:61)
        at org.jboss.weld.bootstrap.BeanDeployer.addClasses(BeanDeployer.java:88)
        at org.jboss.weld.bootstrap.BeanDeployment.deployBeans(BeanDeployment.java:134)
        at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:377)
        at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:165)
        ... 30 more

It looks like there is a JBoss logging dependency problem. MessgeLogger is a new class in the jboss logging framework that the new Seam extensions appear to be using.

I added the following to my pom 

<dependency>
            <groupId>org.jboss.slf4j</groupId>
            <artifactId>slf4j-jboss-logging</artifactId>
            <version>1.0.2.GA</version>
        </dependency>
        <dependency>
            <groupId>org.jboss.logging</groupId>
            <artifactId>jboss-logging-log4j</artifactId>
            <version>2.1.0.GA</version>
        </dependency>
        <dependency>
            <groupId>org.jboss.logging</groupId>
            <artifactId>jboss-logging</artifactId>
            <version>3.0.0.Beta4</version>
        </dependency>

This seems to have fixed the missing class but now I get a NPE.

Caused by: java.lang.NullPointerException
        at org.apache.log4j.LogManager.getLogger(LogManager.java:188)
        at org.apache.log4j.Logger.getLogger(Logger.java:104)
        at org.jboss.logging.Log4jLogger.<init>(Log4jLogger.java:35)
        at org.jboss.logging.Log4jLoggerProvider.getLogger(Log4jLoggerProvider.java:33)
        at org.jboss.logging.Logger.getLogger(Logger.java:2164)
        at org.jboss.slf4j.JBossLoggerFactory.getLogger(JBossLoggerFactory.java:66)
        at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:246)
        at org.hibernate.search.util.LoggerFactory.make(LoggerFactory.java:38)
        at org.hibernate.search.store.FSDirectoryProvider.<clinit>(FSDirectoryProvider.java:55)

我认为这是Glassfish上的log4j配置问题。

答案 1 :(得分:0)

事实证明,这是我们使用的版本和技术组合的错误。我们现在正在使用Jboss 6的最终版本和Seam Persistence Module的beta版本,所有这些似乎都正常工作。