CMDBuild Forum

Cmdbuild load balance settings

Hello,

I´m trying to configure CMDBuild (v. 3.4) behind a loabalancer apache as it mencioned in Technical Manual. I can access each application by typing in the browser its respectly address. For example:

http://xxx.yyy.zzz.101:8080/cmdbuild-3.4/ui/
http://xxx.yyy.zzz.102:8080/cmdbuild-3.4/ui/
http://xxx.yyy.zzz.103:8080/cmdbuild-3.4/ui/

Although, I can´t access the same webpage when I type the webservers address:

http://webserver001/cmdbuild/ or http://webserver002/cmdbuild/

It doesn´t matter whether is FQDN or ip address I got always the same error.

My environment is:

There is not any firewall set in the environment or SELINUX

2 Web Servers Apache

Apache/2.4.41 (Ubuntu) configured

site.conf

<VirtualHost *:80>

    **ServerName webserver001** --> This parameter is different in the other web server
    ProxyRequests Off
    ProxyPreserveHost On

    Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED

    <Proxy "balancer://cmdbuildapp">
        BalancerMember http://xxx.yyy.zzz.100:8080/ route=tomcat1 timeout=6
        BalancerMember http://xxx.yyy.zzz.101:8080/ route=tomcat2 timeout=6
        BalancerMember http://xxx.yyy.zzz.102:8080/ route=tomcat3 timeout=6

        ProxySet lbmethod=byrequests
        ProxySet stickysession=ROUTEID

        Order Deny,Allow
        Deny from none
        Allow from all
    </Proxy>

    <Location /balancer-manager>
        SetHandler balancer-manager
    </Location>

    ProxyPass /balancer-manager !

    ProxyPass /cmdbuild/ balancer://cmdbuildapp/cmdbuild-3.4/ui/ maxattempts=6 timeout=60
    ProxyPassReverse /cmdbuild/ balancer://cmdbuildapp/cmdbuild-3.4/ui/

    ProxyPass / balancer://cmdbuildapp/cmdbuild-3.4/ui/ maxattempts=6 timeout=60
    ProxyPassReverse / balancer://cmdbuildapp/cmdbuild-3.4/ui/

    ErrorLog ${APACHE_LOG_DIR}/proxy-error.log
    CustomLog ${APACHE_LOG_DIR}/proxy-access.log combined

3 App Servers Tomcat

Server version name: Apache Tomcat/9.0.64
Server built: Jun 2 2022 19:08:46 UTC
Server version number: 9.0.64.0
OS Name: Linux
OS Version: 5.4.0-113-generic
Architecture: amd64
Java Home: /usr/lib/jvm/java-17-openjdk-amd64
JVM Version: 17.0.3+7-Ubuntu-0ubuntu0.20.04.1
JVM Vendor: Private Build
CATALINA_BASE: /data/tomcat
CATALINA_HOME: /data/tomcat

server.xml

→ the value of jvmRoute is different on each tomcat server. i.e. tomcat2 and tomcat3 respectively.

These are the errors that are in the logs:

cmdbuild-3.4_req.log

