CAS cas-overlay-template - cas

Spent quite a few days troubleshooting and building 6.4.4.2 from https://github.com/apereo/cas-overlay-template
Not wanting to question the build process I accepted the instructions and created my cas.war file which I promptly deployed to the appropriately supported tomcat server.
I kept on getting the following error NO matter what I did, I even tried adding the appropriate libraries to the tomcat build.
...
85816a86ca0b_tomcat | Caused by: java.lang.NoClassDefFoundError: org/springframework/boot/actuate/info/JavaInfoContributor
85816a86ca0b_tomcat | at java.lang.Class.getDeclaredMethods0(Native Method) ~[?:?]
85816a86ca0b_tomcat | at java.lang.Class.privateGetDeclaredMethods(Class.java:3166) ~[?:?]
85816a86ca0b_tomcat | at java.lang.Class.getDeclaredMethods(Class.java:2309) ~[?:?]
85816a86ca0b_tomcat | at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:463) ~[spring-core-5.3.9.jar:5.3.9]
85816a86ca0b_tomcat | at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:358) ~[spring-core-5.3.9.jar:5.3.9]
85816a86ca0b_tomcat | at org.springframework.util.ReflectionUtils.getUniqueDeclaredMethods(ReflectionUtils.java:414) ~[spring-core-5.3.9.jar:5.3.9]
85816a86ca0b_tomcat | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.lambda$getTypeForFactoryMethod$2(AbstractAutowireCapableBeanFactory.java:747) ~[spring-beans-5.3.9.jar:5.3.9]
85816a86ca0b_tomcat | at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1705) ~[?:?]
85816a86ca0b_tomcat | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryMethod(AbstractAutowireCapableBeanFactory.java:746) ~[spring-beans-5.3.9.jar:5.3.9]
85816a86ca0b_tomcat | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:685) ~[spring-beans-5.3.9.jar:5.3.9]
85816a86ca0b_tomcat | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:656) ~[spring-beans-5.3.9.jar:5.3.9]
85816a86ca0b_tomcat | at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1670) ~[spring-beans-5.3.9.jar:5.3.9]
85816a86ca0b_tomcat | at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:570) ~[spring-beans-5.3.9.jar:5.3.9]
85816a86ca0b_tomcat | at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:542) ~[spring-beans-5.3.9.jar:5.3.9]
85816a86ca0b_tomcat | at org.springframework.boot.autoconfigure.condition.OnBeanCondition.collectBeanNamesForType(OnBeanCondition.java:238) ~[spring-boot-autoconfigure-2.5.4.jar:2.5.4]
85816a86ca0b_tomcat | at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getBeanNamesForType(OnBeanCondition.java:231) ~[spring-boot-autoconfigure-2.5.4.jar:2.5.4]
85816a86ca0b_tomcat | at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getBeanNamesForType(OnBeanCondition.java:221) ~[spring-boot-autoconfigure-2.5.4.jar:2.5.4]
85816a86ca0b_tomcat | at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getMatchingBeans(OnBeanCondition.java:169) ~[spring-boot-autoconfigure-2.5.4.jar:2.5.4]
85816a86ca0b_tomcat | at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getMatchOutcome(OnBeanCondition.java:129) ~[spring-boot-autoconfigure-2.5.4.jar:2.5.4]
85816a86ca0b_tomcat | at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:47) ~[spring-boot-autoconfigure-2.5.4.jar:2.5.4]
85816a86ca0b_tomcat | ... 46 more
85816a86ca0b_tomcat | Caused by: java.lang.ClassNotFoundException: org.springframework.boot.actuate.info.JavaInfoContributor
85816a86ca0b_tomcat | at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1407) ~[catalina.jar:9.0.56]
85816a86ca0b_tomcat | at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1215) ~[catalina.jar:9.0.56]
85816a86ca0b_tomcat | at java.lang.Class.getDeclaredMethods0(Native Method)
...
Needless to say it was quite frustrating even when I do know and see the error clearly. Was anyone able to use their build without modifying anything other than the "build.gradle" file?

