Camunda behind Spring Cloud Gateway not returning CSS files for cockpit - camunda

I have a Camunda instance embedded within a Spring Boot app (called service-workflow) that starts on a dynamic port, registered with Spring Cloud via Eureka.
The main class for the Camunda service is simply:
#EnableDiscoveryClient
#SpringBootApplication
#EnableConfigurationProperties(ServiceContextConfig.class)
public class WorkflowServiceApplication {
public static void main(String[] args) {
SpringApplication.run(WorkflowServiceApplication.class, args);
}
}
And the configuration properties:
server.port=0
eureka.client.healthcheck.enabled=true
The services sit behind a local Spring Cloud Gateway running on port that uses Eureka to register the host - and is accessible and routing via http://localhost:8080
The code for the gateway is:
#SpringBootApplication
#EnableDiscoveryClient
public class GatewayServiceApplication {
public static void main(String[] args) {
SpringApplication.run(GatewayServiceApplication.class, args);
}
}
And the configuration properties:
server.port=8080
spring.cloud.gateway.discovery.locator.enabled=true
spring.cloud.gateway.discovery.locator.lowerCaseServiceId=true
There are no routes defined - it relies purely on Eureka to find the routes. This works without issues for the REST connectivity.
Any client using the runtimeService, can start a workflow using feign with the URL:
feign.client.config.remoteRuntimeService.url=service-workflow/rest/
Therefore, the workflow service is reachable via the gateway URL for REST APIs.
When the Camunda service starts, and gets assigned port x, I can view the cockpit by http://localhost:x/app/cockpit/default/
However, if I try through the gateway i.e., http://localhost:8080/service-workflow/app/cockpit/default/ it fails to return any CSS files - the gateway log shows:
2020-09-25 16:46:00,454 DEBUG [reactor-http-nio-2] reactor.netty.http.server.HttpServer (Loggers.java:254) - [id: 0xe08516d1, L:/0:0:0:0:0:0:0:1:8080 - R:/0:0:0:0:0:0:0:1:61018] Handler is being applied: org.springframework.http.server.reactive.ReactorHttpHandlerAdapter#74cedfb5
2020-09-25 16:46:00,453 DEBUG [reactor-http-nio-8] org.springframework.web.server.adapter.HttpWebHandlerAdapter (LogFormatUtils.java:91) - [9407161c-27] HTTP GET "/app/cockpit/styles/styles.css?bust=7.12.0"
2020-09-25 16:46:00,456 DEBUG [reactor-http-nio-2] org.springframework.web.server.adapter.HttpWebHandlerAdapter (LogFormatUtils.java:91) - [e08516d1-28] HTTP GET "/app/cockpit/styles/user-styles.css?bust=7.12.0"
2020-09-25 16:46:00,455 DEBUG [reactor-http-nio-7] reactor.netty.http.server.HttpServer (Loggers.java:254) - [id: 0x125a09dc, L:/0:0:0:0:0:0:0:1:8080 - R:/0:0:0:0:0:0:0:1:61253] Handler is being applied: org.springframework.http.server.reactive.ReactorHttpHandlerAdapter#74cedfb5
2020-09-25 16:46:00,458 DEBUG [reactor-http-nio-8] org.springframework.web.reactive.handler.SimpleUrlHandlerMapping (AbstractHandlerMapping.java:183) - [9407161c-27] Mapped to ResourceWebHandler ["classpath:/META-INF/resources/", "classpath:/resources/", "classpath:/static/", "classpath:/public/"]
2020-09-25 16:46:00,460 DEBUG [reactor-http-nio-7] org.springframework.web.server.adapter.HttpWebHandlerAdapter (LogFormatUtils.java:91) - [125a09dc-29] HTTP GET "/app/cockpit/styles/styles-components.css?bust=7.12.0"
2020-09-25 16:46:00,460 DEBUG [reactor-http-nio-2] org.springframework.web.reactive.handler.SimpleUrlHandlerMapping (AbstractHandlerMapping.java:183) - [e08516d1-28] Mapped to ResourceWebHandler ["classpath:/META-INF/resources/", "classpath:/resources/", "classpath:/static/", "classpath:/public/"]
2020-09-25 16:46:00,463 DEBUG [reactor-http-nio-8] org.springframework.web.reactive.resource.ResourceWebHandler (ResourceWebHandler.java:324) - [9407161c-27] Resource not found
2020-09-25 16:46:00,464 DEBUG [reactor-http-nio-7] org.springframework.web.reactive.handler.SimpleUrlHandlerMapping (AbstractHandlerMapping.java:183) - [125a09dc-29] Mapped to ResourceWebHandler ["classpath:/META-INF/resources/", "classpath:/resources/", "classpath:/static/", "classpath:/public/"]
2020-09-25 16:46:00,465 DEBUG [reactor-http-nio-2] org.springframework.web.reactive.resource.ResourceWebHandler (ResourceWebHandler.java:324) - [e08516d1-28] Resource not found
2020-09-25 16:46:00,466 DEBUG [reactor-http-nio-7] org.springframework.web.reactive.resource.ResourceWebHandler (ResourceWebHandler.java:324) - [125a09dc-29] Resource not found
2020-09-25 16:46:00,469 DEBUG [reactor-http-nio-2] org.springframework.boot.autoconfigure.web.reactive.error.AbstractErrorWebExceptionHandler (CompositeLog.java:147) - [e08516d1-28] Resolved [ResponseStatusException: 404 NOT_FOUND] for HTTP GET /app/cockpit/styles/user-styles.css
2020-09-25 16:46:00,468 DEBUG [reactor-http-nio-8] org.springframework.boot.autoconfigure.web.reactive.error.AbstractErrorWebExceptionHandler (CompositeLog.java:147) - [9407161c-27] Resolved [ResponseStatusException: 404 NOT_FOUND] for HTTP GET /app/cockpit/styles/styles.css
2020-09-25 16:46:00,476 DEBUG [reactor-http-nio-2] org.springframework.core.codec.CharSequenceEncoder (CompositeLog.java:147) - [e08516d1-28] Writing "<html><body><h1>Whitelabel Error Page</h1><p>This application has no configured error view, so you (truncated)...
2020-09-25 16:46:00,479 DEBUG [reactor-http-nio-7] org.springframework.boot.autoconfigure.web.reactive.error.AbstractErrorWebExceptionHandler (CompositeLog.java:147) - [125a09dc-29] Resolved [ResponseStatusException: 404 NOT_FOUND] for HTTP GET /app/cockpit/styles/styles-components.css
2020-09-25 16:46:00,477 DEBUG [reactor-http-nio-8] org.springframework.core.codec.CharSequenceEncoder (CompositeLog.java:147) - [9407161c-27] Writing "<html><body><h1>Whitelabel Error Page</h1><p>This application has no configured error view, so you (truncated)...
2020-09-25 16:46:00,480 DEBUG [reactor-http-nio-7] org.springframework.core.codec.CharSequenceEncoder (CompositeLog.java:147) - [125a09dc-29] Writing "<html><body><h1>Whitelabel Error Page</h1><p>This application has no configured error view, so you (truncated)...
2020-09-25 16:46:00,480 DEBUG [reactor-http-nio-2] reactor.netty.http.server.HttpServerOperations (Loggers.java:254) - [id: 0xe08516d1, L:/0:0:0:0:0:0:0:1:8080 - R:/0:0:0:0:0:0:0:1:61018] Decreasing pending responses, now 0

