在karaf / servicemix中部署一个简单的.war文件时,出现以下错误。 请让我知道我是否缺少任何东西。

错误:

java.lang.ClassNotFoundException: app.web.servlet.ConnectServlet not found by JDBCWebDemo [207]
    at org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:787)[org.apache.felix.framework-3.0.9.jar:]
    at org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:71)[org.apache.felix.framework-3.0.9.jar:]
    at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1768)[org.apache.felix.framework-3.0.9.jar:]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)[:1.6.0_26]
    at org.apache.felix.framework.ModuleImpl.getClassByDelegation(ModuleImpl.java:645)[org.apache.felix.framework-3.0.9.jar:]
    at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1619)[org.apache.felix.framework-3.0.9.jar:]
    at org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:900)[org.apache.felix.framework-3.0.9.jar:]
    at org.ops4j.pax.swissbox.core.BundleClassLoader.findClass(BundleClassLoader.java:176)[122:org.ops4j.pax.web.pax-web-extender-war:1.0.7]
    at org.ops4j.pax.swissbox.core.BundleClassLoader.loadClass(BundleClassLoader.java:194)[122:org.ops4j.pax.web.pax-web-extender-war:1.0.7]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)[:1.6.0_26]
    at org.ops4j.pax.web.extender.war.internal.RegisterWebAppVisitorHS.newInstance(RegisterWebAppVisitorHS.java:221)[122:org.ops4j.pax.web.pax-web-extender-war:1.0.7]

代码如下:

的Manifest.MF:

Manifest-Version: 2 
Bundle-SymbolicName: JDBCWebDemo 
Bundle-Version: 2.3 
Bundle-ClassPath: WEB-INF/classes 
Import-Package: javax.servlet,javax.servlet.http 

web.xml中:

<web-app ...>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
  </welcome-file-list>
  <servlet>
    <description></description>
    <display-name>ConnectServlet</display-name>
    <servlet-name>ConnectServlet</servlet-name>
    <servlet-class>app.web.servlet.ConnectServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>ConnectServlet</servlet-name>
    <url-pattern>/ConnectServlet</url-pattern>
  </servlet-mapping>
</web-app>

===============>>#1 票数:1 已采纳

您的OSGi软件包很可能需要导出具有servlet代码的软件包,例如,在您需要的MANIFEST.MF文件中

Export-Package: app.web.servlet

===============>>#2 票数:0

如果不在战争范围之内,则需要导入正确的软件包。

Import-Package: app.web.servlet

或者如果它在lib文件夹中的一个lib中,则需要确保所有这些jar都包含在classpath中:

Bundle-ClassPath: WEB-INF/classes, WEB-INF/lib/jar1.jar, .... 

  ask by raka translate from so

未解决问题?本站智能推荐: