Adding new module in MSSQL project breaks deployment

After having created the Polymer UI client module, login consistently fails. Opening the regular UI results in “Unexpected error: Please contact system administrator”.

The developer tools show that there is a 500 error on

POST http://localhost:8080/app/rest/v2/oauth/token

I attempted to follow instructions in several other forum answers, and all failed. One example is changing the

api-url

in {app}-shell.html from

app/rest

to

{app}/rest

, but this resulted in a 404 error instead. Additionally, this answer seems to be specific to custom names:

localhost:8080/{app}

whereas mine is the default:

localhost:8080/app-front

How can I gain access to my application again?

ENVIRONMENT

Studio 6.5.4 (upgraded from 6.5.3)
Platform 6.5.5 (upgraded from 6.5.3, I believe)
Chrome 58.0.3029.110
macOS 10.11.5
Git 2.10.1 (Apple Git-78)
Java 8 Update 121

The build is being run on the local machine, through the Studio “(Re)Start” button.

ERRORS

Main error:

INFO [http-nio-8080-exec-8] org.springframework.security.oauth2.provider.endpoint.TokenEndpoint.handleException Handling error: IllegalArgumentException, Service app-core/cuba_LoginService is not registered in LocalServiceDirectory

Other errors:

Initializes and destroys the following a few times:

Initializing Spring FrameworkServlet 'dispatcher'
Initializing Spring FrameworkServlet 'rest_api'
Initializing AtmosphereFramework

Then:

INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log No Spring WebApplicationInitializer types detected on classpath

Then:

SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.listenerStart Exception sending context initialized event to listener instance of class com.haulmont.cuba.core.sys.AppContextLoader
 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [cuba-spring.xml]: Invocation of init method failed; nested exception is java.lang.ClassCastException: org.slf4j.helpers.NOPLogger cannot be cast to ch.qos.logback.classic.Logger
Caused by: java.lang.ClassCastException: org.slf4j.helpers.NOPLogger cannot be cast to ch.qos.logback.classic.Logger
1 Like

I have been testing some more, and it seems that even simple project creations are failing when changing the database to MSSQL Server 2012+ before adding the Polymer client module. Previously it was failing completely (app-front wouldn’t load), now it is back to the failing login.
Here is a link to the zipped project with the deploy folder, but with .gradle/ deleted: https://drive.google.com/file/d/0B84oJtNxZpFEa2dNRHpOR3Q0S1k/view?usp=sharing

Hi,

It’s hard to understand how these exceptions are related to Polymer module creation. Could you please attach full app.log and zip archive with the project (if possible).

Hi,

I have the same exception after create web toolkit module.

22-Jun-2017 09:42:32.357 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.listenerStart Exception sending context initialized event to listener instance of class com.haulmont.cuba.core.sys.AppContextLoader
 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [cuba-spring.xml]: Invocation of init method failed; nested exception is java.lang.ClassCastException: org.slf4j.helpers.NOPLogger cannot be cast to ch.qos.logback.classic.Logger
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1583)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1076)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:851)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541)
	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
	at com.haulmont.cuba.core.sys.CubaClassPathXmlApplicationContext.<init>(CubaClassPathXmlApplicationContext.java:27)
	at com.haulmont.cuba.core.sys.CubaCoreApplicationContext.<init>(CubaCoreApplicationContext.java:26)
	at com.haulmont.cuba.core.sys.AppContextLoader.createApplicationContext(AppContextLoader.java:90)
	at com.haulmont.cuba.core.sys.AppContextLoader.createApplicationContext(AppContextLoader.java:36)
	at com.haulmont.cuba.core.sys.AbstractAppContextLoader.initAppContext(AbstractAppContextLoader.java:56)
	at com.haulmont.cuba.core.sys.AbstractWebAppContextLoader.contextInitialized(AbstractWebAppContextLoader.java:73)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4727)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5189)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
	at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1107)
	at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1841)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:748)

Hi, Caden.
Thank you for your sample project. Now we are investigating the problem.
To fix it locally delete the deploy/tomcat/lib folder and redeploy the application.
Regards.

In your test project, I see that the tomcat/lib folder contains some JARs which should not be there. For instance, slf4j-api-1.7.5.jar. Did you manually copy the libraries?
Could you say at which actions the unnecessary JARs (azure, jackson, mail etc) appeared in the tomcat/lib folder?

No, I didn’t manually copy the libraries. My process was as follows:

  1. Created a new project through Studio
  2. Edited the database details to match my environment in Studio (I did not "Generate Model" at all)
  3. Created the Polymer module in Studio
  4. I updated the database in Studio
  5. Deployed the project (again in Studio :) )
  6. Noticed the issue
  7. Duplicated the folder (macOS context menu command) in order to keep the original
  8. Deleted .gradle/
  9. Added it to Google Drive for sharing