The way I eventually solved this was to add a custom route in the gateway:
.route("camunda", r -> r.path("/camunda/**")
//.filters(f -> f.rewritePath("/report/(?<segment>.*)", "/${segment}"))
.uri("lb://my-camunda-service"))

Related

WSO2 unit testing Mock Service is not working

I`m using the 2SO2 integration studio version is 8.0.0.
I tried to write junit suite test for my app using mock-service for my endpoint.
But when I tried to run the test I got the next failed :
My mock-service is set up with port = 9090 ( i do not know it`s right or not, this port i found in documentation by wso2 : https://ei.docs.wso2.com/en/7.2.0/micro-integrator/develop/creating-unit-test-suite/):
Test is :
<unit-test>
<artifacts>
<test-artifact>
<artifact>/LmaAPIConfigs/src/main/synapse-config/api/LmaAPI.xml</artifact>
</test-artifact>
<supportive-artifacts/>
<registry-resources/>
<connector-resources/>
</artifacts>
<test-cases>
<test-case name="TestMock">
<input>
<request-path>/currency</request-path>
<request-method>POST</request-method>
<request-protocol>http</request-protocol>
<payload><![CDATA[{"currency": "USD"}]]></payload>
<properties>
<property name="Content-Type" scope="transport" value="application/json"/>
</properties>
</input>
<assertions>
<assertEquals>
<actual>$body</actual>
<expected><![CDATA[<jsonObject><r030>840</r030><txt>Долар США</txt><rate>36.5686</rate><cc>USD</cc><exchangedate>]]></expected>
<message>not equals</message>
</assertEquals>
<assertNotNull>
<actual>$body</actual>
<message>body is null</message>
</assertNotNull>
</assertions>
</test-case>
</test-cases>
<mock-services>
<mock-service>/LmaAPI/LmaAPIConfigs/test/resources/mock-services/Exchange.xml</mock-service>
</mock-services>
</unit-test>
The logs from wso2carbon.log file :
[2022-09-19 08:49:43,467] INFO {org.apache.synapse.unittest.UnitTestingExecutor} - Start processing test-case handler
[2022-09-19 08:49:43,467] INFO {org.apache.synapse.unittest.UnitTestingExecutor} - Unit testing agent checks transport Pass-through HTTP Listener port
[2022-09-19 08:49:43,487] INFO {org.apache.synapse.transport.passthru.core.PassThroughListeningIOReactorManager} - Pass-through EI_INTERNAL_HTTPS_INBOUND_ENDPOINT Listener started on 0:0:0:0:0:0:0:0:9164
[2022-09-19 08:49:43,495] INFO {org.apache.synapse.unittest.SynapseTestcaseDataReader} - Artifact data from descriptor data read successfully
[2022-09-19 08:49:43,495] INFO {org.apache.synapse.unittest.SynapseTestcaseDataReader} - Test case data from descriptor data read successfully
[2022-09-19 08:49:43,497] INFO {org.apache.synapse.unittest.SynapseTestcaseDataReader} - Mock service data from descriptor data read successfully
[2022-09-19 08:49:43,498] INFO {org.apache.synapse.unittest.ConfigModifier} - Mock service creator ready to start service for Exchange
[2022-09-19 08:49:43,530] INFO {org.apache.synapse.unittest.MockServiceCreator} - Mock service started for Exchange in - http://localhost:9090/get-nbu-exchange
[2022-09-19 08:49:43,530] INFO {org.apache.synapse.unittest.ConfigModifier} - Thread waiting for mock service(s) starting
[2022-09-19 08:49:43,609] ERROR {org.apache.synapse.unittest.UnitTestingExecutor} - Failed to get input stream from TCP connection java.io.EOFException
at java.base/java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2842)
at java.base/java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:3337)
at java.base/java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:925)
at java.base/java.io.ObjectInputStream.<init>(ObjectInputStream.java:368)
at org.apache.synapse.unittest.RequestHandler.readData(RequestHandler.java:112)
at org.apache.synapse.unittest.RequestHandler.run(RequestHandler.java:74)
at java.base/java.lang.Thread.run(Thread.java:834)
[2022-09-19 08:49:43,609] ERROR {org.apache.synapse.unittest.UnitTestingExecutor} - Error while reading data from received message java.lang.NullPointerException
at org.apache.synapse.unittest.SynapseTestcaseDataReader.readAndStoreArtifactData(SynapseTestcaseDataReader.java:148)
at org.apache.synapse.unittest.RequestHandler.preProcessingData(RequestHandler.java:137)
at org.apache.synapse.unittest.RequestHandler.run(RequestHandler.java:80)
at java.base/java.lang.Thread.run(Thread.java:834)
[2022-09-19 08:49:43,609] ERROR {org.apache.synapse.unittest.UnitTestingExecutor} - Reading Synapse testcase data failed
[2022-09-19 08:49:43,609] ERROR {org.apache.synapse.unittest.UnitTestingExecutor} - Error while running client request in test agent java.net.SocketException: Software caused connection abort: socket write error
at java.base/java.net.SocketOutputStream.socketWrite0(Native Method)
at java.base/java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:110)
at java.base/java.net.SocketOutputStream.write(SocketOutputStream.java:150)
at java.base/java.io.ObjectOutputStream$BlockDataOutputStream.drain(ObjectOutputStream.java:1883)
at java.base/java.io.ObjectOutputStream$BlockDataOutputStream.setBlockDataMode(ObjectOutputStream.java:1792)
at java.base/java.io.ObjectOutputStream.writeNonProxyDesc(ObjectOutputStream.java:1287)
at java.base/java.io.ObjectOutputStream.writeClassDesc(ObjectOutputStream.java:1232)
at java.base/java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1428)
at java.base/java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1179)
at java.base/java.io.ObjectOutputStream.writeFatalException(ObjectOutputStream.java:1583)
at java.base/java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:352)
at org.apache.synapse.unittest.RequestHandler.writeData(RequestHandler.java:238)
at org.apache.synapse.unittest.RequestHandler.run(RequestHandler.java:92)
at java.base/java.lang.Thread.run(Thread.java:834)
[2022-09-19 08:49:43,830] INFO {io.netty.handler.logging.LoggingHandler} - [id: 0x00a2ce58] REGISTERED
[2022-09-19 08:49:43,830] INFO {io.netty.handler.logging.LoggingHandler} - [id: 0x00a2ce58] BIND: localhost/127.0.0.1:9090
[2022-09-19 08:49:43,830] INFO {io.netty.handler.logging.LoggingHandler} - [id: 0x00a2ce58, L:/127.0.0.1:9090] ACTIVE
[2022-09-19 08:49:44,040] INFO {org.apache.synapse.unittest.ConfigModifier} - Mock service(s) are started with given ports
[2022-09-19 08:49:44,042] INFO {org.apache.synapse.unittest.UnitTestingExecutor} - Main test artifact deployment started
[2022-09-19 08:49:44,042] INFO {io.netty.handler.logging.LoggingHandler} - [id: 0x00a2ce58, L:/127.0.0.1:9090] READ: [id: 0x7fabaabd, L:/127.0.0.1:9090 - R:/127.0.0.1:61051]
[2022-09-19 08:49:44,042] INFO {io.netty.handler.logging.LoggingHandler} - [id: 0x00a2ce58, L:/127.0.0.1:9090] READ COMPLETE
[2022-09-19 08:49:44,326] INFO {org.apache.synapse.api.API} - {api:LmaAPI} Initializing API: LmaAPI
[2022-09-19 08:49:44,326] INFO {org.apache.synapse.core.axis2.Axis2SynapseEnvironment} - Continuation call is set to true
[2022-09-19 08:49:44,326] INFO {org.apache.synapse.deployers.APIDeployer} - API named 'LmaAPI' has been deployed from file : LmaAPI
[2022-09-19 08:49:44,326] INFO {org.apache.synapse.unittest.TestingAgent} - Primary test API artifact deployed successfully
[2022-09-19 08:49:44,326] INFO {org.apache.synapse.unittest.UnitTestingExecutor} - Synapse testing agent ready to mediate test cases through deployments
[2022-09-19 08:49:44,326] INFO {org.apache.synapse.unittest.TestingAgent} - 1 Test case(s) ready to execute
[2022-09-19 08:49:44,326] INFO {org.apache.synapse.unittest.UnitTestingExecutor} - Invoking URI - http://localhost:8290/lma/currency
[2022-09-19 08:49:44,467] INFO {org.apache.synapse.mediators.builtin.LogMediator} - {api:LmaAPI} uri.var.currency = USD
[2022-09-19 08:49:44,472] INFO {org.apache.synapse.mediators.builtin.LogMediator} - {api:LmaAPI} To: /lma/currency, MessageID: urn:uuid:898e7062-97b1-4179-a6d0-a3a63106455f, correlation_id: 898e7062-97b1-4179-a6d0-a3a63106455f, Direction: request, LmaAPI_currency = ERROR RESPONSE, Payload: {"currency": "USD"}
[2022-09-19 08:49:44,498] INFO {org.apache.synapse.unittest.Assertor} - Assert Equals - assert property for services started
[2022-09-19 08:49:44,514] INFO {org.apache.synapse.unittest.Assertor} - Service Assert Expression - $body
[2022-09-19 08:49:44,514] INFO {org.apache.synapse.unittest.Assertor} - Service mediated result for Actual - <jsonObject><currency>USD</currency></jsonObject>
[2022-09-19 08:49:44,514] INFO {org.apache.synapse.unittest.Assertor} - Service Assert Expected - <jsonObject><r030>840</r030><txt>ДоларСША</txt><rate>36.5686</rate><cc>USD</cc></jsonObject>
[2022-09-19 08:49:44,514] ERROR {org.apache.synapse.unittest.Assertor} - Service assertEquals for $body expression failed with a message - not equals
[2022-09-19 08:49:44,514] ERROR {org.apache.synapse.unittest.Assertor} - Unit testing failed for the test case - TestMock
[2022-09-19 08:49:44,514] INFO {org.apache.synapse.deployers.APIDeployer} - API named 'LmaAPI' has been undeployed
[2022-09-19 08:49:44,514] INFO {org.apache.synapse.api.API} - {api:LmaAPI} Destroying API: LmaAPI
[2022-09-19 08:49:44,514] INFO {org.apache.synapse.core.axis2.Axis2SynapseEnvironment} - Continuation call is set to false
[2022-09-19 08:49:44,514] INFO {org.apache.synapse.unittest.TestingAgent} - Undeployed all the deployed test and supportive artifacts
[2022-09-19 08:49:44,514] INFO {io.netty.handler.logging.LoggingHandler} - [id: 0x00a2ce58, L:/127.0.0.1:9090] INACTIVE
[2022-09-19 08:49:44,514] INFO {io.netty.handler.logging.LoggingHandler} - [id: 0x00a2ce58, L:/127.0.0.1:9090] UNREGISTERED
[2022-09-19 08:49:44,521] INFO {org.apache.synapse.commons.emulator.core.Emulator} - Emulator shutdown successfully.......
[2022-09-19 08:49:44,521] INFO {org.apache.synapse.unittest.UnitTestingExecutor} - End processing test-case handler
My synapse artefacts :
My API :
My EP :
Mock Service port is simply a port you want your Mock service to start on, this can be any arbitrary port that is not occupied by any other service. So in your case, if any other service is not using the port 9090 you can use this. As you can see here in the code, a new Emulator will be started with this port and the context you are providing to facilitate mocking.
When you create a Mock service, you will be mocking an Endpoint. So I assume you already have an Endpoint Defined, and trying to mock this. If that's the case you need to add that Endpoint to the <supportive-artifacts/> section, in your Test Suite. Something like the below.
<supportive-artifacts>
<artifact>PATH_TO_ENDPOINT</artifact>
</supportive-artifacts>
I'm not exactly sure why you are getting a Received status code - 202 as the response. But it typically means your integration is unable to run.(Probably due to the missing endpoint). Also, it's important to note that all the detailed logs will be logged on the server side. So you won't be able to figure out what's happening by just looking at the Maven log. For example, as you can see here the server should log a message when your mock service is started. So make sure you check the server-side logs to identify any issues. If you are just executing from Integration Studio, the logs are located at <INTEGRATION_STUDIO_HOME>/runtime/microesb/repository/logs/wso2carbon.log
Integration Studio 8.0.0 was having some bugs related to the unit testing and mock services. AFAIK the issue you observed (Receiving a 202 status code) and the one #ycr have mentioned (Missing endpoint config in the <supportive-artifacts/> [1]) have been fixed in the latest Integration Studio 8.1.0.
Can you try this in the latest updated Integration Studio 8.1.0 pack? You can download the latest version from the official website. Please refer Get the latest updates to install the latest updates to Integration Studio.

