Problem running Cuba application deployed to Tomcat in Cloud

Hi,
I’m trying to deploy the sample application into Tomcat which is hosted in the Cloud. I managed to get the Cuba login screen but when I entered the user ID and password it remains on the Login screen.

I notice there is an error in the log saying “HTTP Upgrade is not supported by this protocol”. Can someone help me identify the problem? Attached is the snapshot of the log file. Thanks.


2016-10-20 14:53:20.731 DEBUG [ajp-nio-33187-exec-1] com.haulmont.cuba.web.AppUI - Initializing AppUI
2016-10-20 14:53:20.731 DEBUG [ajp-nio-33187-exec-1] com.haulmont.cuba.web.App - Initializing application
20-Oct-2016 14:53:24.269 SEVERE [ajp-nio-33187-exec-1] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [app_servlet] in context with path [/life] threw exception
 java.lang.UnsupportedOperationException: HTTP upgrade is not supported by this protocol
	at org.apache.coyote.AbstractProcessor.doHttpUpgrade(AbstractProcessor.java:681)
	at org.apache.coyote.AbstractProcessor.action(AbstractProcessor.java:474)
	at org.apache.coyote.Request.action(Request.java:392)
	at org.apache.catalina.connector.Request.upgrade(Request.java:1960)
	at org.apache.catalina.connector.RequestFacade.upgrade(RequestFacade.java:1115)
	at org.apache.tomcat.websocket.server.UpgradeUtil.doUpgrade(UpgradeUtil.java:234)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:77)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
	at com.haulmont.cuba.web.sys.CubaHttpFilter.handleNotFiltered(CubaHttpFilter.java:108)
	at com.haulmont.cuba.web.sys.CubaHttpFilter.doFilter(CubaHttpFilter.java:95)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:108)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)
	at org.apache.coyote.ajp.AjpProcessor.service(AjpProcessor.java:476)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:802)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1410)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:745)

Regards,
Teddy

It means some problem exist with websocket.

Do you use proxy, for example nginx?

If yes then you need config your nginx to correctly proxy the websocket whih is used by vaadin Atmosphere framework.

Regards

Hi Sándor,

I’m using Tomcat Hosting by JavaPipe. I was told by them that there is a unique Port number assigned to my Tomcat container for example 33nnn. So, they suggest to access the web app that I deployed using that port number like this: http://www.xxx.com:33nnn/app. By using this way, I managed to get around the previous issue of “HTTP upgrade is not supported”.

However, I get another error that suggest to me that the application is still trying to access the default HTTP port 8080. Then, I tried to change the HTTP port setting from within the Cuba Studio to 33nnn, rebuild the WAR and re-deploy the WAR to my Tomcat. However, I still get the same error where the app is still trying to access port 8080.

Hope this additional info can give you a clearer picture of where the issue might be. Thanks.

This is the error log that I get

2016-10-21 09:48:46.297 DEBUG [http-nio-33186-exec-9] com.haulmont.cuba.web.AppUI - Initializing AppUI
2016-10-21 09:49:51.419 INFO [http-nio-33186-exec-7] com.haulmont.cuba.core.sys.remoting.ClusteredHttpInvokerRequestExecutor - Invocation of http://localhost:8080/life-core/remoting/cuba_LoginService failed: java.net.ConnectException: Connection refused
2016-10-21 09:49:51.420 INFO [http-nio-33186-exec-7] com.haulmont.cuba.core.sys.remoting.ClusteredHttpInvokerRequestExecutor - No more URL available
2016-10-21 09:49:51.420 DEBUG [http-nio-33186-exec-7] com.haulmont.cuba.web.log.AppLog - WARNING: SocketException in CommunicationManager. Most likely client (browser) closed socket.

Regards,
Teddy

I think, You ned setup correctly the web tier (app) and middleware tier (app-core) connection.
You can find the help in the documentation about scalling.

You probably need to configure the web client’s cuba.connectionUrlList variable correctly and probably set cuba.useLocalServiceInvocation to false, otherways the web client allways tries to connect to the middleware over 127.0.0.1:8080.

https://doc.cuba-platform.com/manual-6.2/scaling.html

Se stage2 for more information.

Regards

Do you build a single WAR or separate for web and core?

Hi Konstantin,

I build separate WAR for the app.

Hi Sándor,

Ok, I will look into the info you gave me. Thanks.

Then Sandor is right, you should set up the cuba.connectionUrlList property on the web tier. You can provide it to the buildWar task in the appProperties map.

Hi Sándor & Konstantin,

After I add in the cuba.connectionUrlList property in the buildWar, the previous problem is solved but then I get a different “HTTP 404” error.

Btw, I just noticed there was an error when app-core.WAR is deployed to Tomcat. The error comes from AppContextLoader - Error initializing application. Could it be the original problem?

Attached is the log starting from when the WAR(s) are deployed up to pressing Submit button at the Login screen. I hope you guys can help me find the problem from the log file. Thanks.

catalina_out.txt (46.5K)

I think your middleware (app-core) cannot start because of database problem.

The root cause is this error:

java.sql.SQLException: Invalid default value for ‘CREATE_TS’ Query: create table SYS_DB_CHANGELOG(SCRIPT_NAME varchar(255) not null primary key, CREATE_TS DATETIME default current_timestamp, IS_INIT integer default 0) Parameters: []

So the middleware failed to start, and then web client cannot access it.

Exactly.

Probably your cloud provider uses MySQL of a version older than 5.6. Unfortunately, CUBA supports only 5.6+.

Hi Sándor & Konstantin,

Yes, I think MYSQL is the problem. Thank you all for the helps.