gpt4 book ai didi

java - 在 GlassFish v3.1 上启动过滤器 MyFilter 时出现 InstantiationException

转载 作者:行者123 更新时间:2023-12-02 08:16:02 29 4
gpt4 key购买 nike

我正在尝试在 glassfish 上部署由模块 ejb 和 war 组成的 EAR 应用程序。应用程序已部署,但连接到我的 Web 模块中的过滤器时出现异常。每次服务器尝试启动过滤器时都会抛出它。

但是为什么呢?我看不出任何明显的原因!任何帮助将不胜感激。

添加信息:我使用maven编译和部署

过滤器类和映射:

public class FrontControllerFilter implements Filter {


@Override
public void init(FilterConfig fc) throws ServletException {
}

@Override
public void doFilter(ServletRequest request,
ServletResponse response,
FilterChain filterChain)
throws IOException, ServletException {
// Přetypujeme na HTTP objekty
HttpServletRequest httpRequest = (HttpServletRequest) request;
HttpServletResponse httpResponse = (HttpServletResponse) response;
//some code
}
//some code
}

<filter>
<filter-name>FrontControllerFilter</filter-name>
<filter-class>com.myapp.controller.FrontControllerFilter</filter-class>
</filter>

<filter-mapping>
<filter-name>FrontControllerFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

异常跟踪:

[#|2011-06-21T12:25:18.545+0200|SEVERE|glassfish3.1|javax.enterprise.system.cont
ainer.web.com.sun.enterprise.web|_ThreadID=100;_ThreadName=admin-thread-pool-484
8(2);|WebModule[/web]PWC1270: Exception starting filter FrontControllerFilter
java.lang.InstantiationException
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFi
lterConfig.java:124)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.
java:4625)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:5
316)
at com.sun.enterprise.web.WebModule.start(WebModule.java:500)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
.java:917)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:90
1)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:755)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1
980)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1
630)
at com.sun.enterprise.web.WebApplication.start(WebApplication.java:100)
at org.glassfish.internal.data.EngineRef.start(EngineRef.java:130)
at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:269)
at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.jav
a:286)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationL
ifecycle.java:461)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationL
ifecycle.java:240)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.ja
va:370)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunner
Impl.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunner
Impl.java:370)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunner
Impl.java:1067)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunn
erImpl.java:96)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execut
e(CommandRunnerImpl.java:1247)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execut
e(CommandRunnerImpl.java:1235)
at org.glassfish.deployment.admin.ReDeployCommand.execute(ReDeployComman
d.java:126)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunner
Impl.java:355)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunner
Impl.java:370)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunner
Impl.java:1067)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunn
erImpl.java:96)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execut
e(CommandRunnerImpl.java:1247)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execut
e(CommandRunnerImpl.java:1235)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:
465)
at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:22
2)
at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java
:168)
at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java
:117)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(Container
Mapper.java:234)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:8
22)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:719)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1013)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFil
ter.java:225)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultPro
tocolChain.java:137)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.jav
a:104)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.jav
a:90)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java
:79)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextT
ask.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(AbstractThreadP
ool.java:532)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool
.java:513)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassNotFoundException: cz.pavel.javaee.webmail.controller.
FrontControllerFilter
at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoade
r.java:1518)
at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoade
r.java:1368)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(Applicatio
nFilterConfig.java:252)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFi
lterConfig.java:120)
... 47 more
|#]

最佳答案

Caused by: java.lang.ClassNotFoundException: cz.pavel.javaee.webmail.controller. FrontControllerFilter

您的过滤器可能不在类路径上(或其名称错误)。

关于java - 在 GlassFish v3.1 上启动过滤器 MyFilter 时出现 InstantiationException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6424217/

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