[Wso2][Stream Processor][Dashbord] Running dashbord and worker in same machine

I try to run Worker and dashbord in same machine.
the first tools is running coorectly, but when i start the second the error has been raised :
[2018-03-07 09:59:43,546] INFO
{org.wso2.msf4j.internal.websocket.EndpointsRegistryImpl} - Endpoint
Registered : /server-stats/{type}
[2018-03-07 09:59:43,636] INFO {org.wso2.carbon.data.provider.DataProviderAPI} - Data Provider
Service Component is activated
[2018-03-07 09:59:44,909] INFO {org.wso2.msf4j.internal.websocket.WebSocketServerSC} - All required
capabilities are available of WebSocket service component is
available.
[2018-03-07 09:59:45,049] INFO {org.wso2.msf4j.internal.MicroservicesServerSC} - All microservices
are available
[2018-03-07 09:59:45,346] INFO {org.wso2.transport.http.netty.listener.ServerConnectorBootstrap$HTTPServerConnector}
- HTTP(S) Interface starting on host 0.0.0.0 and port 9643
[2018-03-07 09:59:45,939] INFO {org.wso2.carbon.metrics.core.config.model.JmxReporterConfig} -
Creating JMX reporter for Metrics with domain
'org.wso2.carbon.metrics'
[2018-03-07 09:59:45,954] INFO {org.wso2.carbon.metrics.core.reporter.impl.AbstractReporter} -
Started JMX reporter for Metrics
[2018-03-07 09:59:45,954] INFO {org.wso2.msf4j.analytics.metrics.MetricsComponent} - Metrics
Component is activated
[2018-03-07 09:59:45,970] INFO {org.wso2.carbon.databridge.agent.internal.DataAgentDS} - Successfully
deployed Agent Server
[2018-03-07 09:59:52,914] ERROR {org.wso2.carbon.kernel.internal.startupresolver.StartupComponentManager}
- Runtime Exception occurred while calling onAllRequiredCapabilitiesAvailable of component
carbon-datasource-service
com.zaxxer.hikari.pool.PoolInitializationException: Exception during
pool initialization: Connection is broken:
"java.net.SocketTimeoutException: connect timed out:
169.254.235.125:59336" [90067-196]
at com.zaxxer.hikari.pool.HikariPool.initializeConnections(HikariPool.java:581)
at com.zaxxer.hikari.pool.HikariPool.(HikariPool.java:152)
at com.zaxxer.hikari.HikariDataSource.(HikariDataSource.java:73)
at org.wso2.carbon.datasource.rdbms.hikari.HikariRDBMSDataSource.getDataSource(HikariRDBMSDataSource.java:56)
at org.wso2.carbon.datasource.rdbms.hikari.HikariDataSourceReader.createDataSource(HikariDataSourceReader.java:74)
at org.wso2.carbon.datasource.core.DataSourceBuilder.buildDataSourceObject(DataSourceBuilder.java:79)
at org.wso2.carbon.datasource.core.DataSourceBuilder.buildDataSourceObject(DataSourceBuilder.java:60)
at org.wso2.carbon.datasource.core.DataSourceBuilder.buildCarbonDataSource(DataSourceBuilder.java:44)
at org.wso2.carbon.datasource.core.DataSourceManager.initDataSources(DataSourceManager.java:153)
at org.wso2.carbon.datasource.core.internal.DataSourceListenerComponent.onAllRequiredCapabilitiesAvailable(DataSourceListenerComponent.java:125)
at org.wso2.carbon.kernel.internal.startupresolver.StartupComponentManager.lambda$notifySatisfiableComponents$7(StartupComponentManager.java:266)
at java.util.ArrayList.forEach(ArrayList.java:1249)
at org.wso2.carbon.kernel.internal.startupresolver.StartupComponentManager.notifySatisfiableComponents(StartupComponentManager.java:252)
at org.wso2.carbon.kernel.internal.startupresolver.StartupOrderResolver$1.run(StartupOrderResolver.java:204)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
Caused by: org.h2.jdbc.JdbcSQLException: Connection is broken: "java.net.SocketTimeoutException: connect timed out:
169.254.235.125:59336" [90067-196]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
at org.h2.message.DbException.get(DbException.java:168)
at org.h2.engine.SessionRemote.connectServer(SessionRemote.java:457)
at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:367)
at org.h2.jdbc.JdbcConnection.(JdbcConnection.java:116)
at org.h2.jdbc.JdbcConnection.(JdbcConnection.java:100)
at org.h2.Driver.connect(Driver.java:69)
at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:95)
at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:101)
at com.zaxxer.hikari.pool.HikariPool.addConnection(HikariPool.java:496)
at com.zaxxer.hikari.pool.HikariPool.initializeConnections(HikariPool.java:565)
... 15 more
Caused by: java.net.SocketTimeoutException: connect timed out
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at org.h2.util.NetUtils.createSocket(NetUtils.java:103)
at org.h2.util.NetUtils.createSocket(NetUtils.java:83)
at org.h2.engine.SessionRemote.initTransfer(SessionRemote.java:115)
at org.h2.engine.SessionRemote.connectServer(SessionRemote.java:453)
... 23 more
can you please advise?
Thanks.
Can you share the WSO2 SP version you were using when you got this exception?
Also please check whether the AUTO_SERVER=TRUE
config is avaiable in the jdbc url of WSO2_METRICS_DB datasource configuration, which can be found in
{WSO2_SP_HOME}/conf/worker/deployment.yaml
eg :
jdbcUrl: 'jdbc:h2:${sys:carbon.home}/wso2/dashboard/database/metrics;AUTO_SERVER=TRUE'
I configured all datasource in mysql, and i can running all SP componnent.
the issue is related to H2 datasase, that not allowed to share connection with default configuration.
i will check default H2 connection parametrs, and test again.