I didn't monitor the JARs through the process, so I have no idea when the extra ones appeared.

Edit: I created a new test project to check for those JARs. I confirmed that I did have to update the database, and after clicking (Re)Start, at the same time when the tomcat/ folder was created, was when those JARs were created.

I tried the idea of deleting the deploy/tomcat/lib folder and redeploying my test project, but now it doesn’t want to start at all. The log at the bottom of Studio says “Build Successful”, but the page doesn’t connect, and the buttons indicate that the project is not deployed (the play button instead of the circular arrow and stop button, and the links to the front end are not active).

Edit: The JARs were regenerated after deleting the folder and redeploying, as well.

Everytime I attempt to add a polymer front end to any existing app. The same thing happens to me.
Login failed on polymer, and unexpected error on Generic UI.

28-Jun-2017 11:37:00.496 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log Initializing AtmosphereFramework
28-Jun-2017 11:37:00.508 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log No Spring WebApplicationInitializer types detected on classpath
28-Jun-2017 11:37:05.143 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log Initializing Spring FrameworkServlet 'dispatcher'
28-Jun-2017 11:37:06.365 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log Initializing Spring FrameworkServlet 'rest_api'
28-Jun-2017 11:37:08.001 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log Initializing AtmosphereFramework
28-Jun-2017 11:37:08.001 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log No Spring WebApplicationInitializer types detected on classpath
28-Jun-2017 11:37:10.345 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.listenerStart Exception sending context initialized event to listener instance of class com.haulmont.cuba.core.sys.AppContextLoader
 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [cuba-spring.xml]: Invocation of init method failed; nested exception is java.lang.ClassCastException: org.slf4j.helpers.NOPLogger cannot be cast to ch.qos.logback.classic.Logger
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1583)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1076)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:851)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541)
	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
	at com.haulmont.cuba.core.sys.CubaClassPathXmlApplicationContext.<init>(CubaClassPathXmlApplicationContext.java:27)
	at com.haulmont.cuba.core.sys.CubaCoreApplicationContext.<init>(CubaCoreApplicationContext.java:26)
	at com.haulmont.cuba.core.sys.AppContextLoader.createApplicationContext(AppContextLoader.java:90)
	at com.haulmont.cuba.core.sys.AppContextLoader.createApplicationContext(AppContextLoader.java:36)
	at com.haulmont.cuba.core.sys.AbstractAppContextLoader.initAppContext(AbstractAppContextLoader.java:56)
	at com.haulmont.cuba.core.sys.AbstractWebAppContextLoader.contextInitialized(AbstractWebAppContextLoader.java:73)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4727)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5189)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
	at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1107)
	at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1841)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassCastException: org.slf4j.helpers.NOPLogger cannot be cast to ch.qos.logback.classic.Logger
	at com.haulmont.cuba.core.sys.logging.EclipseLinkLog.getLog(EclipseLinkLog.java:54)
	at com.haulmont.cuba.core.sys.logging.EclipseLinkLog.shouldLog(EclipseLinkLog.java:96)
	at org.eclipse.persistence.internal.sessions.AbstractSession.shouldLog(AbstractSession.java:4566)
	at org.eclipse.persistence.internal.sessions.AbstractSession.log(AbstractSession.java:4742)
	at org.eclipse.persistence.internal.sessions.AbstractSession.log(AbstractSession.java:4716)
	at org.eclipse.persistence.internal.sessions.AbstractSession.log(AbstractSession.java:4692)
	at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:2027)
	at org.eclipse.persistence.jpa.PersistenceProvider.createContainerEntityManagerFactoryImpl(PersistenceProvider.java:347)
	at org.eclipse.persistence.jpa.PersistenceProvider.createContainerEntityManagerFactory(PersistenceProvider.java:313)
	at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:353)
	at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:373)
	at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:362)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1642)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1579)
	... 30 more

Thanks for the reports, we reproduced the problem.
It seems the issue relates to the projects which use MSSQL database.

The issue will be fixed with the next bugfix release, meanwhile you can delete tomcat, change your build.gradle in the following way:


        jdbc(mssql)
        testRuntime(mssql)

to


        jdbc(mssql) { exclude(group: 'com.microsoft.azure', module: 'azure-keyvault') }
        testRuntime(mssql) { exclude(group: 'com.microsoft.azure', module: 'azure-keyvault') }

and redeploy the project.

I delayed too long to test this solution, but I can confirm that it now works, even after the steps I listed above.

For future reference, it works on 6.5.5 (which is the release with this fix).

:ticket: See the following issue in our bug tracker:

https://youtrack.cuba-platform.com/issue/STUDIO-3783