Spent quite a few days troubleshooting and building 6.4.4.2 from https://github.com/apereo/cas-overlay-template
This is likely the root of the problem. If you consider reading the README.md file found at the very same referenced github repository, you will find:
Versions
CAS Server 6.5.0-SNAPSHOT
JDK 11
So what you are working with has nothing to do with 6.4.4.2.
However, if you do actually switch to the correct branch, 6.4, located here https://github.com/apereo/cas-overlay-template/tree/6.4 and then review the README file:
Versions
CAS Server 6.4.4.2
JDK 11
In summary, if you stay on the right branch, you will get the correct version and your fix is unnecessary.

After deployment I went into the directory that contained all the libraries:
-rw-r----- 1 root root 1391480 Jan 6 15:53 spring-boot-2.5.4.jar
-rw-r----- 1 root root 644836 Jan 6 15:53 spring-boot-actuator-2.5.4.jar
-rw-r----- 1 root root 534699 Jan 6 16:14 spring-boot-actuator-autoconfigure-2.5.4.jar
-rw-r----- 1 root root 561010 Jan 6 16:16 spring-boot-actuator-autoconfigure-2.6.1.jar
-rw-r----- 1 root root 1564883 Jan 6 15:53 spring-boot-autoconfigure-2.5.4.jar
-rw-r----- 1 root root 27774 Jan 6 15:53 spring-boot-configuration-metadata-2.5.4.jar
and noticed there where two versions of "spring-boot-actuator-autoconfigure-..."
Hmmm... that did not seem right. So I decided to dig around a bit and decided to change the "gradle.properties" file from:
springBootVersion=2.6.1
to
springBootVersion=2.5.4
./gradlew clean build
Deployed to Tomcat and it WORKED!!!
We were able to deploy and get up and running pretty quickly after this change.

Related

How can I identify the issue preventing a connection between my web application Docker container and the associated MySQL Docker container? [duplicate]

This question already has answers here:
Spring Boot + docker-compose + MySQL: Connection refused
(3 answers)
Closed 5 months ago.
I am trying to deploy a small personal website (and backing MySQL) to Docker using Docker Compose. While I have managed to get the web application running on Docker, I cannot get it to connect to the database. This project is the first time I have been using Docker, so I believe I cannot spot the issue due to my inexperience. I wonder if anyone more experienced could see what I am doing wrong.
I have been going at it for days now. However, none of the solutions to similar questions has worked for me. So far, I understand that the 'Communications link failure' error I keep getting is very generic. Thus, it is difficult to pinpoint the exact problem.
I have provided the contents of my Dockerfile, docker-compose.yml, the database configurations in my application.properties, and part of the output log. I have also provided a Pastebin URL for the entire log.
Many Thanks.
Complete Log Output: https://pastebin.com/aYjWnck8
Dockerfile
FROM openjdk:17
COPY target/personal-website-0.0.1-SNAPSHOT.jar personal-website-0.0.1-SNAPSHOT.jar
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "personal-website-0.0.1-SNAPSHOT.jar"]
docker-compose.yml
version: "3.8"
services:
mysqldb:
container_name: personal-website-database
image: mysql:8.0.29
restart: always
ports:
- 3307:3306
environment:
MYSQL_DATABASE: skills
MYSQL_USER: chizzy
MYSQL_PASSWORD: AbcXyz
MYSQL_ROOT_PASSWORD: AbcXyz
server:
build: .
container_name: personal-website
restart: always
ports:
- 8081:8080
environment:
SPRING_DATASOURCE_URL: jdbc:mysql://mysqldb:3306/skills?useSSL=false&allowPublicKeyRetrieval=true
depends_on:
- mysqldb
application.properties (Database Configuration Excerpt)
server.port=8080
spring.datasource.url=jdbc:mysql://localhost:3306/skills
spring.datasource.username=root
spring.datasource.password=AbcXyz
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
Log (Partial)
personal-website | Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure
personal-website |
personal-website | The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
personal-website | at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:na]
personal-website | at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77) ~[na:na]
personal-website | at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:na]
personal-website | at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499) ~[na:na]
personal-website | at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480) ~[na:na]
personal-website | at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61) ~[mysql-connector-java-8.0.29.jar!/:8.0.29]
personal-website | at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105) ~[mysql-connector-java-8.0.29.jar!/:8.0.29]
personal-website | at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151) ~[mysql-connector-java-8.0.29.jar!/:8.0.29]
personal-website | at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:167) ~[mysql-connector-java-8.0.29.jar!/:8.0.29]
personal-website | at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:89) ~[mysql-connector-java-8.0.29.jar!/:8.0.29]
personal-website | at com.mysql.cj.NativeSession.connect(NativeSession.java:120) ~[mysql-connector-java-8.0.29.jar!/:8.0.29]
personal-website | at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:948) ~[mysql-connector-java-8.0.29.jar!/:8.0.29]
personal-website | at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:818) ~[mysql-connector-java-8.0.29.jar!/:8.0.29]
personal-website | ... 57 common frames omitted
personal-website | Caused by: java.net.ConnectException: Connection refused
personal-website | at java.base/sun.nio.ch.Net.pollConnect(Native Method) ~[na:na]
personal-website | at java.base/sun.nio.ch.Net.pollConnectNow(Net.java:672) ~[na:na]
personal-website | at java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(NioSocketImpl.java:542) ~[na:na]
personal-website | at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:597) ~[na:na]
personal-website | at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327) ~[na:na]
personal-website | at java.base/java.net.Socket.connect(Socket.java:633) ~[na:na]
personal-website | at com.mysql.cj.protocol.StandardSocketFactory.connect(StandardSocketFactory.java:153) ~[mysql-connector-java-8.0.29.jar!/:8.0.29]
personal-website | at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:63) ~[mysql-connector-java-8.0.29.jar!/:8.0.29]
personal-website | ... 60 common frames omitted
When you start services with docker-compose, they start at the same time. Even if you use depends_on that only insures that the service it depends on receive the start signal, not that it is actually ready to receive connections.
A java application starts quicker than a database. Unfortunately java also tries to connect to the database during startup and doesn't retry if that fails.
You should have a retry mechanism in your application or a waiting loop in your docker-compose to fix this. The waiting loop would delay the starting of the java application until the database is actually ready to receive requests. The retry mechanism in the Java application would try to connect to the database everytime it fails because a connection is not readily available.
I suggest the wait loop and you can find a very good example here: https://docs.docker.com/compose/startup-order/
I could paste that code here but it would be a good practice for you to actually read the article there and implement it. You only need to change the command of your java application and add the wait-for-it functionality (you need the script as well in the docker image ;) )