Change default port 5672 for WSO2-API Manager

We already have Active MQ running on the server. As a result we are getting port conflict when running WSO2. Where can we change the port to avoid this conflict.
So far we have done the following:
1. Searched for references for port 5672 under /repository/conf and changed 5672 to 5673. Files changed included broker and jndi.
Looks like the conflict is resolved but some services are still trying to connect to port 5672. I have not been able to find where to change this.
[2017-02-03 08:37:36,342] INFO - QpidServiceComponent WSO2 Message Broker is started.
[2017-02-03 08:37:36,374] INFO - JMSConnectionFactory JMS ConnectionFactory : Siddhi-JMS-Consumer initialized
[2017-02-03 08:37:36,379] INFO - JMSTransportHandler Starting jms topic consumer thread...
[2017-02-03 08:37:36,800] INFO - PassThroughHttpListener Starting Pass-through HTTP Listener...
[2017-02-03 08:37:36,811] INFO - PassThroughListeningIOReactorManager Pass-through HTTP Listener started on 0:0:0:0:0:0:0:0:8280
[2017-02-03 08:37:36,815] INFO - PassThroughHttpSSLListener Starting Pass-through HTTPS Listener...
[2017-02-03 08:37:36,825] INFO - PassThroughListeningIOReactorManager Pass-through HTTPS Listener started on 0:0:0:0:0:0:0:0:8243
[2017-02-03 08:37:37,669] INFO - AMQConnection Unable to connect to broker at tcp://172.17.51.124:5672
org.wso2.andes.transport.TransportException: Could not open connection
at org.wso2.andes.transport.network.mina.MinaNetworkTransport$IoConnectorCreator.connect(MinaNetworkTransport.java:216)
at org.wso2.andes.transport.network.mina.MinaNetworkTransport.connect(MinaNetworkTransport.java:74)
at org.wso2.andes.client.AMQConnectionDelegate_8_0.makeBrokerConnection(AMQConnectionDelegate_8_0.java:130)
at org.wso2.andes.client.AMQConnection$2.run(AMQConnection.java:631)
at org.wso2.andes.client.AMQConnection$2.run(AMQConnection.java:628)
at java.security.AccessController.doPrivileged(Native Method)
at org.wso2.andes.client.AMQConnection.makeBrokerConnection(AMQConnection.java:628)
at org.wso2.andes.client.AMQConnection.<init>(AMQConnection.java:409)
at org.wso2.andes.client.AMQConnectionFactory.createConnection(AMQConnectionFactory.java:351)
at org.wso2.andes.client.AMQConnectionFactory.createConnection(AMQConnectionFactory.java:40)
at org.wso2.carbon.apimgt.jms.listener.utils.JMSUtils.createConnection(JMSUtils.java:387)
at org.wso2.carbon.apimgt.jms.listener.utils.JMSListener.checkJMSConnection(JMSListener.java:137)
at org.wso2.carbon.apimgt.jms.listener.utils.JMSListener.start(JMSListener.java:79)
at org.wso2.carbon.apimgt.jms.listener.utils.JMSListener.run(JMSListener.java:186)
at java.lang.Thread.run(Thread.java:745)
org.wso2.andes.AMQConnectionFailureException: Could not open connection
at org.wso2.andes.client.AMQConnection.<init>(AMQConnection.java:486)
at org.wso2.andes.client.AMQConnectionFactory.createConnection(AMQConnectionFactory.java:351)
at org.wso2.andes.client.AMQConnectionFactory.createConnection(AMQConnectionFactory.java:40)
at org.wso2.carbon.apimgt.jms.listener.utils.JMSUtils.createConnection(JMSUtils.java:387)
at org.wso2.carbon.apimgt.jms.listener.utils.JMSListener.checkJMSConnection(JMSListener.java:137)
at org.wso2.carbon.apimgt.jms.listener.utils.JMSListener.start(JMSListener.java:79)
at org.wso2.carbon.apimgt.jms.listener.utils.JMSListener.run(JMSListener.java:186)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.wso2.andes.transport.TransportException: Could not open connection
at org.wso2.andes.transport.network.mina.MinaNetworkTransport$IoConnectorCreator.connect(MinaNetworkTransport.java:216)
at org.wso2.andes.transport.network.mina.MinaNetworkTransport.connect(MinaNetworkTransport.java:74)
at org.wso2.andes.client.AMQConnectionDelegate_8_0.makeBrokerConnection(AMQConnectionDelegate_8_0.java:130)
at org.wso2.andes.client.AMQConnection$2.run(AMQConnection.java:631)
at org.wso2.andes.client.AMQConnection$2.run(AMQConnection.java:628)
at java.security.AccessController.doPrivileged(Native Method)
at org.wso2.andes.client.AMQConnection.makeBrokerConnection(AMQConnection.java:628)
at org.wso2.andes.client.AMQConnection.<init>(AMQConnection.java:409)
... 7 more
[2017-02-03 08:37:37,750] ERROR - JMSListener Unable to continue server startup as it seems the JMS Provider is not yet started. Please start the JMS provider now.
[2017-02-03 08:37:37,756] ERROR - JMSListener Connection attempt : 1 for JMS Provider failed. Next retry in 20 seconds
[2017-02-03 08:37:39,373] INFO - CarbonEventManagementService Starting polling event receivers
[2017-02-03 08:37:43,411] INFO - ThriftDataReceiver Thrift Server started at 0.0.0.0
[2017-02-03 08:37:43,451] INFO - ThriftDataReceiver Thrift SSL port : 7711
[2017-02-03 08:37:43,468] INFO - ThriftDataReceiver Thrift port : 7611
We resolved this by using port offsets. No need to manually change ports.
https://docs.wso2.com/display/AM200/Changing+the+Default+Ports+with+Offset

