java.lang.ClassNotFoundException:使用osgi框架的javax.faces.webapp.FacesServlet错误

时间:2015-04-13 10:41:42

标签: jsf osgi bundle

我是osgi框架的新手。我添加necessery包来开发osgi-jsf项目。我的包的清单;

ss

Framework is launched.

id  State       Bundle
0   ACTIVE      org.eclipse.osgi_3.7.2.v20120110-1415
1   ACTIVE      LastTestWeb_1.0.0.qualifier
2   ACTIVE      org.eclipse.gemini.web.core_2.0.2.RELEASE
3   ACTIVE      org.eclipse.gemini.web.extender_2.0.2.RELEASE
4   ACTIVE      org.eclipse.gemini.web.tomcat_2.0.2.RELEASE
5   ACTIVE      com.springsource.javax.activation_1.1.1
6   ACTIVE      com.springsource.javax.ejb_3.0.0
7   ACTIVE      com.springsource.javax.mail_1.4.0
8   ACTIVE      com.springsource.javax.persistence_1.0.0
9   ACTIVE      com.springsource.javax.transaction_1.1.0
10  ACTIVE      com.springsource.javax.xml.bind_2.1.7
11  ACTIVE      com.springsource.javax.xml.rpc_1.1.0.v20110517
12  ACTIVE      com.springsource.javax.xml.soap_1.3.0
13  ACTIVE      com.springsource.javax.xml.stream_1.0.1
14  ACTIVE      com.springsource.org.aopalliance_1.0.0
15  ACTIVE      com.springsource.org.apache.catalina_7.0.26
                Fragments=16, 17, 19, 21, 24
16  RESOLVED    com.springsource.org.apache.catalina.ha_7.0.26
                Master=15
17  RESOLVED    com.springsource.org.apache.catalina.tribes_7.0.26
                Master=15
18  ACTIVE      com.springsource.org.apache.commons.logging_1.1.1
19  RESOLVED    com.springsource.org.apache.coyote_7.0.26
                Master=15
20  ACTIVE      com.springsource.org.apache.el_7.0.26
21  RESOLVED    com.springsource.org.apache.jasper_7.0.26
                Master=15
22  ACTIVE      com.springsource.org.apache.juli.extras_7.0.26
23  ACTIVE      com.springsource.org.apache.tomcat.api_7.0.26
24  RESOLVED    com.springsource.org.apache.tomcat.util_7.0.26
                Master=15
25  ACTIVE      com.springsource.org.eclipse.jdt.core.compiler.batch_3.6.1
26  ACTIVE      com.springsource.slf4j.api_1.6.1
                Fragments=27
27  RESOLVED    com.springsource.slf4j.nop_1.6.1
                Master=26
28  ACTIVE      javax.annotation_1.1.0.v201105051105
29  ACTIVE      javax.el_2.2.0.v201105051105
30  ACTIVE      javax.servlet_3.0.0.v201103241009
31  ACTIVE      javax.servlet.jsp_2.2.0.v201103241009
32  ACTIVE      org.eclipse.virgo.util.common_3.0.1.RELEASE
33  ACTIVE      org.eclipse.virgo.util.io_3.0.1.RELEASE
34  ACTIVE      org.eclipse.virgo.util.math_3.0.1.RELEASE
35  ACTIVE      org.eclipse.virgo.util.osgi_3.0.1.RELEASE
36  ACTIVE      org.eclipse.virgo.util.parser.manifest_3.0.1.RELEASE
37  ACTIVE      org.springframework.aop_3.0.5.RELEASE
38  ACTIVE      org.springframework.beans_3.0.5.RELEASE
39  ACTIVE      org.springframework.context_3.0.5.RELEASE
40  ACTIVE      org.springframework.core_3.0.5.RELEASE
41  ACTIVE      org.springframework.osgi.core_1.2.1
42  ACTIVE      org.springframework.osgi.io_1.2.1
55  ACTIVE      com.springsource.javax.servlet.jsp.jstl_1.2.0
56  ACTIVE      org.apache.commons.beanutils_1.8.3
57  ACTIVE      org.apache.commons.collections_3.2.1
58  ACTIVE      org.apache.commons.digester_2.1.0
59  ACTIVE      org.apache.commons.validator_1.4.0
61  ACTIVE      org.apache.myfaces.core.bundle_2.2.7
63  ACTIVE      org.primefaces_3.5.0
64  ACTIVE      org.jboss.weld.osgi-bundle_1.1.6.Final
65  ACTIVE      org.apache.servicemix.bundles.jaxp-ri_1.4.2.1
68  ACTIVE      org.knopflerfish.bundle.jsdk-API_2.5.0.kf3-2
69  ACTIVE      org.apache.servicemix.bundles.commons-codec_1.3.0.2
70  ACTIVE      org.apache.servicemix.bundles.commons-digester_1.8.0.1
73  ACTIVE      com.springsource.javax.el_1.0.0
74  ACTIVE      org.glassfish.com.sun.faces_2.1.6.SNAPSHOT

我的web.xml是;

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    id="WebApp_ID" version="2.5">
    <display-name>LastTestWeb</display-name>
    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.htm</welcome-file>
        <welcome-file>index.jsp</welcome-file>
        <welcome-file>default.html</welcome-file>
        <welcome-file>default.htm</welcome-file>
        <welcome-file>default.jsp</welcome-file>
    </welcome-file-list>
    <context-param>
        <param-name>javax.faces.PROJECT_STAGE</param-name>
        <param-value>Development</param-value>
    </context-param>
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
</web-app>

但我收到了这个错误;

java.lang.ClassNotFoundException: javax.faces.webapp.FacesServlet

我有javax.faces包(org.glassfish.com.sun.faces_2.1.6.SNAPSHOT),它有javax.faces.webapp包和FacesServlet.class。

我需要什么?

1 个答案:

答案 0 :(得分:0)

您需要导入正在尝试构建的OSGi包中的类。您可以在manifest.mf文件中执行此操作

Import-Package:javax.faces.webapp