Tomcat and PostgreSQL #1780
-
Hi! Apache Tomcat version: 8.5.75 I've successfully used Apiman with tomcat (connecting it to elastic search and keycloak). But now I'm trying to connect all applications to PostgreSQL. I changed all the configurations in apiman.properties (gist) used by Tomcat to be like the one used by Wildfly. In each .war I added in the META-INF folder the context.xml (gist - gateway example) and in the WEB-INF folder the web.xml (gist - gateway example) but it keeps throwing this error: [ERROR] 2022-01-31 11:14:47.523 [localhost-startStop-1] [/apiman-gateway-api] - Exception sending context initialized event to listener instance of class [io.apiman.gateway.platforms.war.listeners.WarGatewayBootstrapper]
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at io.apiman.gateway.engine.impl.ConfigDrivenEngineFactory.instantiate(ConfigDrivenEngineFactory.java:241) ~[apiman-gateway-engine-core-2.1.1-SNAPSHOT.jar:?]
at io.apiman.gateway.engine.impl.ConfigDrivenEngineFactory.doInstantiate(ConfigDrivenEngineFactory.java:225) ~[apiman-gateway-engine-core-2.1.1-SNAPSHOT.jar:?]
at io.apiman.gateway.engine.impl.ConfigDrivenEngineFactory.create(ConfigDrivenEngineFactory.java:185) ~[apiman-gateway-engine-core-2.1.1-SNAPSHOT.jar:?]
at io.apiman.gateway.engine.impl.ConfigDrivenEngineFactory.createRegistry(ConfigDrivenEngineFactory.java:103) ~[apiman-gateway-engine-core-2.1.1-SNAPSHOT.jar:?]
at io.apiman.gateway.engine.impl.AbstractEngineFactory.createEngine(AbstractEngineFactory.java:56) ~[apiman-gateway-engine-core-2.1.1-SNAPSHOT.jar:?]
at io.apiman.gateway.platforms.war.WarGateway.init(WarGateway.java:55) ~[apiman-gateway-platforms-war-2.1.1-SNAPSHOT.jar:?]
at io.apiman.gateway.platforms.war.listeners.WarGatewayBootstrapper.contextInitialized(WarGatewayBootstrapper.java:42) ~[apiman-gateway-platforms-war-2.1.1-SNAPSHOT.jar:?]
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4763) [catalina.jar:8.5.75]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5232) [catalina.jar:8.5.75]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [catalina.jar:8.5.75]
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:753) [catalina.jar:8.5.75]
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:727) [catalina.jar:8.5.75]
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:695) [catalina.jar:8.5.75]
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1016) [catalina.jar:8.5.75]
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1903) [catalina.jar:8.5.75]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_202]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_202]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_202]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_202]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_202]
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_202]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_202]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_202]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_202]
at io.apiman.gateway.engine.impl.ConfigDrivenEngineFactory.instantiate(ConfigDrivenEngineFactory.java:238) ~[apiman-gateway-engine-core-2.1.1-SNAPSHOT.jar:?]
... 19 more
Caused by: java.lang.RuntimeException: javax.naming.NameNotFoundException: Name [jboss/datasources/apiman-gateway] is not bound in this Context. Unable to find [jboss].
at io.apiman.gateway.engine.jdbc.AbstractJdbcComponent.lookupDS(AbstractJdbcComponent.java:60) ~[apiman-gateway-engine-jdbc-2.1.1-SNAPSHOT.jar:?]
at io.apiman.gateway.engine.jdbc.AbstractJdbcComponent.<init>(AbstractJdbcComponent.java:43) ~[apiman-gateway-engine-jdbc-2.1.1-SNAPSHOT.jar:?]
at io.apiman.gateway.engine.jdbc.JdbcRegistry.<init>(JdbcRegistry.java:73) ~[apiman-gateway-engine-jdbc-2.1.1-SNAPSHOT.jar:?]
at io.apiman.gateway.engine.jdbc.CachingJdbcRegistry.<init>(CachingJdbcRegistry.java:50) ~[apiman-gateway-engine-jdbc-2.1.1-SNAPSHOT.jar:?]
at io.apiman.gateway.engine.jdbc.PollCachingJdbcRegistry.<init>(PollCachingJdbcRegistry.java:62) ~[apiman-gateway-engine-jdbc-2.1.1-SNAPSHOT.jar:?]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_202]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_202]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_202]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_202]
at io.apiman.gateway.engine.impl.ConfigDrivenEngineFactory.instantiate(ConfigDrivenEngineFactory.java:238) ~[apiman-gateway-engine-core-2.1.1-SNAPSHOT.jar:?]
... 19 more
Caused by: javax.naming.NameNotFoundException: Name [jboss/datasources/apiman-gateway] is not bound in this Context. Unable to find [jboss].
at org.apache.naming.NamingContext.lookup(NamingContext.java:823) ~[catalina.jar:8.5.75]
at org.apache.naming.NamingContext.lookup(NamingContext.java:171) ~[catalina.jar:8.5.75]
at org.apache.naming.SelectorContext.lookup(SelectorContext.java:161) ~[catalina.jar:8.5.75]
at javax.naming.InitialContext.lookup(InitialContext.java:417) ~[?:1.8.0_202]
at io.apiman.gateway.engine.jdbc.AbstractJdbcComponent.lookupDS(AbstractJdbcComponent.java:58) ~[apiman-gateway-engine-jdbc-2.1.1-SNAPSHOT.jar:?]
at io.apiman.gateway.engine.jdbc.AbstractJdbcComponent.<init>(AbstractJdbcComponent.java:43) ~[apiman-gateway-engine-jdbc-2.1.1-SNAPSHOT.jar:?]
at io.apiman.gateway.engine.jdbc.JdbcRegistry.<init>(JdbcRegistry.java:73) ~[apiman-gateway-engine-jdbc-2.1.1-SNAPSHOT.jar:?]
at io.apiman.gateway.engine.jdbc.CachingJdbcRegistry.<init>(CachingJdbcRegistry.java:50) ~[apiman-gateway-engine-jdbc-2.1.1-SNAPSHOT.jar:?]
at io.apiman.gateway.engine.jdbc.PollCachingJdbcRegistry.<init>(PollCachingJdbcRegistry.java:62) ~[apiman-gateway-engine-jdbc-2.1.1-SNAPSHOT.jar:?]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_202]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_202]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_202]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_202]
at io.apiman.gateway.engine.impl.ConfigDrivenEngineFactory.instantiate(ConfigDrivenEngineFactory.java:238) ~[apiman-gateway-engine-core-2.1.1-SNAPSHOT.jar:?]
... 19 more
[ERROR] 2022-01-31 11:14:47.742 [localhost-startStop-1] StandardContext - One or more listeners failed to start. Full details will be found in the appropriate container log file
[ERROR] 2022-01-31 11:14:47.743 [localhost-startStop-1] StandardContext - Context [/apiman-gateway-api] startup failed due to previous errors
[WARN ] 2022-01-31 11:14:47.792 [localhost-startStop-1] WebappClassLoaderBase - The web application [apiman-gateway-api] appears to have started a thread named [Log4j2-TF-2-AsyncLoggerConfig-1] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
sun.misc.Unsafe.park(Native Method)
java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)
com.lmax.disruptor.TimeoutBlockingWaitStrategy.waitFor(TimeoutBlockingWaitStrategy.java:38)
com.lmax.disruptor.ProcessingSequenceBarrier.waitFor(ProcessingSequenceBarrier.java:56)
com.lmax.disruptor.BatchEventProcessor.processEvents(BatchEventProcessor.java:159)
com.lmax.disruptor.BatchEventProcessor.run(BatchEventProcessor.java:125)
java.lang.Thread.run(Thread.java:748)
[WARN ] 2022-01-31 11:14:47.792 [localhost-startStop-1] WebappClassLoaderBase - The web application [apiman-gateway-api] appears to have started a thread named [Thread-5] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
sun.nio.fs.WindowsNativeDispatcher.GetQueuedCompletionStatus0(Native Method)
sun.nio.fs.WindowsNativeDispatcher.GetQueuedCompletionStatus(WindowsNativeDispatcher.java:1007)
sun.nio.fs.WindowsWatchService$Poller.run(WindowsWatchService.java:586)
java.lang.Thread.run(Thread.java:748)
[WARN ] 2022-01-31 11:14:47.792 [localhost-startStop-1] WebappClassLoaderBase - The web application [apiman-gateway-api] appears to have started a thread named [Thread-6] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
sun.misc.Unsafe.park(Native Method)
java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
java.util.concurrent.LinkedBlockingDeque.takeFirst(LinkedBlockingDeque.java:492)
java.util.concurrent.LinkedBlockingDeque.take(LinkedBlockingDeque.java:680)
sun.nio.fs.AbstractWatchService.take(AbstractWatchService.java:118)
io.apiman.common.logging.change.LogFileConfigManager.doPollingLoop(LogFileConfigManager.java:107)
io.apiman.common.logging.change.LogFileConfigManager.lambda$watch$0(LogFileConfigManager.java:82)
io.apiman.common.logging.change.LogFileConfigManager$$Lambda$37/877046501.run(Unknown Source)
java.lang.Thread.run(Thread.java:748)
[INFO ] 2022-01-31 11:14:47.807 [localhost-startStop-1] HostConfig - Deployment of web application archive [C:\Users\lpeni\Documents\GlobalWeb\Cloud\apache-tomcat-8.5.75\webapps\apiman-gateway-api.war] has finished in [15,711] ms
[INFO ] 2022-01-31 11:14:47.808 [localhost-startStop-1] HostConfig - Deploying web application archive [C:\Users\lpeni\Documents\GlobalWeb\Cloud\apache-tomcat-8.5.75\webapps\apiman-gateway.war] There is something that is wrong or is missing? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I resolved by changing |
Beta Was this translation helpful? Give feedback.
I resolved by changing
java:jboss/datasources/apiman-gateway
tojava:comp/env/jboss/datasources/apiman-manager
andjava:jboss/datasources/apiman-manager
tojava:comp/env/jboss/datasources/apiman-manager
in application.properties.