Servlet类不是javax.servlet.Servlet [英] Servlet class is not a javax.servlet.Servlet

查看:198
本文介绍了Servlet类不是javax.servlet.Servlet的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个GWT应用程序,但是当我将它部署到Equinox-jetty服务器时,我得到了以下异常:

I am developing a GWT application, but I got the following Exception when I deploy it into a Equinox-jetty server:

404 Servlet class com.cartif.gui.autentication.server.AppServiceImpl is not a javax.servlet.Servlet <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>Error 404 Servlet class com.cartif.gui.autentication.server.AppServiceImpl is not a javax.servlet.Servlet</title>
</head>
<body><h2>HTTP ERROR 404</h2>
    <p>Problem accessing /baasGUIAutentication/baasgui/autentication. Reason:
    <pre>    
    Servlet class com.cartif.gui.autentication.server.AppServiceImpl is not a javax.servlet.Servlet</pre></p><h3>Caused by:</h3><pre>javax.servlet.UnavailableException: Servlet class com.cartif.gui.autentication.server.AppServiceImpl is not a javax.servlet.Servlet
         at org.mortbay.jetty.servlet.ServletHolder.checkServletType(ServletHolder.java:362)
         at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:243)
         at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
         at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:685)
         at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
         at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
         at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
         at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467)
         at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
         at org.springframework.osgi.web.deployer.jetty.JettyWarDeployer.startWebAppContext(JettyWarDeployer.java:210)
         at org.springframework.osgi.web.deployer.jetty.JettyWarDeployer.startDeployment(JettyWarDeployer.java:122)
         at org.springframework.osgi.web.deployer.support.AbstractWarDeployer.deploy(AbstractWarDeployer.java:93)
         at org.springframework.osgi.web.extender.internal.activator.WarLoaderListener$DeploymentManager$DeployTask.doRun(WarLoaderListener.java:257)
         at org.springframework.osgi.web.extender.internal.activator.WarLoaderListener$DeploymentManager$BaseTask.run(WarLoaderListener.java:215)
         at org.springframework.scheduling.timer.DelegatingTimerTask.run(DelegatingTimerTask.java:66)
         at java.util.TimerThread.mainLoop(Unknown Source)
         at java.util.TimerThread.run(Unknown Source)

    </pre>
<hr /><i><small>Powered by Jetty://</small></i><br/> 

AppServiceImpl类的代码头是:

The code header for the AppServiceImpl class is:

public class AppServiceImpl extends RemoteServiceServlet implements AppService  

和AppService服务:

And AppService:

@RemoteServiceRelativePath("autentication")
public interface AppService extends RemoteService {
    User getUser(String user, String pass) throws Exception;
}

此外,web.xml声明如下servlet:

Moreover, the web.xml declares the servlet as follows:

<servlet>
    <servlet-name>baasguiServlet</servlet-name>
    <servlet-class>com.cartif.gui.autentication.server.AppServiceImpl</servlet-class>
</servlet>

<servlet-mapping>
    <servlet-name>baasguiServlet</servlet-name>
    <url-pattern>/baasgui/autentication</url-pattern>
</servlet-mapping>

而baasgui是编译GWT Java代码的文件夹。

And baasgui is the folder where the GWT Java code is compiled. I have also checked the javax.servlet class and it is used only once.

任何人都可以帮助我吗?

Could anyone help me??

非常感谢你提前!
Jose

Thank you very much in advance!! Jose

推荐答案

我得到了解决方案。在GWT库包中,我不得不添加以下几行:

I got the solution. In the GWT libraries bundle I had to add the following lines:

Bundle-SymbolicName: gwtlibraries; singleton:=true
Require-Bundle: javax.servlet

代替导入包,标签Require-Bundle和单身包的一部分。另外在GUI清单中,我必须添加下一行:

Instead of importing packages, the tag Require-Bundle and the part of singleton bundle. Also in the GUI manifest I had to add the next line:

Bundle-SymbolicName: GUI; singleton:=true
Require-Bundle: gwtlibraries //apart from importing the specific libraries
Eclipse-RegisterBuddy: com.cartif.gwt
Eclipse-BuddyPolicy: registered

这并没有发生在我已经部署的以前版本的GWT库中,但是bundle结构不同,因为现在我正在使用解压后的库和之前的压缩过的jar文件。

This was not happening with the previous versions of the GWT libraries I had deployed, but the bundle structure was different because now I am using the unzipped libraries and in previous ones the zipped jar files.

感谢您的协作和帮助!!!!

Thank you for your collaboration and help!!!!

这篇关于Servlet类不是javax.servlet.Servlet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