基本上,我遵循了 VSCode: Is it possible to subpressexperimentaldecorator warnings以便取出此类消息,但没有产生任何效果。
首先,我收到这样的消息:
“(节点:15077)DeprecationWarning:node --debug 已弃用。请改用node --inspect”。我在某处读到在 launch.json 中添加 "protocol": "auto" (老实说,我不知道我设置了什么自动)。
它更改了本主题中提到的警告。好吧,我已将 jsconfig.json 添加到项目根目录,但似乎没有改变任何内容。
我不知道它是否相关,但我注意到 Visual Studio Code About 指向 Node 6.5.0,而我的本地节点是 7.7.4。
最后但并非最不重要的一点是,这样的警告意味着什么?
启动.json
{
// Use IntelliSense to learn about possible Node.js debug attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceRoot}/server.js",
"protocol": "auto"
},
{
"type": "node",
"request": "attach", …
Run Code Online (Sandbox Code Playgroud) 每当我尝试entityManager.flush()时,我都会收到标题中提到的错误。有趣的是,我的所有模型都在应用程序启动期间在 MySql 上正确创建。
我读过几个有类似例外的问题,基本上所有问题都指出以某种方式使用/更改@Transaction。
任何有关检查内容的建议甚至是初步想法都将受到高度赞赏。
我认为这并不真正相关,但让我顺便告诉一下:我正在使用 WebSphere Liberty Profile + MySql。
异常发生的地方:
@Repository
//@Transactional
public class ClienteRepository {
@PersistenceContext
private EntityManager em;
@Transactional(propagation=Propagation.REQUIRED)
public Cliente save(Cliente cliente) {
//First Try: without flush, this return the id nevertheless it doesn't create effectively the register in MySql
Cliente c = em.merge(cliente);
//Second Try: this isn't allowed since I have @Transaction (Spring Transaction Manager)
//if I take @Transaction it is still not working
//em.getTransaction().begin();
//em.persist(cliente);
//em.getTransaction().commit();
//Third Try: persist doesn't cause exception but …
Run Code Online (Sandbox Code Playgroud) 简而言之,如果我从 Maven 运行下面的 JMeter 计划测试,它会给出结果:
javax.naming.NamingException: javax.naming.NoInitialContextException: Cannot instantiate class: org.apache.activemq.jndi.ActiveMQInitialContextFactory [Root exception is java.lang.ClassNotFoundException: org.apache.activemq.jndi.ActiveMQInitialContextFactory]
Run Code Online (Sandbox Code Playgroud)
尽管如此,如果我在没有 maven 插件的情况下运行相同的 JMeter 计划测试,它会正确运行。
提供更多细节:
如果我以这种方式启动 ActiveMQ(Windows 命令提示符):
cd C:\_d\server\ActiveMQ\apache-activemq-5.9.0\bin
activemq.bat
Run Code Online (Sandbox Code Playgroud)
然后,我以这种方式运行完全相同的 jmx 脚本:
jmeter.bat -n -t C:\_d\scripts\JMeter\JMS_SQS_MVN\SQS.jmx -l C:\temp\activemq.jtl -j C:\temp\activemq.jmx.log
Run Code Online (Sandbox Code Playgroud)
我可以转到 ActiveMq 控制台并查看创建的标记为 sqs_dummy_mvn6 的队列,因为它出现在此类 jmx 脚本中。
现在,使用相同的脚本但通过 maven 插件,它只是显示“无法实例化类:org.apache.activemq.jndi.ActiveMQInitialContextFactory”。好吧,我明白,每当我使用 jmeter-maven-plugin 时,都会在验证阶段启动和停止嵌入式 jmeter 和嵌入式 activemq。
我通过 maven 调用相同的脚本:
mvn clean verify
Run Code Online (Sandbox Code Playgroud)
...\artproducer\src\test\jmeter\SQS.jmx(下面只启用发布者;禁用订阅以使测试更简单)
<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="2.9" jmeter="3.0 r1743807">
<hashTree>
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Plano de Teste SQS" enabled="true">
<stringProp name="TestPlan.comments"></stringProp> …
Run Code Online (Sandbox Code Playgroud) 这是我第一次使用OAuth2方法开发应用程序。我是根据某些教程开始的,并且我从此教程开始前进(http://websystique.com/spring-security/secure-spring-rest-api-using-oauth2/)。
我将应用程序部署到集群的WebSpheres,据我所知,内存中的内存将无法工作(... clients.inMemory()。withClient ...)。
我想使用Redis(也是我的第一个用法),我有点困惑如何在某些no-xml java config应用程序中设置它。
我在xml中发现了类似的问题,但是第一次尝试(Redis Token Store)仍然没有问题。有趣的是,问题所有者在此讨论了有关“ Spring-Security OAuth,即2.8.0提供RedisTokenStore”的问题,但我发现“ 2.0.12.RELEASE”是最新的mvn发行版本。
就是说,我的直截了当的问题是:如何调整以下代码以依靠Redis而不是内存?
关于如何设置RedisTokenStore的任何评论都将受到赞赏。
另外,如果很容易添加此类附加注释,那么“ .passwordEncoder”和“ .secret”之间有什么区别?下面的代码依赖于带有硬编码表达式(固定值)的“ .secret”,而我看到的几个示例中使用带有“ .frame.spring.work.security.crypto.bcrypt.BCryptPasswordEncoder”填充的“ .passwordEncoder”的jdbc似乎更有意义。我猜我使用“ .secret”还是“ .passwordEncoder”对吗?我认为secret代表固定值,而passwordEncoder代表动态值,对吗?
(使用“ .passwordEncoder”和clients.jdbc的示例https://github.com/spring-projects/spring-security-oauth/blob/master/tests/annotation/jdbc/src/main/java/demo/Application.java #L102)
@Configuration
@EnableAuthorizationServer
public class AuthorizationServerConfiguration extends AuthorizationServerConfigurerAdapter {
private static String REALM="MY_OAUTH_REALM";
@Autowired
private TokenStore tokenStore;
@Autowired
private UserApprovalHandler userApprovalHandler;
@Autowired
@Qualifier("authenticationManagerBean")
private AuthenticationManager authenticationManager;
@Override
public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
clients.inMemory()
.withClient("abc-trusted-client")
.authorizedGrantTypes("password", "authorization_code", "refresh_token", "implicit")
.authorities("ROLE_CLIENT", "ROLE_TRUSTED_CLIENT")
.scopes("read", "write", "trust")
.secret("abc-secret")
.accessTokenValiditySeconds(120).//Access token is …
Run Code Online (Sandbox Code Playgroud)