I am getting a LocalServiceAccessException since upgrading to 7.2.1

Since I upgraded my project to 7.2.1, I am getting the following error:

com.haulmont.cuba.web.sys.remoting.LocalServiceAccessException: Unable to connect to middleware. Service kt-core/cuba_TrustedClientService is not registered in LocalServiceDirectory

Due to this error, 'web' block cannot connect to the co-located 'core' block.
Most probably the 'core' block didn't start properly, so check the server log for exceptions.
If there are no prior exceptions in the log, check that 'cuba.connectionUrlList' property value ends with the web context name of the 'core' block, e.g. 'cuba.connectionUrlList = http://localhost:8080/app-core'

You can turn off this information using 'cuba.web.productionMode' application property.

I have been trying to resolve this problems for days now but not getting anywhere.
Please help me, someone. Thanks

Hi,

What actions have you tried to resolve problems? Are there any error messages or exceptions in the server startup log?

Hi Alex,
Which file is the server startup log ? I am using Tomcat 9

If you encounter problems with server start, I would recommend investigating all log files in the tomcat/log folder.
There are several log files: localhost.log, catalina.log. And another file that stores System.out/err output. For Tomcat Windows service its name is tomcat9-stdout.log.

And the LocalServiceAccessException exception isn’t root exception you should be looking for. It is induced error. Root cause will be somewhere earlier in the log file.

You can find more information for Tomcat deployment in the manual:
https://doc.cuba-platform.com/manual-7.2/tomcat_war_deployment.html
https://doc.cuba-platform.com/manual-7.2/tomcat_war_deployment_linux.html

In my tomcat9-stdout.log file I am seeing Exception :

2020-03-17 01:16:55.983 DEBUG [http-nio-8080-exec-3] com.haulmont.cuba.web.App - Initializing application
2020-03-17 01:16:55.998 DEBUG [http-nio-8080-exec-3] com.haulmont.cuba.gui.theme.ThemeConstantsRepository - Loading theme constants
2020-03-17 01:16:56.014 DEBUG [http-nio-8080-exec-3] com.haulmont.cuba.web.security.WebAnonymousSessionHolder - Loading anonymous session
2020-03-17 01:18:56.053 ERROR [http-nio-8080-exec-3] com.haulmont.cuba.web.AppUI - Unable to init ui
java.lang.RuntimeException: Unable to login as anonymous!

I still have no clue on what to do.

How did you migrate from 7.1 to 7.2.1? With help of Studio 13, or manually?
Do you use multitenancy add-on in your project (compatible version hasn’t been released yet)?
Haven’t you extended User entity in your project?

There were many breaking changes with Security subsystem in 7.2.
I would advise to read about changes here: CUBA Platform Release Notes

Maybe answer this topic will help you, user had similar problem:

I migrated to 7.2.1 with the help of Studio 13.

I do not use multi-tenancy add-on.
I have not extended User entity.

I had gone through that other topic where the user had similar problem but it didnt help as I have already implemented those suggestions

I am using multiple WAR files on the same tomcat instance running on port 8080.
Does that make a difference ?
Here is my buildWar task in build.gradle :

task buildWar(type: CubaWarBuilding) {
    includeJdbcDriver = true
    includeContextXml = true
    singleWar = false
    appProperties = ['cuba.automaticDatabaseUpdate'       : true,
                     'cuba.dataSourceProvider'            : 'jndi',
                     'cuba.web.productionMode'            : false,
                     'cuba.fileStorageDir'            : 'C:/kargil-tracker-attachments',
                     'cuba.webPort': 8080,
                     'cuba.useLocalServiceInvocation' : true,
                     'cuba.connectionUrlList' : 'http://localhost:8080/kt-core'
    ]
    appHome = './app_home'
    coreContextXmlPath = 'modules/core/web/META-INF/kargil-tracker-context.xml'
}

You should not set this property when building separate WARs. Most likely it is the reason why you get this error:

Look to documentation:
https://doc.cuba-platform.com/manual-7.2/app_properties_reference.html#cuba.useLocalServiceInvocation

When true, the Web Client and Web Portal blocks invoke the Middleware services locally bypassing the network stack, which has a positive impact on system performance. It is possible in the case of fast deployment, single WAR and single Uber JAR. This property should be set to false for all other deployment options.

Also, if you are not sure why you need to build multiple WAR files - you should not use this option.
Single WAR is a better, more convenient option which should always be used, unless someone needs to deploy app.war and app-core.war separately (to different servers).

Thank you Alex ! Problem solved.
That is where I was going wrong all this time.
Much appreciated