2022-06-30T12:22:19.117-03:00 [req:0633nq] ERROR o.c.w.f.RequestTrackingFilter$$EnhancerBySpringCGLIB$$bff10c2c - error processing request = 0633nqqy9slojotnx6mytgk7
org.springframework.security.web.firewall.RequestRejectedException: The request was rejected because the URL contained a potentially malicious String “//”
at org.springframework.security.web.firewall.StrictHttpFirewall.rejectedBlocklistedUrls(StrictHttpFirewall.java:456) ~[spring-security-web-5.5.2.jar:5.5.2]
at org.springframework.security.web.firewall.StrictHttpFirewall.getFirewalledRequest(StrictHttpFirewall.java:429) ~[spring-security-web-5.5.2.jar:5.5.2]
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:196) ~[spring-security-web-5.5.2.jar:5.5.2]
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:183) ~[spring-security-web-5.5.2.jar:5.5.2]
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358) ~[spring-web-5.3.9.jar:5.3.9]
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271) ~[spring-web-5.3.9.jar:5.3.9]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[catalina.jar:9.0.64]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[catalina.jar:9.0.64]
at org.cmdbuild.webapp.filters.RequestTrackingFilter.doFilterInternal(RequestTrackingFilter.java:190) ~[classes/:3.4]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.9.jar:5.3.9]
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358) ~[spring-web-5.3.9.jar:5.3.9]
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271) ~[spring-web-5.3.9.jar:5.3.9]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[catalina.jar:9.0.64]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[catalina.jar:9.0.64]
at org.cmdbuild.webapp.filters.BootCheckFilter.doFilterAfterBootCheck(BootCheckFilter.java:111) ~[classes/:3.4]
at org.cmdbuild.webapp.filters.BootCheckFilter.doFilterInternal(BootCheckFilter.java:70) ~[classes/:3.4]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.9.jar:5.3.9]
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358) ~[spring-web-5.3.9.jar:5.3.9]
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271) ~[spring-web-5.3.9.jar:5.3.9]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[catalina.jar:9.0.64]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[catalina.jar:9.0.64]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197) ~[catalina.jar:9.0.64]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) ~[catalina.jar:9.0.64]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) ~[catalina.jar:9.0.64]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135) ~[catalina.jar:9.0.64]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[catalina.jar:9.0.64]
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:687) ~[catalina.jar:9.0.64]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) ~[catalina.jar:9.0.64]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:360) ~[catalina.jar:9.0.64]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:399) ~[tomcat-coyote.jar:9.0.64]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) ~[tomcat-coyote.jar:9.0.64]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:890) ~[tomcat-coyote.jar:9.0.64]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1787) ~[tomcat-coyote.jar:9.0.64]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-coyote.jar:9.0.64]
at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) ~[tomcat-util.jar:9.0.64]
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) ~[tomcat-util.jar:9.0.64]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-util.jar:9.0.64]
at java.base/java.lang.Thread.run(Thread.java:833) ~[na:na]

cmdbuild-3.4.log

2022-06-30T16:26:30.103-03:00 [sked] ERROR o.c.jobs.inner.JobRunServiceImpl - error executing job = JobData{id=null, code=easyuploadLoaderService.checkUploadsFolderAndLoadContent, type=cm_service, isEnabled=true}
org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [DELETE FROM “_Session” WHERE “SessionId” = ?]; nested exception is org.postgresql.util.PSQLException: ERROR: prepared statement “S_3” already exists
at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:101) ~[spring-jdbc-5.3.9.jar:5.3.9]
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70) ~[spring-jdbc-5.3.9.jar:5.3.9]
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:79) ~[spring-jdbc-5.3.9.jar:5.3.9]
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:79) ~[spring-jdbc-5.3.9.jar:5.3.9]
at org.springframework.jdbc.core.JdbcTemplate.translateException(JdbcTemplate.java:1541) ~[spring-jdbc-5.3.9.jar:5.3.9]
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:667) ~[spring-jdbc-5.3.9.jar:5.3.9]
at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:960) ~[spring-jdbc-5.3.9.jar:5.3.9]
at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:1015) ~[spring-jdbc-5.3.9.jar:5.3.9]
at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:1025) ~[spring-jdbc-5.3.9.jar:5.3.9]
at org.cmdbuild.auth.session.dao.SessionDataRepositoryImpl.deleteSession(SessionDataRepositoryImpl.java:57) ~[cmdbuild-auth-session-3.4.jar:3.4]
at org.cmdbuild.auth.session.dao.SessionRepositoryImpl.deleteSession(SessionRepositoryImpl.java:131) ~[cmdbuild-auth-session-3.4.jar:3.4]
at org.cmdbuild.auth.session.SessionServiceImpl.deleteSession(SessionServiceImpl.java:161) ~[cmdbuild-auth-session-3.4.jar:3.4]
at org.cmdbuild.auth.session.SessionService.deleteSession(SessionService.java:100) ~[cmdbuild-auth-session-3.4.jar:3.4]
at org.cmdbuild.auth.session.SessionService.deleteCurrentSessionIfExists(SessionService.java:131) ~[cmdbuild-auth-session-3.4.jar:3.4]
at org.cmdbuild.jobs.JobSessionServiceImpl.destroyJobSessionContext(JobSessionServiceImpl.java:49) ~[cmdbuild-jobs-core-3.4.jar:3.4]
at org.cmdbuild.jobs.JobSessionServiceImpl.lambda$createJobSessionContextWithUser$0(JobSessionServiceImpl.java:34) ~[cmdbuild-jobs-core-3.4.jar:3.4]
at org.cmdbuild.jobs.inner.JobRunServiceImpl$JobRunner.setContextAndExecuteJob(JobRunServiceImpl.java:288) ~[cmdbuild-jobs-core-3.4.jar:3.4]
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[na:na]
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[na:na]
at java.base/java.lang.Thread.run(Thread.java:833) ~[na:na]
Caused by: org.postgresql.util.PSQLException: ERROR: prepared statement “S_3” already exists
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2674) ~[postgresql-42.3.1.jar:42.3.1]
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2364) ~[postgresql-42.3.1.jar:42.3.1]
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:354) ~[postgresql-42.3.1.jar:42.3.1]
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:484) ~[postgresql-42.3.1.jar:42.3.1]
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:404) ~[postgresql-42.3.1.jar:42.3.1]
at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:162) ~[postgresql-42.3.1.jar:42.3.1]
at org.postgresql.jdbc.PgPreparedStatement.executeUpdate(PgPreparedStatement.java:130) ~[postgresql-42.3.1.jar:42.3.1]
at org.apache.commons.dbcp2.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:97) ~[commons-dbcp2-2.3.0.jar:2.3.0]
at org.apache.commons.dbcp2.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:97) ~[commons-dbcp2-2.3.0.jar:2.3.0]
at com.p6spy.engine.wrapper.PreparedStatementWrapper.executeUpdate(PreparedStatementWrapper.java:94) ~[p6spy-3.7.0.jar:na]
at org.apache.commons.dbcp2.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:97) ~[commons-dbcp2-2.3.0.jar:2.3.0]
at org.springframework.jdbc.core.JdbcTemplate.lambda$update$2(JdbcTemplate.java:965) ~[spring-jdbc-5.3.9.jar:5.3.9]
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:651) ~[spring-jdbc-5.3.9.jar:5.3.9]
… 16 common frames omitted

