小编and*_*adi的帖子

从JBoss 7.1中排除JPA 2.0以使用hibernate 4.3

我想在hossnate 4.3中使用JBoss 7.1中的多租户功能.

我设法通过在jboss-deployment-structure中添加以下行来将它包含在我的战争中

<exclusions>
   <module name="org.hibernate" />
</exclusions>
Run Code Online (Sandbox Code Playgroud)

并在我的pom.xml中为hibernate核心和实体管理器添加依赖项

这使得hibernate 4.3加载但不幸的是我收到了一个错误

java.lang.NoSuchMethodError: javax.persistence.Table.indexes()[Ljavax/persistence/Index;
Run Code Online (Sandbox Code Playgroud)

这是由于在hibernate 4.3使用JPA 2.1时加载了JPA 2.0

我已经看过这些线程并尝试了他们的建议 从JBoss EAP 6.1中排除JPA子系统 - 尝试在JBoss EAP 6.1中使用JPA 2.1,JBoss AS7自动加载JPA,Hibernate 4.3.0.Final和Spring Data JPA 1.4.3.RELEASE.

我添加了一个persistence.xml

<property name="jboss.as.jpa.managed" value="false" /> 
Run Code Online (Sandbox Code Playgroud)

从Spring Data中排除了hibernate jpa 2.0

<dependency>
    <groupId>org.springframework.data</groupId>
    <artifactId>spring-data-jpa</artifactId>
    <version>${spring-data.version}</version>
    <exclusions>
        <exclusion>
            <groupId>org.hibernate.javax.persistence</groupId>
            <artifactId>hibernate-jpa-2.0-api</artifactId>
        </exclusion>
    </exclusions>
</dependency>
Run Code Online (Sandbox Code Playgroud)

从JBoss standalone.xml中完全删除了JPA子系统,没有任何成功.

唯一能做到这一点的是在jboss-deployment-structure中排除整个javaee.api,如另一个线程所示

<exclusions>
    <module name="javax.persistence.api"/>
    <module name="javaee.api"/>
</exclusions>
Run Code Online (Sandbox Code Playgroud)

但这会给我的其余代码带来许多问题.

更新:我的jboss-deployment-structure.xml现在是这样的

<jboss-deployment-structure>
<deployment>
    <exclusions>
        <module name="org.slf4j" />
        <module name="org.slf4j.impl" />
        <module name="org.apache.log4j" /> …
Run Code Online (Sandbox Code Playgroud)

hibernate jpa-2.0 jboss7.x jpa-2.1

30
推荐指数
2
解决办法
2万
查看次数

基本身份验证过滤器和身份验证入口点实际上并未使用spring oauth2令牌请求

我已经使用spring的sparklr示例应用程序和我在网上找到的几个示例实现了spring oauth2的资源所有者流程.我用curl测试了令牌请求部分,以便提供客户端和用户凭据:

curl -v --data "username=user1&password=user1&client_id=client1&client_secret=client1&grant_type=password" -X POST "http://localhost:8080/samplerestspringoauth2/oauth/token"
Run Code Online (Sandbox Code Playgroud)

它工作正常,但我做了以下观察:

虽然根据我看到的例子,我使用了BasicAuthentication过滤器,但这并没有真正用于安全过程.由于令牌请求不包含Authentication头,因此BasicAuthentication过滤器只会跳过任何检查.ClientCredentialsTokenEndpointFilter和authentication-server是唯一在令牌请求期间执行安全检查的人.注意到并通过调试验证后,我试图完全删除以下部分:

<http-basic entry-point-ref="clientAuthenticationEntryPoint" />

从配置.但后来我收到了警告:

"无法建立AuthenticationEntryPoint.请确保您具有通过命名空间配置的登录机制(例如表单登录)或指定具有'entry-point-ref'属性的自定义AuthenticationEntryPoint".

下一步,我在http命名空间中添加了entry-point-ref ="clientAuthenticationEntryPoint,并取消了警告.我测试了应用程序并正确播放.

但是,除了上述内容之外,我还在调试期间进行了以下观察:ClientCredentialsTokenEndpointFilter在私有变量中包含其自己的OAuth2AuthenticationEntryPoint入口点,并在由于错误的客户端凭据而失败时使用它.因此,无论在基本过滤器中还是在http命名空间中指定的入口点都无关紧要.最后,ClientCredentialsTokenEndpointFilter将使用自己的私有OAuth2AuthenticationEntryPoint.总结一下我的结论似乎如下:

  • 如果我们在http命名空间中指定端点,则不使用基本过滤器并且可以将其删除.
  • 仅在编译器停止警告时才需要在http命名空间中指定基本过滤器或端点.它们没有实际用途,所使用的端点在ClientCredentialsTokenEndpointFilter中是硬编码的.

下面我将令牌请求的http和端点配置供您参考.我跳过其余的配置以保持帖子易于阅读:

<http pattern="/oauth/token" create-session="stateless"
        authentication-manager-ref="clientAuthenticationManager"
        xmlns="http://www.springframework.org/schema/security">
        <intercept-url pattern="/oauth/token" access="IS_AUTHENTICATED_FULLY" />
        <anonymous enabled="false" />
        <http-basic entry-point-ref="clientAuthenticationEntryPoint" />
        <custom-filter ref="clientCredentialsTokenEndpointFilter"
            before="BASIC_AUTH_FILTER" />
        <access-denied-handler ref="oauthAccessDeniedHandler" />
    </http>

<bean id="clientAuthenticationEntryPoint"
        class="org.springframework.security.oauth2.provider.error.OAuth2AuthenticationEntryPoint">
        <property name="realmName" value="springsec/client" />
        <property name="typeName" value="Basic" />
    </bean>
Run Code Online (Sandbox Code Playgroud)

我还假设在令牌请求的原始sparklr应用程序(即spring oauth2示例应用程序)配置中也发生了同样的问题,这非常相似.可以在https://github.com/spring-projects/spring-security-oauth/blob/master/samples/oauth2/sparklr/src/main/webapp/WEB-INF/spring-servlet.xml中找到 ,相关部分如下:

<http pattern="/oauth/token" create-session="stateless"
                authentication-manager-ref="clientAuthenticationManager"
                xmlns="http://www.springframework.org/schema/security">
                <intercept-url pattern="/**" method="GET" access="ROLE_DENY" />
                <intercept-url pattern="/**" method="PUT" access="ROLE_DENY" />
                <intercept-url pattern="/**" method="DELETE" …
Run Code Online (Sandbox Code Playgroud)

spring spring-security oauth-2.0

16
推荐指数
1
解决办法
1万
查看次数

当CreatePackageOnPublish设置为true时,TFS Team Build中的长路径问题.

由于在参数CreatePackageOnPublish设置为true时由TFS Team Build创建的长路径,因此构建存在问题.

在目录PackageTmp(见下图)中存储了包,但我不明白为什么这个目录结构是必要的以及如何自定义它.

问题是部署或新的TFS构建因长路径而产生错误.

我将非常感谢你的帮助.

问候

安东卡尔奇克

这是由TFS Team Build创建的(匿名)树结构:

在此输入图像描述

msbuild team-build tfs2010

7
推荐指数
1
解决办法
1145
查看次数

运行sn.exe需要哪些Windows SDK部件

我想运行sn.exe,以便能够在服务器中运行延迟签名的项目.如果我安装整个Windows SDK一切运行顺利,但需要哪个部分SDK?我问,因为整个下载是460Mb,可能安装我不需要的东西.

.net winapi delay-sign sn.exe

5
推荐指数
1
解决办法
682
查看次数

Maven故障安全插件找不到任何测试用例

我在pom.xml中添加了以下插件

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-failsafe-plugin</artifactId>
    <version>2.18.1</version>
    <configuration>
        <includes>
            <include>**/IT*.java</include>
        </includes>
        <testSourceDirectory>${basedir}/src/integration-test/java</testSourceDirectory>
        <testClassesDirectory>${project.build.directory}/it-classes</testClassesDirectory>
    </configuration>
    <executions>
        <execution>
            <id>integration-test</id>
            <goals>
                <goal>integration-test</goal>
                <goal>verify</goal>
            </goals>
        </execution>
    </executions>
 </plugin>
Run Code Online (Sandbox Code Playgroud)

我在目录src \ integration-test \ java下有一个名为ITSample.java的测试,带有@Test批注。

Maven报告

[DEBUG]   (s) skip = false
[DEBUG]   (s) skipITs = false
[DEBUG]   (s) skipTests = false
[DEBUG]   (s) testSourceDirectory = ...\src\integration-test\java
[DEBUG]   (s) testClassesDirectory = ...\target\it-classes
[DEBUG]   (s) includes = [**/IT*.java]
Run Code Online (Sandbox Code Playgroud)

这似乎是预期的,但是当我运行mvn failsafe:integration-test时,我从maven回来:

[INFO] No tests to run.
Run Code Online (Sandbox Code Playgroud)

有什么想法,如果我错过了什么,或者我应该做一些不同的设置?

我注意到的另一件事是,当我运行mvn integration-test故障安全插件时,未执行。

java integration-testing maven maven-failsafe-plugin

5
推荐指数
1
解决办法
1367
查看次数

使用服务器测试不同编程语言的客户端的最佳方法是什么?

我们用不同的编程语言(Java,.NET/Silverlight,Flash,Javascript)编写了与服务器通信的客户端,因为我们的目标是在客户端支持各种技术.他们应该执行的功能是相同的.

我们现在面临的主要挑战之一是找到一种简单有效的方法来针对服务器测试各种客户端技术.目前我们使用maven,连接了许多maven插件,如JSTestDriver,Flexmojo,NPanday以及我们自己开发的其他插件.有没有更好的方法?

任何帮助将不胜感激,无论是推荐可用的框架/工具还是创新的想法来做到这一点.

谢谢

testing client integration-testing programming-languages

3
推荐指数
1
解决办法
145
查看次数