0

我有这个网络服务:


    /**
     * Web service operation
     */
    @WebMethod(operationName = "executeCleanAndValidateExtractedDate")
    public boolean executeCleanAndValidateExtractedDate()
    {
        try
        {
            CleanAndValidateExtractedData cav = new CleanAndValidateExtractedData();
            Transformation transformation = new DefaultTransformation();
            Step s1 = transformation.addStep(cav);          
            return transformation.execute();
        }
        catch (RuntimeException ex)
        {
            Logger.getLogger(ExecuteKeymark.class.getName()).log(Level.SEVERE, null, ex);
            return false;
        }
        catch(Exception ex)
        {
            Logger.getLogger(ExecuteKeymark.class.getName()).log(Level.SEVERE, null, ex);
            return false;
        }
    }

当我尝试执行它时,我得到一个异常:

javax.ejb.EJBException
    在 com.sun.ejb.containers.BaseContainer.processSystemException(BaseContainer.java:5193)
    在 com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:5091)
    在 com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:4879)
...
引起:java.lang.NoClassDefFoundError: com/medallion/etl/impl/AbstractStepSupport

我很困惑为什么它可以找到那个类。它在运行时可用,但不再可用。我需要做一些特别的事情来部署它,以便它可以访问 Glassfish 中的类吗?

编辑:附加的POM文件

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.dv</groupId>
<artifactId>WS_3</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>ejb</packaging>

<name>WS_3</name>

<properties>
    <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
    <dependency>
        <groupId>com.medallion</groupId>
        <artifactId>keymark.filemonitorEJB</artifactId>
        <version>1.0-ALPHA</version>
        <type>jar</type>
    </dependency>
    <dependency>
        <groupId>com.medallion</groupId>
        <artifactId>etl</artifactId>
        <version>1.0-ALPHA</version>
        <type>jar</type>
    </dependency>
    <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-api</artifactId>
        <version>6.0</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
                <compilerArguments>
                    <endorseddirs>${endorsed.dir}</endorseddirs>
                </compilerArguments>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-ejb-plugin</artifactId>
            <version>2.3</version>
            <configuration>
                <ejbVersion>3.1</ejbVersion>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.1</version>
            <executions>
                <execution>
                    <phase>validate</phase>
                    <goals>
                        <goal>copy</goal>
                    </goals>
                    <configuration>
                        <outputDirectory>${endorsed.dir}</outputDirectory>
                        <silent>true</silent>
                        <artifactItems>
                            <artifactItem>
                                <groupId>javax</groupId>
                                <artifactId>javaee-endorsed-api</artifactId>
                                <version>6.0</version>
                                <type>jar</type>
                            </artifactItem>
                        </artifactItems>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
</project>
4

1 回答 1

0

确保将所需的 jar 文件捆绑在 war/ear 文件中,以便它们在运行时可用,而不仅仅是在编译时可用。

于 2012-05-23T19:09:31.443 回答