Orion Context Broker already running error

I have a problem when i start orion context broker as a docker container, it is always exiting, it says that Orion is already running, how can i fix this issue?
srdjan-orion-1 | time=2022-07-27T09:53:34.508Z | lvl=ERROR | corr=N/A | trans=N/A | from=N/A | srv=N/A | subsrv=N/A | comp=Orion | op=contextBroker.cpp[432]:pidFile | msg=PID-file '/tmp/contextBroker.pid' found. A broker seems to be running already
srdjan-orion-1 exited with code 1
When i run sudo ps aux | grep contextBroker this is the result: srdjan 31012 0.0 0.0 11568 652 pts/0 S+ 11:56 0:00 grep --color=auto contextBroker
The problem is also when i execute this command, the first number that appears after my username is always changing, and when i try to execute the kill order this is the result: sudo kill 31012 kill: (31012): No such process
and also this: sudo kill 11568 kill: (11568): No such process
Thanks for the help!

How do I connect to a mysql db outside the minikube cluster

I have a mysql database server running on my computer (localhost:3306). I also have several pods running in my minikube cluter.
I want to connect to the mysql database using jdbc connection from within the pod. I understand that localhost would not work in this case because it points to the pod's host. I tried using the IP address of my computer to connect to the database but it did not work. My jdbc url looks like jdbc:mysql://<my-ip>:3306/new_db.
The following error is seen when trying to connect to the db.
com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64)
at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:836)
at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:456)
at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:246)
at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:198)
at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:319)
at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:212)
at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:739)
at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:671)
at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:483)
at org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(ConnectionPool.java:154)
at org.apache.tomcat.jdbc.pool.DataSourceProxy.pCreatePool(DataSourceProxy.java:118)
at org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(DataSourceProxy.java:107)
at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:131)
at org.wso2.diagnose.databaseresponsetiming.DBTester.afterPropertiesSet(DBTester.java:41)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1845)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1782)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:602)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:944)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:917)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:582)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:767)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:426)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:326)
at org.wso2.diagnose.databaseresponsetiming.DatabaseResponseTimingApplication.main(DatabaseResponseTimingApplication.java:19)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:107)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
at org.springframework.boot.loader.PropertiesLauncher.main(PropertiesLauncher.java:467)
Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151)
at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:167)
at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:89)
at com.mysql.cj.NativeSession.connect(NativeSession.java:144)
at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:956)
at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:826)
... 37 common frames omitted
Caused by: java.net.ConnectException: Connection refused (Connection refused)
at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399)
at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242)
at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224)
at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.base/java.net.Socket.connect(Socket.java:608)
at com.mysql.cj.protocol.StandardSocketFactory.connect(StandardSocketFactory.java:155)
at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:63)
... 40 common frames omitted
2021-07-09 05:39:04 - Communications link failure
Any idea on how to resolve this issue?
Create a Service with type NodePort for your MySQL database. Then, run the following command to get the URL to access your database from local machine.
minikube service --url <service-name>
Checkout this Minikube official guides for Accessing apps to explore other options.
I think what you need is to create Service with manually mapped Endpoint to your DB IP address and port. It's described here https://kubernetes.io/docs/concepts/services-networking/service/#services-without-selectors Also look here https://kubernetes.io/docs/concepts/services-networking/service/#externalname

