我正在尝试将 CompletableFuture 与在 WildFly 上运行的 EBJ bean 一起使用。
我可以看到调试器到达远程 Ejb 并成功检索结果,但在 Wayback to caller 类中我遇到了异常
java.lang.ClassNotFoundException:没有可用的类加载器
CompletableFuture<Void> future = CompletableFuture.supplyAsync(() -> {
dnsRecords = ipaFacadeService.fetchDnsRecords();
return dnsRecords;
}).thenAccept(result -> {
if (result.size() > 0) {
//do more stuff with the result
}
});
future.get();
Run Code Online (Sandbox Code Playgroud)
当我堆栈跟踪异常时,我发现它与CompletableFuture.supplyAsync()使用的 ForkJoin 有关
[org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:238),
org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:183),
org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:146),
com.sun.proxy.$Proxy107.fetchDnsRecords(Unknown Source), no.lyse.tele.prov.struts2.action.network.DnsAction.lambda$list$1(DnsAction.java:150),
java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1590),
java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1582),
java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289),
java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056),
java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692),
java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)]
Run Code Online (Sandbox Code Playgroud) 我编写了一个REST服务,我用Firefox测试它,显示我的对象的JSON格式.但是当我使用简单的REST Java客户端调用相同的URL时,当我使用JUnit运行它时会出现以下错误:
javax.ws.rs.ProcessingException: Unable to invoke request
at org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine.invoke(ApacheHttpClient4Engine.java:287)
at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.invoke(ClientInvocation.java:407)
at org.jboss.resteasy.client.jaxrs.internal.ClientInvocationBuilder.post(ClientInvocationBuilder.java:195)
at ma.gesto.persistence.TestRESTServices.createAndDeleteAReference(TestRESTServices.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
**Caused by: javax.ws.rs.ProcessingException: could not find writer for content-type application/json type: ma.gesto.entity.Reference**
at org.jboss.resteasy.core.interception.ClientWriterInterceptorContext.throwWriterNotFoundException(ClientWriterInterceptorContext.java:40)
at org.jboss.resteasy.core.interception.AbstractWriterInterceptorContext.getWriter(AbstractWriterInterceptorContext.java:138)
at org.jboss.resteasy.core.interception.AbstractWriterInterceptorContext.proceed(AbstractWriterInterceptorContext.java:117) …Run Code Online (Sandbox Code Playgroud) 我使用alfresco-community-4.0.e,OpenCMIS和primefaces作为用户界面构建Web应用程序.
我需要以编程方式在alfresco中创建用户.我尝试使用以下代码创建用户:
Blockquote
if (!personService.personExists("tuser1")) {
personService.createPerson(createDefaultProperties("tuser1", "Test", "User1", "tuser1@localhost", "password"));
if (logger.isDebugEnabled()) logger.debug("Created tuser1 person");
}
if (!personService.personExists("tuser1")) {
personService.createPerson(createDefaultProperties("tuser1", "Test", "User1", "tuser1@localhost", "password"));
if (logger.isDebugEnabled()) logger.debug("Created tuser1 person");
}
Blockquote
Run Code Online (Sandbox Code Playgroud)
但我面临着身份验证的问题.
我为露天认证创建了一个类,它抛出openCMIS,它可以很好地创建我的自定义内容和一些其他自定义操作.
知道它为什么现在正在创建用户或任何其他代码以编程方式构建用户?
我有包含属性列表的模型属性。
我想要格式化的值类似于此字符串:2012-07-16T00:00:00。
我尝试使用
<p th:text="${#temporals.format(${myData.mdProperties.get('completionDate')}, 'dd-MM-yyyy')}"></p>
Run Code Online (Sandbox Code Playgroud)
解析一直失败。然后我想我应该使用自定义方言将字符串转换为日期,但它很复杂。有没有更简单的解决方案?
我尝试根据这个问题将字符串转换为日期,但失败了:
<p th:text="${#temporals.format(new java.util.Date(${{myData.mdProperties.get('completionDate')}}), 'dd-MM-yyyy')}"></p>
Run Code Online (Sandbox Code Playgroud) java ×3
wildfly ×2
alfresco ×1
createuser ×1
date-format ×1
ejb-3.0 ×1
jakarta-ee ×1
json ×1
opencmis ×1
rest ×1
spring-boot ×1
thymeleaf ×1
web-services ×1