ERROR on API Manager 2.0.0 gateway worker on start-up

The following ERROR is logged on the gateway worker nodes on start-up.
2016-08-23 12:32:42,344 [-] [Timer-5] ERROR KeyTemplateRetriever Exception when retrieving throttling data from remote endpoint
Unexpected character (<) at position 0.
at org.json.simple.parser.Yylex.yylex(Unknown Source)
at org.json.simple.parser.JSONParser.nextToken(Unknown Source)
at org.json.simple.parser.JSONParser.parse(Unknown Source)
at org.json.simple.parser.JSONParser.parse(Unknown Source)
at org.json.simple.parser.JSONParser.parse(Unknown Source)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.retrieveKeyTemplateData(KeyTemplateRetriever.java:100)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.loadKeyTemplatesFromWebService(KeyTemplateRetriever.java:111)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.run(KeyTemplateRetriever.java:54)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
Despite the error the gateway worker nodes startup and the environment can be used to successfully invoke a sample API.
All the apim nodes, bar the traffic manager, however report these warnings
2016-08-22 16:40:56,652 [-] [Timer-5] WARN KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
2016-08-22 16:40:56,653 [-] [Timer-4] WARN BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
Environment:
APIM 2.0.0 cluster
publisher (default profile)
store (default profile)
gw manager and 2 gw workers (default profiles)
traffic manager (using traffic-manager profile)
Database: MariaDB Server, wsrep_25.10.r4144
Userstore : Read/write LDAP
JVM: java version "1.8.0_92"
OS: CentOS Linux release 7.0.1406 (Core)
n.b. key manager un-configured using default pack settings
If you disable Advanced Throttling in api-manager.xml like below, that error will go away. If you enable that, it requires a key manager node.
<EnableAdvanceThrottling>false</EnableAdvanceThrottling>
I encountered the issue recently and the issue was throttle#data#v1.war (repository/deployment/server/webapps/throttle#data#v1.war) hasn't been deployed at the time worker starts up.
If you have a distributed AM 2.0 deployment make sure Keymanager is up and throttle#data#v1.war is deployed in keymanager before worker srartup..

Spark application with Jetty embedded server is not logging bubbled exceptions

It's a really basic setup, I am using slf4j-simple
I have the following route:
get("/fail", (req, res) -> {
throw new RuntimeException("fail");
}
);
As expected, it throws 500 internal error.
However, the logs show nothing about this. How can I get these bubbled exceptions to log?
These are the only logs I see:
[Thread-0] INFO org.eclipse.jetty.util.log - Logging initialized #164ms
[Thread-0] INFO spark.embeddedserver.jetty.EmbeddedJettyServer - == Spark has ignited ...
[Thread-0] INFO spark.embeddedserver.jetty.EmbeddedJettyServer - >> Listening on 0.0.0.0:4567
[Thread-0] INFO org.eclipse.jetty.server.Server - jetty-9.3.z-SNAPSHOT
[Thread-0] INFO org.eclipse.jetty.server.ServerConnector - Started ServerConnector#35eae602{HTTP/1.1,[http/1.1]}{0.0.0.0:4567}
[Thread-0] INFO org.eclipse.jetty.server.Server - Started #259ms
You may implement your log operation inside the Exception Mapper.