尝试部署Web应用程序时出现问题

时间:2013-03-22 15:08:56

标签: java war

我在使用netbeans从我的实体类创建Web服务时遇到问题。实际上我有一个javaee项目,可以在weblogic 10g,oracle数据库10g上运行,并使用带有primefaces的JSF 2.1。它运作得很好。

但是当我在项目中添加Web服务时,我遇到了

  

部署失败。消息是:java.lang.NoClassDefFoundError:com / sun / jersey / spi / container / ContainerListener   C:\ Users \ Developer \ Documents \ NetBeansProjects \ IBB_Projeler \ nbproject \ build-impl.xml:294:尚未部署模块。

当我添加Web服务时,我的web.xml变为:

    <?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
    <context-param>
        <param-name>javax.faces.PROJECT_STAGE</param-name>
        <param-value>Production</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>
        <servlet-name>ServletAdaptor</servlet-name>
        <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
        <init-param>
            <description>Multiple packages, separated by semicolon(;), can be specified in param-value</description>
            <param-name>com.sun.jersey.config.property.packages</param-name>
            <param-value>Resources</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>ServletAdaptor</servlet-name>
        <url-pattern>/webresources/*</url-pattern>
    </servlet-mapping>
    <session-config>
        <session-timeout>
            3000
        </session-timeout>
    </session-config>
    <welcome-file-list>
        <welcome-file>index.jsf</welcome-file>
    </welcome-file-list>
    <ejb-local-ref>
        <ejb-ref-name>ProjectsFacade</ejb-ref-name>
        <ejb-ref-type>Session</ejb-ref-type>
        <local>com.ibb.entity.facades.ProjectsFacadeLocal</local>
        <ejb-link>projetakip-ejb.jar#ProjectsFacade</ejb-link>
    </ejb-local-ref>
    <mime-mapping>
        <extension>jpeg</extension>
        <mime-type>image/jpeg</mime-type>
    </mime-mapping>
    <ejb-local-ref>
        <ejb-ref-name>ProjectsFacade1</ejb-ref-name>
        <ejb-ref-type>Session</ejb-ref-type>
        <local>com.ibb.entity.facades.ProjectsFacadeLocal</local>
        <ejb-link>projetakip-ejb.jar#ProjectsFacade</ejb-link>
    </ejb-local-ref>
    <ejb-local-ref>
        <ejb-ref-name>ProjectsFacade2</ejb-ref-name>
        <ejb-ref-type>Session</ejb-ref-type>
        <local>com.ibb.entity.facades.ProjectsFacadeLocal</local>
        <ejb-link>projetakip-ejb.jar#ProjectsFacade</ejb-link>
    </ejb-local-ref>
    <persistence-unit-ref>
        <persistence-unit-ref-name>persistence-factory</persistence-unit-ref-name>
        <persistence-unit-name>projetakip-warPU</persistence-unit-name>
    </persistence-unit-ref>
    <error-page>
        <exception-type>javax.faces.application.ViewExpiredException</exception-type>
        <location>/index.jsf</location>
    </error-page>
</web-app>

基本上它增加了以下内容:

<servlet-mapping>
    <servlet-name>ServletAdaptor</servlet-name>
    <url-pattern>/webresources/*</url-pattern>
</servlet-mapping>
<servlet>
    <servlet-name>ServletAdaptor</servlet-name>
    <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
    <init-param>
        <description>Multiple packages, separated by semicolon(;), can be specified in param-value</description>
        <param-name>com.sun.jersey.config.property.packages</param-name>
        <param-value>Resources</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
</servlet>

我搜索了一下,在一些论坛中他们说要添加相关的罐子。我添加了jersey-server,jsr311-api,asm3.1,jersey-gf-server和jersey-servlet。

但问题仍然存在,如果有人可以提供帮助,我会非常感激。

0 个答案:

没有答案