0

私は Eclipse に 2 つの Web プロジェクトを持っています: Framework と webxxx

私のフレームワークには、utilsコピー、ダウンロード、アップロードなどの機能があります...

からダウンロードメソッドを呼び出すとwebxxx*java.lang.NoClassDefFoundError: javax/faces/context/FacesContext*.

GerenciarArquivoクラスを webxxx プロジェクトに移動すると、downloadFile メソッドは正常に機能します。

フレームワーク :

public abstract class GerenciarArquivo{
...
public static void downloadFile(String filePath) throws IOException{
    FacesContext context = FacesContext.getCurrentInstance();  
    HttpServletResponse response = (HttpServletResponse) context  
                         .getExternalContext().getResponse(); 

WEBXXX プロジェクト :

GerenciarArquivo.downloadFile(abb.getPath());

両方のプロジェクトには次のものがあります。

ここに画像の説明を入力 ここに画像の説明を入力

Web xxx プロジェクトの依存関係:

<dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-api</artifactId>
        <version>6.0</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>org.primefaces</groupId>
        <artifactId>primefaces</artifactId>
        <version>3.5</version>
    </dependency>

    <dependency>
        <groupId>org.primefaces.themes</groupId>
        <artifactId>all-themes</artifactId>
        <version>1.0.9</version>
    </dependency>


    <dependency>
        <groupId>com.sun.faces</groupId>
        <artifactId>jsf-impl</artifactId>
        <version>2.2.4</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>com.sun.faces</groupId>
        <artifactId>jsf-api</artifactId>
        <version>2.2.4</version>
        <scope>provided</scope>
    </dependency>       

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>3.0-alpha-1</version>
        <scope>provided</scope>
</dependency>

フレームワークの依存関係:

<dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-api</artifactId>
        <version>6.0</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>4.1.9.Final</version>
    </dependency>
    <dependency>
        <groupId>javassist</groupId>
        <artifactId>javassist</artifactId>
        <version>3.1</version>
    </dependency>
    <dependency>
        <groupId>commons-lang</groupId>
        <artifactId>commons-lang</artifactId>
        <version>2.2</version>
    </dependency>
</dependencies>
4

2 に答える 2

5

この依存関係を追加すると、これで私の問題が解決します

クラスが見つからない例外: javax.faces.context.facesContext .

<dependency>
     <groupId>javax</groupId>
     <artifactId>javaee-web-api</artifactId>
     <version>6.0</version>
     <scope>provided</scope>
</dependency>
于 2014-04-16T05:46:41.573 に答える