小编you*_*ans的帖子

Apache CXF异常:java.lang.RuntimeException:找不到地址的管道启动器

我想从java调用.net SOAP Web服务..net服务有ws-security模块,我使用apache CXF来设置用户名和密码(以后可能是X.509证书).我使用的代码是:

    ITaxOrganService wsHttpBindingITaxOrganService = new TaxOrganService().getWSHttpBindingITaxOrganService();
    Endpoint endpoint = ClientProxy.getClient(wsHttpBindingITaxOrganService).getEndpoint();

    Map<String,Object> outProps = new HashMap<>();
    outProps.put(WSHandlerConstants.ACTION,WSHandlerConstants.USERNAME_TOKEN);
    outProps.put(WSHandlerConstants.USER,"*****");
    outProps.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_TEXT);
    outProps.put(WSHandlerConstants.PW_CALLBACK_CLASS, ShahrdariPasswordCallback.class.getName());

    WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps);
    endpoint.getOutInterceptors().add(wssOut);
    PermissionPrintDS permissionPrintDS = wsHttpBindingITaxOrganService.providePermissionInfoByPermNo(10000198);
Run Code Online (Sandbox Code Playgroud)

但java在最后一行抛出一个异常:

    Caused by: java.lang.RuntimeException: Could not find conduit initiator for address: http://urbanservices.iri/Services/xxyzService/xxyzService.svc and transport: http://schemas.xmlsoap.org/soap/http
    at org.apache.cxf.binding.soap.SoapTransportFactory.getConduit(SoapTransportFactory.java:224) ~[cxf-rt-bindings-soap-3.1.0.jar:3.1.0]
    at org.apache.cxf.binding.soap.SoapTransportFactory.getConduit(SoapTransportFactory.java:229) ~[cxf-rt-bindings-soap-3.1.0.jar:3.1.0]
    at org.apache.cxf.endpoint.AbstractConduitSelector.createConduit(AbstractConduitSelector.java:145) ~[cxf-core-3.1.0.jar:3.1.0]
    at org.apache.cxf.endpoint.AbstractConduitSelector.getSelectedConduit(AbstractConduitSelector.java:107) ~[cxf-core-3.1.0.jar:3.1.0]
    at org.apache.cxf.endpoint.UpfrontConduitSelector.prepare(UpfrontConduitSelector.java:63) ~[cxf-core-3.1.0.jar:3.1.0]
    at org.apache.cxf.endpoint.ClientImpl.prepareConduitSelector(ClientImpl.java:853) ~[cxf-core-3.1.0.jar:3.1.0]
    at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:511) ~[cxf-core-3.1.0.jar:3.1.0]
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:425) ~[cxf-core-3.1.0.jar:3.1.0]
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:326) ~[cxf-core-3.1.0.jar:3.1.0]
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:279) ~[cxf-core-3.1.0.jar:3.1.0]
    at …
Run Code Online (Sandbox Code Playgroud)

java soap wsdl web-services cxf

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

我们可以在Spring Webflux中使用Web Servlet和Servlet过滤器吗?

我想从Spring MVC迁移到Spring Webflux,但是我从第3方使用了一些servlet过滤器和Web servlet,必须将其迁移到等效的Webflux版本。

但这是不切实际的,因为它们来自第三方框架。例如:H2服务器WebServletMetricsServletInstrumentedFilter

有什么方法可以将servlet或servlet过滤器转换为其等效的Webflux版本?

java spring servlets spring-mvc spring-boot

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

Spring Data JPA:无法从另一个线程找到插入的实体

我在主线程中插入一个实体,然后在另一个线程中尝试modifiedAt通过 Spring JPA 存储库的 JPA 查询读取该插入实体的字段 ()。

interface SettlementRepository : JpaRepository<Settlement, Long> {

    /**
     * Fetches the state of a settlement.
     */
    @Query("SELECT s.modifiedAt FROM Settlement s WHERE s.id = :id")
    fun findModifiedAtById(id: Long): Instant
}

/* ... */

val transactionTemplate = TransactionTemplate(transactionManager)

val settlements: List<Settlement> = transactionTemplate.execute {
    amounts.map {
        settlementRepository.save(Settlement(...))
    }
}!!

val executorService = Executors.newFixedThreadPool(4)

settlements.forEach {
    executorService.execute {
        val lastModified = settlementRepository.findModifiedAtById(it.id)
        // But sometimes EmptyResultDataAccessException throws!
    }
}

Run Code Online (Sandbox Code Playgroud)

插入是在事务中完成的TransactionTemplate,并且必须在数据库(PostgreSQL)中持久化和刷新,但有时(并非总是)EmptyResultDataAccessException抛出异常。 …

hibernate jpa pgpool spring-data-jpa kotlin

5
推荐指数
0
解决办法
476
查看次数

与 Play 框架一起使用的 JMS/ActiveMQ 异常

我正在开发一个使用 ActiveMQ 和 Play Framework v2.4.2(Java 版)向最终用户发送电子邮件的消息传递系统。我是 JMS/ActiveMQ 技术的新手。我刚刚在 ActiveMQ 站点上使用了这个 Hello World 示例作为起点。

我创建了一个如下的测试类来测试使用 Play Framework 运行 ActiveMQ,一切正常:

public class ActiveMQMailApp {

    public static void main(String[] args) throws Exception {
        setup();
        MailConsumer.initService();
        for (int i =0;i<11;i++) MailProducer.sendMail(fakeMail());
    }
    public static void setup(){
        FakeApplication fakeApplication = Helpers.fakeApplication();
        Helpers.start(fakeApplication);
    }

    private static Mail fakeMail() throws InterruptedException {
        Thread.sleep(1000);
        SimpleDateFormat sdf = new SimpleDateFormat("YYYY-MM-dd  hh:mm:ss");
        return new Mail( "noreply@abc.com", "receiver@gmail.com", "A Test Email", "<html><body><p>Date: <b> "+sdf.format(new Date())+" </b></p></body></html>");
    }

} …
Run Code Online (Sandbox Code Playgroud)

java activemq-classic jms playframework

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