开发者

InstantiationException while starting filter MyFilter on GlassFish v3.1

开发者 https://www.devze.com 2023-03-14 19:49 出处:网络
I\'m trying to deploy my EAR app consisting of modules ejb and war on the glassfish. App is deployed, but there is an exception connected to Filter I has in my web module. It\'sthrown everytime the se

I'm trying to deploy my EAR app consisting of modules ejb and war on the glassfish. App is deployed, but there is an exception connected to Filter I has in my web module. It's thrown everytime the server is trying to initiate the filter.

But why? I cannot see any obvious reason for that! Any help would be much appreciated.

add info: i compile and deploy with maven

Filter class and mapping:

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>

Exception trace:

[#|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.AbstractThreadPoo开发者_Python百科l$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

Your filter is likely not on the classpath (or its name is wrong).


It can be because of a wrong import for the Filter interface. Be sure that you have used below import class

import javax.servlet.Filter

not any other Filter class. There many other filter classes that when you use them do not encounter an error in compile time.

0

精彩评论

暂无评论...
验证码 换一张
取 消