使用 EJB 注入的 Wicket (9.8.0) 应用程序在 Payara 5.201 上部署时抛出异常

Wicket (9.8.0) application using EJB injection throws exception while deploying on Payara 5.201

我正在尝试将 WicketTester 用于包含 EJB 注入相关代码的应用程序。

我使用 'wicket.apache.org/start/quickstart.html' 创建了应用程序,并将其部署在 Payara 服务器“5.201”上。

部署成功,我可以在网络浏览器上看到该页面。

为页面编写的测试也已成功执行。

完成后,我在 POM.xml

中添加了以下依赖项
<dependency>
        <groupId>jakarta.platform</groupId>
        <artifactId>jakarta.jakartaee-api</artifactId>
        <version>${jakartaee}</version>
        <scope>provided</scope>
</dependency>
<dependency>
        <groupId>org.wicketstuff</groupId>
        <artifactId>wicketstuff-javaee-inject</artifactId>
        <version>${wicket.version}</version>
        <scope>provided</scope>
</dependency>

我在pom文件中设置属性如下

<properties>
    <wicket.version>9.8.0</wicket.version>
    <jakartaee>8.0.0</jakartaee>
</properties>

在 class extending 'WebApplication' 我添加了以下 import

import org.wicketstuff.javaee.injection.JavaEEComponentInjector;

并在覆盖的 'init' 方法中添加以下语句

getComponentInstantiationListeners().add(new JavaEEComponentInjector(this));

可以在 'https://github.com/rjngshn/WicketTesterEJB' 找到完整的项目。 在添加任何无状态 bean 之前,我想确保我的应用程序仍能正确部署。 但是我注意到它没有。记录了以下异常。 有人可以帮忙吗?

java.lang.NoClassDefFoundError: org/wicketstuff/javaee/injection/JavaEEComponentInjector
at uk.ac.ox.ndph.ckb.RTApplication.init(RTApplication.java:37)
at org.apache.wicket.Application.initApplication(Application.java:766)
at org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:441)
at org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:365)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:273)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:124)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:5101)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:5747)
at com.sun.enterprise.web.WebModule.start(WebModule.java:619)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:958)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:941)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:694)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1877)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1608)
at com.sun.enterprise.web.WebApplication.start(WebApplication.java:108)
at org.glassfish.internal.data.EngineRef.start(EngineRef.java:123)
at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:283)
at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:362)
at com.sun.enterprise.v3.server.ApplicationLifecycle.initialize(ApplicationLifecycle.java:621)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:565)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.run(CommandRunnerImpl.java:558)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.run(CommandRunnerImpl.java:554)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/javax.security.auth.Subject.doAs(Subject.java:361)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.execute(CommandRunnerImpl.java:553)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.run(CommandRunnerImpl.java:584)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.run(CommandRunnerImpl.java:576)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/javax.security.auth.Subject.doAs(Subject.java:361)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:575)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1496)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access00(CommandRunnerImpl.java:120)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1878)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1754)
at org.glassfish.deployment.admin.ReDeployCommand.execute(ReDeployCommand.java:129)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.run(CommandRunnerImpl.java:558)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.run(CommandRunnerImpl.java:554)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/javax.security.auth.Subject.doAs(Subject.java:361)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.execute(CommandRunnerImpl.java:553)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.run(CommandRunnerImpl.java:584)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.run(CommandRunnerImpl.java:576)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/javax.security.auth.Subject.doAs(Subject.java:361)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:575)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1496)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access00(CommandRunnerImpl.java:120)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1878)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1754)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:564)
at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:251)
at org.glassfish.grizzly.http.server.StaticHttpHandlerBase.service(StaticHttpHandlerBase.java:166)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:520)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:217)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:182)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:156)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:218)
at org.glassfish.grizzly.filterchain.ExecutorResolver.execute(ExecutorResolver.java:95)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:260)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:177)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:109)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:88)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:53)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:524)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:89)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:94)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access0(WorkerThreadIOStrategy.java:33)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:114)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:569)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:549)

原因:java.lang.ClassNotFoundException:org.wicketstuff.javaee.injection.JavaEEComponentInjector

at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1742)
at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1583)
... 71 more

我怀疑 Payara 服务器是否提供了 wicketstuff 人工制品。

更改你的编译依赖:

<dependency>
    <groupId>org.wicketstuff</groupId>
    <artifactId>wicketstuff-javaee-inject</artifactId>
    <version>${wicket.version}</version>
    <scope>compile</scope>
</dependency>