changing my database to MySQL in WSO2-AM throws error upon starting the server

/usr/lib/wso2/wso2am/3.2.0/bin/wso2server.sh: line 135: warning: command substitution: ignored null byte in input
JAVA_HOME environment variable is set to /usr/lib/wso2/wso2am/3.2.0/jdk/jdk-11.0.8+10
CARBON_HOME environment variable is set to /usr/lib/wso2/wso2am/3.2.0
Using Java memory options: -Xms256m -Xmx1024m
andes [org.wso2.andes.wso2.internal.QpidBundleActivator] INFO : Setting BundleContext in PluginManager
callhome [org.wso2.carbon.callhome.internal.CallHomeActivator] DEBUG : Activating CallHome agent
[2020-09-25 07:51:08,195] INFO - CarbonCoreActivator Starting WSO2 Carbon...
[2020-09-25 07:51:08,218] INFO - CarbonCoreActivator Operating System : Linux 5.4.0-48-generic, amd64
[2020-09-25 07:51:08,219] INFO - CarbonCoreActivator Java Home : /usr/lib/wso2/wso2am/3.2.0/jdk/jdk-11.0.8+10
[2020-09-25 07:51:08,220] INFO - CarbonCoreActivator Java Version : 11.0.8
[2020-09-25 07:51:08,220] INFO - CarbonCoreActivator Java VM : OpenJDK 64-Bit Server VM 11.0.8+10,AdoptOpenJDK
[2020-09-25 07:51:08,221] INFO - CarbonCoreActivator Carbon Home : /usr/lib/wso2/wso2am/3.2.0
[2020-09-25 07:51:08,221] INFO - CarbonCoreActivator Java Temp Dir : /usr/lib/wso2/wso2am/3.2.0/tmp
[2020-09-25 07:51:08,221] INFO - CarbonCoreActivator User : wso2, en-US, Etc/UTC
[2020-09-25 07:51:08,643] INFO - DefaultCryptoProviderComponent 'CryptoService.Secret' property has not been set. 'org.wso2.carbon.crypto.provider.SymmetricKeyInternalCryptoProvider' won't be registered as an internal crypto provider. Please set the secret if the provider needs to be registered.
[2020-09-25 07:51:09,445] INFO - KafkaEventAdapterServiceDS Successfully deployed the Kafka output event adaptor service
[2020-09-25 07:51:09,840] INFO - TemplateDeployerServiceTrackerDS Successfully deployed the execution manager tracker service
[2020-09-25 07:51:15,939] INFO - ConsentManagerComponent ConsentManagerComponent is activated.
[2020-09-25 07:51:16,366] ERROR - BinaryDataReceiver Error while starting Binary TCP Transport.
java.net.BindException: Address already in use (Bind failed)
at java.net.PlainSocketImpl.socketBind(Native Method) ~[?:?]
at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:436) ~[?:?]
at java.net.ServerSocket.bind(ServerSocket.java:395) ~[?:?]
at java.net.ServerSocket.(ServerSocket.java:257) ~[?:?]
at java.net.ServerSocket.(ServerSocket.java:149) ~[?:?]
at javax.net.DefaultServerSocketFactory.createServerSocket(ServerSocketFactory.java:218) ~[?:?]
at org.wso2.carbon.databridge.receiver.binary.internal.BinaryDataReceiver$BinaryEventServer.run(BinaryDataReceiver.java:182) [org.wso2.carbon.databridge.receiver.binary_5.2.26.jar:?]
at java.lang.Thread.run(Thread.java:834) [?:?]
[2020-09-25 07:51:16,361] ERROR - BinaryDataReceiver Error while starting Binary SSL Transport.
java.net.BindException: Address already in use (Bind failed)
at java.net.PlainSocketImpl.socketBind(Native Method) ~[?:?]
at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:436) ~[?:?]
at java.net.ServerSocket.bind(ServerSocket.java:395) ~[?:?]
at java.net.ServerSocket.(ServerSocket.java:257) ~[?:?]
at java.net.ServerSocket.(ServerSocket.java:201) ~[?:?]
at javax.net.ssl.SSLServerSocket.(SSLServerSocket.java:136) ~[?:?]
at sun.security.ssl.SSLServerSocketImpl.(SSLServerSocketImpl.java:70) ~[?:?]
at sun.security.ssl.SSLServerSocketFactoryImpl.createServerSocket(SSLServerSocketFactoryImpl.java:73) ~[?:?]
at org.wso2.carbon.databridge.receiver.binary.internal.BinaryDataReceiver$BinarySecureEventServer.run(BinaryDataReceiver.java:136) [org.wso2.carbon.databridge.receiver.binary_5.2.26.jar:?]
at java.lang.Thread.run(Thread.java:834) [?:?]
[2020-09-25 07:51:16,443] INFO - DataBridgeDS Successfully deployed Agent Server
[2020-09-25 07:51:18,562] ERROR - AuthorizationUtils Could not set authorizations for the root.
Caused by: Error! DB error occurred while checking is existing system role for : admin & tenant id : -1234
org.wso2.carbon.user.core.UserStoreException: Error! DB error occurred while checking is existing system role for : admin & tenant id : -1234
at org.wso2.carbon.user.core.authorization.JDBCAuthorizationManager.callSecure(JDBCAuthorizationManager.java:1491) ~[org.wso2.carbon.user.core_4.6.0.jar:?]
at org.wso2.carbon.user.core.authorization.JDBCAuthorizationManager.authorizeRole(JDBCAuthorizationManager.java:560) ~[org.wso2.carbon.user.core_4.6.0.jar:?]
at org.wso2.carbon.registry.core.jdbc.realm.RegistryAuthorizationManager.authorizeRole(RegistryAuthorizationManager.java:161) ~[org.wso2.carbon.registry.core_4.6.0.jar:?]
at org.wso2.carbon.registry.core.utils.AuthorizationUtils.setRootAuthorizations(AuthorizationUtils.java:274) [org.wso2.carbon.registry.core_4.6.0.jar:?]
at org.wso2.carbon.registry.core.session.UserRegistry.addRootCollection(UserRegistry.java:417) [org.wso2.carbon.registry.core_4.6.0.jar:?]
at org.wso2.carbon.registry.core.session.UserRegistry.init(UserRegistry.java:340) [org.wso2.carbon.registry.core_4.6.0.jar:?]
at org.wso2.carbon.registry.core.session.UserRegistry.access$100(UserRegistry.java:73) [org.wso2.carbon.registry.core_4.6.0.jar:?]
at org.wso2.carbon.registry.core.session.UserRegistry$2.run(UserRegistry.java:261) [org.wso2.carbon.registry.core_4.6.0.jar:?]
at java.security.AccessController.doPrivileged(Native Method) [?:?]
at org.wso2.carbon.registry.core.session.UserRegistry.(UserRegistry.java:258) [org.wso2.carbon.registry.core_4.6.0.jar:?]
at org.wso2.carbon.registry.core.session.UserRegistry.(UserRegistry.java:237) [org.wso2.carbon.registry.core_4.6.0.jar:?]
at org.wso2.carbon.registry.core.jdbc.EmbeddedRegistryService.getUserRegistry(EmbeddedRegistryService.java:427) [org.wso2.carbon.registry.core_4.6.0.jar:?]
at org.wso2.carbon.registry.core.jdbc.EmbeddedRegistryService.getSystemRegistry(EmbeddedRegistryService.java:292) [org.wso2.carbon.registry.core_4.6.0.jar:?]
at org.wso2.carbon.registry.core.jdbc.EmbeddedRegistryService.getSystemRegistry(EmbeddedRegistryService.java:276) [org.wso2.carbon.registry.core_4.6.0.jar:?]
at org.wso2.carbon.registry.core.jdbc.EmbeddedRegistryService.getSystemRegistry(EmbeddedRegistryService.java:262) [org.wso2.carbon.registry.core_4.6.0.jar:?]
at org.wso2.carbon.registry.core.jdbc.EmbeddedRegistryService.configure(EmbeddedRegistryService.java:219) [org.wso2.carbon.registry.core_4.6.0.jar:?]
at org.wso2.carbon.registry.core.jdbc.EmbeddedRegistryService.(EmbeddedRegistryService.java:99) [org.wso2.carbon.registry.core_4.6.0.jar:?]
at org.wso2.carbon.registry.core.internal.RegistryCoreServiceComponent.getEmbeddedRegistryService(RegistryCoreServiceComponent.java:598) [org.wso2.carbon.registry.core_4.6.0.jar:?]
It seems that another service or server is already using the configured ports. Check for port usage and try to change the port number to a different port
As the error says "Address already in use", please check for the already running processes by executing the following command and start this server after stopping the other servers.
ps -aux | grep wso2
Or you can set a port offset to this server by changing the following configuration at <APIM_HOME>/repository/conf/deployment.toml file. Make sure to uncomment the configuration too.
offset=5

