Unable to login as anonymous!

Greetings, I must deploy a survey app developed with Cuba. Everything works fine until it’s taken into the production environment. I can’t make it work.
I followed the scaling model where the first server is APACHE, 2 WEB CLIENT, 1 MIDDLEWARE and finally database server. The problem comes with the client’s connection to the middleware. From the middleware reports “Client is not allowed to call ‘TrustedClientService.getAnonymousSession(…)’ since IP ‘10.128.0.17’ is not trusted”

before the mistake everything seems to be right

00:15:52.409 INFO [main] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. En$
00:15:52.594 INFO  c.h.cuba.core.sys.AppComponents         - Using app components: [com.haulmont.cuba, org.strangeway.responsive, de.balvi.cuba.de$
00:15:52.628 INFO  c.h.c.c.s.AbstractWebAppContextLoader   - Loading app properties from classpath:com/trz/app/survey/app.properties
00:15:52.633 INFO  c.h.c.c.s.AbstractWebAppContextLoader   - Loading app properties from /WEB-INF/local.app.properties
00:15:52.689 INFO  c.h.cuba.core.sys.AppContextLoader	   - DbmsType of the main database is set to postgres
00:15:52.707 INFO  c.h.c.c.s.e.DataStoresCheck             - Checking connection to data store _MAIN_
00:15:52.995 INFO  c.h.c.c.s.e.EnvironmentChecksRunner     - Environment checks on core module completed successfully
00:15:53.329 INFO  c.h.c.c.s.p.MappingFileCreator          - Creating file /opt/tomcat/apache-tomcat-9.0.26/webapps/survey-core/work/orm.xml
00:15:53.341 INFO  c.h.c.c.s.p.PersistenceConfigProcessor  - Creating file /opt/tomcat/apache-tomcat-9.0.26/webapps/survey-core/work/persistence.x$
00:15:59.739 INFO  c.h.c.c.s.CubaThreadPoolTaskScheduler   - Initializing ExecutorService 'scheduler'
00:16:01.689 INFO  c.h.cuba.core.sys.jmx.MBeanExporter     - Registering beans for JMX exposure: [survey-core.cuba:type=PersistenceManager, survey$
00:16:01.946 INFO  c.h.cuba.core.sys.jmx.MBeanExporter     - Registering beans for JMX exposure: [survey-core.reports:type=CubaOfficeIntegration, $
00:16:01.962 INFO  c.h.cuba.core.sys.jmx.MBeanExporter     - Registering beans for JMX exposure: [survey-core.fts:type=FtsManager, survey-core.fts$
00:16:02.000 INFO  c.h.cuba.core.sys.MetadataImpl          - Initializing metadata
00:16:02.270 INFO  c.h.cuba.core.sys.MetadataImpl          - Metadata initialized in 270 ms
00:16:02.317 INFO  c.h.c.c.sys.dbupdate.DbUpdaterEngine    - Updating database...
00:16:02.674 INFO  c.h.c.c.sys.dbupdate.DbUpdaterEngine    - Database is up-to-date
00:16:03.413 INFO  c.h.cuba.core.app.ConfigStorage         - Loading DB-stored app properties cache
00:16:03.789 INFO  c.h.c.c.s.DefaultPermissionValuesConfig - Initializing default permission values
00:16:03.869 INFO  c.h.c.s.a.AuthenticationManagerBean     - Logged in: b7d63183-4cad-9136-b7f1-0628e36d6e31 [anonymous]
00:16:03.871 INFO  c.h.c.c.sys.AbstractViewRepository	   - Initializing views
00:16:04.115 INFO  c.h.c.c.s.AbstractWebAppContextLoader   - AppContext started
00:16:04.140 INFO  c.h.c.c.sys.remoting.RemotingServlet    - Initializing Servlet 'remoting'
00:16:04.182 INFO  c.h.c.c.s.r.RemoteServicesBeanCreator   - Configuring remote services
00:16:04.570 INFO  c.h.c.s.a.AuthenticationManagerBean     - Logged in: b7000d7e-ef11-55ad-a15c-f8e4f125c765 [admin]
00:16:05.186 INFO  c.h.c.c.sys.remoting.RemotingServlet    - Completed initialization in 1046 ms

Now the web client generates the error:

ERROR com.haulmont.cuba.web.AppUI             - Unable to init ui
java.lang.RuntimeException: Unable to login as anonymous!
        at com.haulmont.cuba.web.DefaultApp.loginOnStart(DefaultApp.java:313) ~[cuba-web-7.1.1.jar:7.1.1]
        at com.haulmont.cuba.web.AppUI.setupUI(AppUI.java:477) ~[cuba-web-7.1.1.jar:7.1.1]
        at com.haulmont.cuba.web.AppUI.init(AppUI.java:337) ~[cuba-web-7.1.1.jar:7.1.1]
        at com.vaadin.ui.UI.doInit(UI.java:738) ~[vaadin-server-8.6.4-20-cuba.jar:8.6.4-20-cuba]
        at com.vaadin.server.communication.UIInitHandler.getBrowserDetailsUI(UIInitHandler.java:209) ~[vaadin-server-8.6.4-20-cuba.jar:8.6.4-20-cu$
        at com.vaadin.server.communication.UIInitHandler.synchronizedHandleRequest(UIInitHandler.java:67) ~[vaadin-server-8.6.4-20-cuba.jar:8.6.4-$
        at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:40) ~[vaadin-server-8.6.4-20-cuba.jar:8.6.4-$
        at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1577) ~[vaadin-server-8.6.4-20-cuba.jar:8.6.4-20-cuba]
        at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:425) ~[vaadin-server-8.6.4-20-cuba.jar:8.6.4-20-cuba]
        at com.haulmont.cuba.web.sys.CubaApplicationServlet.serviceAppRequest(CubaApplicationServlet.java:329) ~[cuba-web-7.1.1.jar:7.1.1]
        at com.haulmont.cuba.web.sys.CubaApplicationServlet.service(CubaApplicationServlet.java:215) ~[cuba-web-7.1.1.jar:7.1.1]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) ~[servlet-api.jar:na]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[catalina.jar:9.0.26]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[catalina.jar:9.0.26]

It was reviewed that the anonymous user created in the database existed, the configurations were validated and still I can not make it work in production.
It goes without saying that the Tomcat of the servers was set up and installed from zero.

Web client properties file

cuba.logDir = /opt/tomcat/latest/webapps/logs
cuba.confDir = /opt/tomcat/latest/webapps/${cuba.webContextName}/conf
cuba.tempDir = /opt/tomcat/latest/webapps/${cuba.webContextName}/temp
cuba.dataDir = /opt/tomcat/latest/webapps/${cuba.webContextName}/work
cuba.connectionUrlList = http://10.128.0.32:8080/survey-core
cuba.useLocalServiceInvocation = false
cuba.automaticDatabaseUpdate = true
cuba.webPort = 8080

Middleware properties file

cuba.logDir = /opt/tomcat/latest/webapps/logs
cuba.confDir = /opt/tomcat/latest/webapps/${cuba.webContextName}/conf
cuba.tempDir = /opt/tomcat/latest/webapps/${cuba.webContextName}/temp
cuba.dataDir = /opt/tomcat/latest/webapps/${cuba.webContextName}/work
cuba.dataSourceJndiName = jdbc/CubaDS
cuba.download.directories = ${cuba.tempDir};${cuba.logDir}
cuba.dbDir = web-inf:db
cuba.doNotExposeRemoteServices = false
cuba.automaticDatabaseUpdate = true
cuba.webPort = 8080
cuba.connectionUrlList = http://10.128.0.32:8080/survey-core
cuba.webHostName = 10.128.0.32

I appreciate the help and guidance you can give me in finding the problem.

Regards,

Nelson F.

Hi,
You need to set this property if web/portal and middleware are deployed on separate hosts:
https://doc.cuba-platform.com/manual-7.1/app_properties_reference.html#cuba.trustedClientPermittedIpList

1 Like