localhost_access_log.txt

webserver001 - - [30/Jun/2022:09:00:28 -0300] “GET //cmdbuild-3.4/ui/ HTTP/1.1” 500 50
webserver001 - - [30/Jun/2022:09:02:20 -0300] “GET //cmdbuild-3.4/ui/ HTTP/1.1” 500 50
webserver001 - - [30/Jun/2022:10:08:31 -0300] “GET //cmdbuild-3.4/ui/ HTTP/1.1” 500 50
webserver001 - - [30/Jun/2022:12:12:57 -0300] “GET //cmdbuild-3.4/ui/ HTTP/1.1” 500 50
webserver001 - - [30/Jun/2022:12:22:19 -0300] “GET //cmdbuild-3.4/ui/ HTTP/1.1” 500 50
webserver001 - - [30/Jun/2022:15:10:31 -0300] “GET //cmdbuild-3.4/ui/ HTTP/1.1” 500 50
webserver001 - - [30/Jun/2022:15:10:35 -0300] “GET //cmdbuild-3.4/ui/ HTTP/1.1” 500 50
webserver001 - - [30/Jun/2022:15:10:36 -0300] “GET //cmdbuild-3.4/ui/ HTTP/1.1” 500 50
webserver001 - - [30/Jun/2022:15:10:37 -0300] “GET //cmdbuild-3.4/ui/ HTTP/1.1” 500 50
webserver001 - - [30/Jun/2022:15:10:38 -0300] “GET //cmdbuild-3.4/ui/ HTTP/1.1” 500 50
webserver001 - - [30/Jun/2022:15:10:40 -0300] “GET //cmdbuild-3.4/ui/ HTTP/1.1” 500 50
webserver001 - - [30/Jun/2022:15:10:41 -0300] “GET //cmdbuild-3.4/ui/ HTTP/1.1” 500 50
webserver001 - - [30/Jun/2022:16:03:48 -0300] “GET //cmdbuild-3.4/ui/ HTTP/1.1” 500 50

Please, if anybody could help me, I´ll be grateful.

Hi,
I realized that configurations in the server.xml weren´t uploaded. So, here it is:

Connector port=“8080” protocol=“HTTP/1.1” connectionTimeout=“20000” redirectPort=“8443”

Engine name=“Catalina” defaultHost=“localhost” jvmRoute=“tomcat1”

PS: I did some tests befone when I put the parameters proxyName and proxyPort, but it didn´t work too.

Thanks in advance