0

I have two endpoints:

 <cxf:cxfEndpoint address="http://localhost:9090/fileTransferService" id="FileTransferServiceEndpoint" serviceClass="FileTransferService">
     <cxf:properties>
           <entry key="dataFormat" value="POJO"/>
           <entry key="loggingFeatureEnabled" value="true"/>
     </cxf:properties>
 </cxf:cxfEndpoint>
 <cxf:cxfEndpoint address="http://localhost:9090/cardPaymentService" id="PaymentServiceServiceEndpoint" serviceClass="CardPayment">
     <cxf:properties>
           <entry key="dataFormat" value="POJO"/>
           <entry key="loggingFeatureEnabled" value="true"/>
     </cxf:properties>
 </cxf:cxfEndpoint>
  • Route for file transfer service

    <from id="from1" uri="cxf:bean:FileTransferServiceEndpoint"/>
    ...
    
  • Route for cardPaymentService

    <from id="from2" uri="cxf:bean:PaymentServiceServiceEndpoint"/>
    ...
    

Each endpoint is used in each route from some client. When my spying application loaded the routes, I cannot find the web services of cardPaymentService. But I can find the web services for fileTransferServices.

I want to provide multiple web services. How do I configure my route?

Thank you.

Usman Khan
  • 3,739
  • 6
  • 41
  • 89
이성규
  • 125
  • 11
  • To help you better, could you please provide more details, including what version of Apache Camel are you using, more details of the route and the full stack trace of the error? – ShellDragon Nov 11 '19 at 10:53

2 Answers2

0

I use camel version 2.23.2.

After loading routes, I found only one web services. And when I reload the application, I found below exception.

         [2019-11-11 23:31:21.644][Thread-30 (182)][INFO ][o.e.j.s.h.ContextHandler] Stopped o.e.j.s.h.ContextHandler@aadbe9e{/,null,UNAVAILABLE}
         [2019-11-11 23:31:21.644][Thread-30 (182)][INFO ][o.e.j.s.h.ContextHandler] Stopped o.e.j.s.h.ContextHandler@1cf96cd{/,null,UNAVAILABLE}
         [2019-11-11 23:31:21.651][Thread-30 (182)][INFO ][o.e.j.s.AbstractConnector] Stopped ServerConnector@34ff8753{HTTP/1.1,[http/1.1]}{localhost:9090}
         java.lang.NullPointerException
           at org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine.stop(JettyHTTPServerEngine.java:1040)
           at org.apache.cxf.transport.http_jetty.JettyHTTPServerEngineFactory.destroyForPort(JettyHTTPServerEngineFactory.java:318)
           at org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine.shutdown(JettyHTTPServerEngine.java:210)
           at org.apache.cxf.transport.http_jetty.JettyHTTPServerEngineFactory.postShutdown(JettyHTTPServerEngineFactory.java:372)
           at org.apache.cxf.transport.http_jetty.JettyHTTPServerEngineFactory$JettyBusLifeCycleListener.postShutdown(JettyHTTPServerEngineFactory.java:155)
           at org.apache.cxf.bus.managers.CXFBusLifeCycleManager.postShutdown(CXFBusLifeCycleManager.java:110)
           at org.apache.cxf.bus.extension.ExtensionManagerBus.shutdown(ExtensionManagerBus.java:306)
           at org.apache.cxf.bus.extension.ExtensionManagerBus.shutdown(ExtensionManagerBus.java:282)
           at org.apache.cxf.bus.spring.SpringBus.onApplicationEvent(SpringBus.java:109)
           at org.apache.cxf.bus.spring.SpringBus$1.onApplicationEvent(SpringBus.java:58)
           at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
           at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
           at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
           at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:402)
           at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:359)
           at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1009)
           at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:975)
           at target.atom.engine.TargetAtomEngineApplication.lambda$0(TargetAtomEngineApplication.java:100)
           at java.base/java.lang.Thread.run(Thread.java:834)

Below is the log during loading application.

          [2019-11-11 23:31:26.849][Thread-30 (182)][INFO ][o.a.c.w.s.f.ReflectionServiceFactoryBean] Creating Service {http://transfer.file.ws.van.processor.targetline/}FileTransferService from class targetline.processor.van.ws.file.transfer.FileTransferService
          [2019-11-11 23:31:26.901][Thread-30 (182)][INFO ][o.a.c.e.ServerImpl] Setting the server's publish address to be http://localhost:9090/fileTransferService
          [2019-11-11 23:31:26.922][Thread-30 (182)][INFO ][o.a.c.w.s.f.ReflectionServiceFactoryBean] Creating Service {http://payment.ws.van.processor.targetline/}CardPayment from class targetline.processor.van.ws.payment.CardPayment
          [2019-11-11 23:31:26.992][Thread-30 (182)][INFO ][o.a.c.e.ServerImpl] Setting the server's publish address to be http://localhost:9090/cardPaymentService
          [2019-11-11 23:31:27.011][Thread-30 (182)][INFO ][o.e.j.s.Server] jetty-9.4.19.v20190610; built: 2019-06-10T16:30:51.723Z; git: afcf563148970e98786327af5e07c261fda175d3; jvm 11.0.2+9
          [2019-11-11 23:31:27.017][Thread-30 (182)][INFO ][o.e.j.s.AbstractConnector] Started ServerConnector@4d6e2c22{HTTP/1.1,[http/1.1]}{localhost:9090}
          [2019-11-11 23:31:27.017][Thread-30 (182)][INFO ][o.e.j.s.Server] Started @383149ms
          [2019-11-11 23:31:27.017][Thread-30 (182)][WARN ][o.e.j.s.h.ContextHandler] Empty contextPath

restart function

       public static void restart() {
          ApplicationArguments args = context.getBean(ApplicationArguments.class);

          Thread thread = new Thread(() -> {
           context.close();
           context = SpringApplication.run(TargetAtomEngineApplication.class, args.getSourceArgs());
    });

          thread.setDaemon(false);
          thread.start();   
}
이성규
  • 125
  • 11
0

I think you have to use two distinct ports (eg 9090 and 9091)- one per service.

TacheDeChoco
  • 3,683
  • 1
  • 14
  • 17