我正在使用Apache CXF版本2.4.0.我正在尝试创建一个Restful服务.
以下示例适用于2.3.4,但在2.4.0中不起作用.我应该在beans配置文件中做些什么?
当我在我的bean配置文件中包含下面的xml行时.
<import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml" />
Run Code Online (Sandbox Code Playgroud)
我收到以下stacktrace错误:
org.springframework.beans.factory.parsing.BeanDefinitionParsingException:配置问题:无法从URL位置导入bean定义[classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml]
违规资源:ServletContext资源[/WEB-INF/beans.xml]; 嵌套异常是org.springframework.beans.factory.BeanDefinitionStoreException:
IOException从类路径资源解析XML文档[META-INF/cxf/cxf-extension-jaxrs-binding.xml]; 嵌套异常是java.io.FileNotFoundException:无法打开类路径资源[META-INF/cxf/cxf-extension-jaxrs-binding.xml],因为它在org.springframework.beans.factory.parsing.FailFastProblemReporter中不存在.错误(FailFastProblemReporter.java:68)
我的POM依赖关系如下.这适用于2.3.4但不适用于2.4.0.有什么建议?该xml扩展行是否已弃用或包含在另一个jar中?
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-bundle-jaxrs</artifactId>
<version>2.3.4</version>
<exclusions>
<exclusion>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
</exclusion>
</exclusions>
</dependency>
Run Code Online (Sandbox Code Playgroud) 我正在使用Maven AntRun插件1.6并且从他们的示例中我无法编写以下要执行的ant任务.
示例网址:http://maven.apache.org/plugins/maven-antrun-plugin/examples/classpaths.html
当我执行mvn antrun:run时,我只收到以下消息.没有定义蚂蚁目标 - 跳过
我究竟做错了什么?
这是我的POM:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<configuration>
<target>
<property name="compile_classpath" refid="maven.compile.classpath" />
<property name="runtime_classpath" refid="maven.runtime.classpath" />
<property name="test_classpath" refid="maven.test.classpath" />
<property name="plugin_classpath" refid="maven.plugin.classpath" />
<echo message="compile classpath: ${compile_classpath}" />
<echo message="runtime classpath: ${runtime_classpath}" />
<echo message="test classpath: ${test_classpath}" />
<echo message="plugin classpath: ${plugin_classpath}" />
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud) 我目前正在使用cxf 2.4.0,我的代码是webservice的调用者.我能够使用Maven中的cxf插件生成客户端java文件.我的问题是生成的文件的最佳实践是什么?我应该编译生成的文件并将生成的类文件打包到一个jar文件中,还是应该在构建路径中包含所有生成的java文件?
我目前有一个使用JBoss 5服务器上托管的Spring Security的Web应用程序.
我的问题是,如果用户闲置几分钟,那么由于web.xml设置,他们的会话超时.有一段时间,当他们的会话无效时尝试点击webapp时会出现404错误.浏览器可以看到Web应用程序的唯一方法是用户清除其浏览器缓存.
有没有办法解决这个问题,以便用户不必清除他们的浏览器缓存?
这是我的spring security xml
<security:http auto-config="true" use-expressions="true">
<security:intercept-url pattern="/login" access="permitAll" />
<security:intercept-url pattern="/resources/**" access="permitAll" />
<security:intercept-url pattern="/import/trades" access="permitAll" />
<!--
The roles are prefix with the word ROLE
and it is upper case due to ldapAuthoritiesPopulator config section
-->
<security:intercept-url pattern="/**" access="hasAnyRole('ROLE_NBFIEPN_USERS', 'ROLE_NBFIEPN_DEVELOPERS')" />
<security:form-login login-page="/login" authentication-failure-url="/login?error=true"/>
<security:logout />
</security:http>
Run Code Online (Sandbox Code Playgroud)
这是我的web.xml文件.我目前将会话超时设置为1分钟以复制问题.
<?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">
<display-name>TBA Web Application</display-name>
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/spring/security-config.xml
</param-value> …Run Code Online (Sandbox Code Playgroud)