【发布时间】:2011-09-06 08:51:27
【问题描述】:
我在 JDK6 上使用 netbeans 7 非常成功。我需要向我的应用程序添加一个 JAX-WS webservice[ws] 接口来使用已经在应用程序中创建的 EJB 服务。自从我搬到 maven2 后,我在 glassfish v3.1 上的部署没有任何问题,而且除了新的 ws 之外,它似乎一切正常。
这是我仍然存在的问题列表:
- WS 未部署,WSDL 未生成
- 无法识别根上下文的问题,并且测试 WS 就在 localhost 地址之后。
- 我无法为 WS 配置安全约束,出现 JACC 错误且 WS 不可用
我曾经能够使用简单的 web.xml BASIC auth 来保护 ws (Ant),但是使用 maven,这不再起作用了。我创建了一个测试 Ant 项目,一切正常。
我认为解决方案是在包含正确构建插件的 pom.xml(原型?)中? 我不确定我正在使用的 pom.xml 中包含哪些代码。
http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
....
<groupId>com</groupId>
<artifactId>at.web.ws</artifactId>
<version>3.4.2</version>
<packaging>war</packaging>
<name>at.web.ws Web App</name>
<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>webservices-rt</artifactId>
<version>2.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</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-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<failOnMissingWebXml>true</failOnMissingWebXml>
</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>
<repositories>
<repository>
<url>http://download.java.net/maven/2/</url>
<id>metro</id>
<layout>default</layout>
<name>Repository for library Library[metro]</name>
</repository>
</repositories>
任何建议将不胜感激。提前致谢。
【问题讨论】:
标签: web-services netbeans maven jax-ws glassfish-3