Unable to deploy the application

i am trying to deploy the application using Tomcat with the help of docker for deployment and mariaDB as database.
The respective generated war file is getting deployed but when i try to access other pages(other than the base url/landing page) its showing the following error:
web-app_1 | 07:20:00.324 [http-apr-8080-exec-3] INFO com.company.controller.MainController - in Main controller
web-app_1 | 07:20:00.806 [http-apr-8080-exec-3] DEBUG org.hibernate.stat.internal.StatisticsInitiator - Statistics initialized [enabled=false]
web-app_1 | 07:20:00.952 [http-apr-8080-exec-3] DEBUG org.hibernate.engine.jdbc.spi.SqlExceptionHelper - Unable to acquire JDBC Connection [n/a]
web-app_1 | java.sql.SQLNonTransientConnectionException: Could not connect to address=(host=localhost)(port=833)(type=master) : Connection refused (Connection refused)
web-app_1 | at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.get(ExceptionMapper.java:156)
web-app_1 | at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.getException(ExceptionMapper.java:118)
web-app_1 | at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.throwException(ExceptionMapper.java:92)
web-app_1 | at org.mariadb.jdbc.Driver.connect(Driver.java:108)
web-app_1 | at java.sql.DriverManager.getConnection(DriverManager.java:664)
web-app_1 | at java.sql.DriverManager.getConnection(DriverManager.java:208)
web-app_1 | at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:153)
web-app_1 | at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriver(DriverManagerDataSource.java:144)
web-app_1 | at org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnectionFromDriver(AbstractDriverBasedDataSource.java:196)
and hibernate.properties file contains:
jdbc.driverClassName = org.mariadb.jdbc.Driver
jdbc.url = jdbc:mysql://localhost:3306/ams_dbnew
jdbc.username = username
jdbc.password = password
hibernate.dialect = org.hibernate.dialect.MySQL5InnoDBDialect
hibernate.hbm2ddl.auto = none
hibernate.format_sql = true
hibernate.show_sql = true
Although am pointing to jdbc:mysql://localhost:3306/ but in tomcat logs its showing error as java.sql.SQLNonTransientConnectionException: Could not connect to address=(host=localhost)(port=833)(type=master) : Connection refused (Connection refused)
and database is running on same 3306 port
sudo netstat -tulpen | grep mysql
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 121 410570 51950/mysqld
can anyone tell me where and which part am doing wrong?
and docker-compose file is:
version: '3'
services:
web-app:
build:
context: .
dockerfile: Dockerfile
ports:
- 8080:8080
network_mode: "host"
I suspect the port 833, try searching the number "833" in your tomcat home directory
cd /TOMCAT_HOME_DIRECTORY/
grep -rli 833 .
may be one of the file overriding the port number.
As seeing your logs, it seems there is another database service is configured on 833 port and it is overridden while running tomcat with database app.
Make sure any database you didn't configured with this port. stop all database service then also stop closed this port via following this command:
netstat -ap | grep :
it search the process running on this port
kill -9
kill that process id running on this port no.