2

Apache CXF、Apache Camel、Spring with Maven で JAX-RS アプリケーションを作成しています。アプリケーションを実行すると、埋め込まれた桟橋が作成され、リクエストが処理されます。

埋め込まれた桟橋を削除し、war ファイルを使用してスタンドアロンの Tomcat で実行したいと考えています。利用可能な多くの提案を試しましたが、私の場合はうまくいきませんでした。同じことについて何か提案をしてください。

私のPOMには含まれています

            <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-transports-http</artifactId>
            <version>2.7.6</version>
            </dependency>

            <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-frontend-jaxrs</artifactId>
            <version>2.7.6</version>
            </dependency>

            <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-servlets</artifactId>
            <version>8.1.3.v20120416</version>
            </dependency>

                 <build>
                 <plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>8.1.12.v20130726</version>

                <configuration>
                    <scanIntervalSeconds>5</scanIntervalSeconds>
                    <webApp>
                        <contextPath>myfashions</contextPath>
                        <defaultsDescriptor>
                            ${basedir}/src/main/resources/webdefault.xml
                        </defaultsDescriptor>
                    </webApp>
                </configuration>
            </plugin>
            </build>

intellij idea からポート 8081 で jetty:run を使用してこれを実行すると、アプリケーションはポート 8080 で別の組み込みの jetty サーバーを起動し、リクエストを処理します。

すべての jetty 依存関係とプラグインを削除し、生成された WAR を tomcat にデプロイすると、次のようなエラーが発生します。

013-09-06_01:21:21 ERROR o.a.c.t.http.HTTPTransportFactory - Cannot find any registered HttpDestinationFactory from the Bus.
Sep 06, 2013 1:21:21 AM org.springframework.web.context.ContextLoader initWebApplicationContext
SEVERE: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'baseApi': Invocation of init method failed; nested exception is org.apache.cxf.service.factory.ServiceConstructionException
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1482)

埋め込まれた桟橋を起動せずに tomcat 内で実行される WAR を生成できる方法を提案してください。

4

2 に答える 2