billchen198318 / bamboobsc

next version move to https://github.com/billchen198318/hillfog, bambooBSC is an opensource Balanced Scorecard (BSC) Business Intelligence (BI) Web platform. BSC's Vision, Perspectives, Objectives of strategy, Key Performance Indicators (KPIs), Strategy Map, and SWOT, PDCA & PDCA report, Time Series Analysis.
Apache License 2.0
227 stars 110 forks source link

Bamboo stucks on "Loading...." if serverd by Apache Web Server proxying Tomcat-BambooBSC #59

Open spulci opened 6 years ago

spulci commented 6 years ago

I've got an issue that I cannot figure out. I'm serving the default Tomcat Bamboo BSC 0.7.4 bundle on a Ubuntu Server 16.04 LTS. My config has an Apache Web Server 2.4.18. BambooBSC responds correctly on this machine with default server.xml and Apache Web Server shutted down. Starting Apache with the configuration below makes BambooBSC unresponsive stuck on "Loading...." blue message after a succesfull log-in (log in page is correctly served to the browser). No errors are present on the Catalina.out nor on the Apache log (all the resources are served with an HTTP 200 message).

Server.xml main details:

<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> <Connector port="8080" protocol="org.apache.coyote.http11.Http11Nio2Protocol" connectionTimeout="20000" redirectPort="8443" compression="on" compressionMinSize="2048" compressableMimeType="text/html,text/xml,text/plain,text/css,text/javascript,applicati/javascript,application/json,text/json" proxyName="myservername.com" proxyPort="80"/>

Apache 2 conf main details:

ServerName myservername.com ProxyPreserveHost on ProxyPass / http://myservername.com:8080/ ProxyPassReverse / http://myservername.com:8080/ ProxyRequests Off

billchen198318 commented 6 years ago

I no try work with Apache-2 proxy, but you maybe can to try change Server.xml , modify Connector item settings to Tomcat8 default value.

<Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
billchen198318 commented 6 years ago

https://stackoverflow.com/questions/26504776/apache-and-tomcat-8-configure-proxy

spulci commented 6 years ago

Thanks @billchen198318 . Unfortunately the issue persist even using your suggestions. BTW I think that the incriminated code that may cause the issue under Apache 2 web server is this javascript using DOJO js:

function loadMessagePublish() { var socket = dojox.socket.LongPoll({ url:"/core-web/publish?id=PUBMSG0001&account=admin&refreshUUID=b7eb7550-4882-11e8-b44f-d786e39a9a38", headers: { "Accept": "application/json", "Content-Type": "application/json", "Client-Id": Math.random() } }); socket.on("open", function(event){ socket.send(""); }); socket.on("message", function(event) { require(["dojo/json", "dojo/dom", "dojo/on", "dojo/domReady!"], function(JSON, dom, on){ var obj = JSON.parse(event.data); if (obj!=null && obj.message!=null && obj.message!='' ) { if (dojo.byId('_my_message').innerHTML.length>=10000) { dojo.byId('_my_message').innerHTML = ''; } if ('Y' == obj.success) { dojo.byId('_my_message').innerHTML = obj.message + dojo.byId('_my_message').innerHTML; } } }); }); }

You're are opening a WebSocket connection. Apache2 by default needs a module to be activated to support WebSocket:

http://httpd.apache.org/docs/2.4/mod/mod_proxy_wstunnel.html

Added this one I inserted two new entries to my apache config for the ProxyPass entry. Could you please confirm that the URI generated by this code are like this:

ws://mydomain.com/core-web/..... wss://mydomain.com/core-web/....

can't debug the js script myself for the fact that while running on my Firefox 59 istance dojox.socket is undefined.

billchen198318 commented 6 years ago

Hi

I think not to use the WebSocket feature for this message push (06 - Message notice). Because the feature no any meaning. You might consider using a correction program without push functionality to try it out.

  1. download the left_jsp.zip left_jsp.zip

  2. unzip the left_jsp.zip , will has a file name left.jsp

  3. copy the left.jsp over the before file in directory core-web/pages/ to over before file left.jsp .

spulci commented 6 years ago

Jsp does not fix the issue. I had investigated a bit more. Shutting down Apache, leaving Tomcat alone still gives issues. Try yourself: use Tomcat standalone, version provided inside your 0.7.4 distribution, changing just the connector port from 8080 to 80. Start, you will reach index.action with the login page...then submit your login credentials (like the admin one provided)...Bamboo will stuck on a "loading..." message on a white page forever. No exception in the catalina.out. Could you please check if port 8080 is hardcoded inside the app in the code? I've found a possible issue in the static method getHttpPort inside the HostUtils class

if (protocolHandler instanceof Http11Protocol || protocolHandler instanceof Http11AprProtocol || protocolHandler instanceof Http11NioProtocol) { port = connector.getPort(); }

For example, the default connector inside the server.xml belongs to a different type (it's an Http11Nio2Protocol type). I've got no time to donwload the code at the moment but I suspect that port 8080 maybe used as a default value so that the page with the "loading..." msg has some sort of ajax component waiting for a reply from a service called on the wrong port if the app has been started on a port different from the 8080.

billchen198318 commented 6 years ago

Are you means load stuck is HostUtils.getHttpPort() affect it.

HostUtils.getHttpPort() usually will call when bambooBSC on start. Use in ApplicationSiteUtils.configureHost(String sysId, String logConfFileFullPath) when com.netsteadfast.greenstep.support.ConfigureAppSiteHostForContextInitialized on tomcat start listener

Use 09 - Web Context bean can remove ConfigureAppSiteHostForContextInitialized item on settings. https://github.com/billchen198318/bamboobsc/blob/master/core-doc/dev-docs/14-WebContextBean.md

But cannot login success , use SQL manual to delete the item to.

delete from tb_sys_ctx_bean where CLASS_NAME='com.netsteadfast.greenstep.support.ConfigureAppSiteHostForContextInitialized'
billchen198318 commented 6 years ago

But i think, if is HostUtils.getHttpPort() affect it, tomcat8 will start fail. so maybe is not this point.

antoniusng commented 6 years ago

Hi, I got the same problem.

I found out some problems(and how i fixed it):

  1. File webapps/core-web/pages/index.jsp, the function in dojo.addOnLoad did not run. I tried using setTimeout instead. (ugly.. i know)
  2. All the widget were not registered properly. Had to add dojo.parser.parse(document.body) in the function mentioned above.
  3. Sometimes nv.d3.js was called before d3.js
  4. Some widgets were trying to load from server internal IP Address (shown in red below) internalip I changed the internal ip address to external (or domain) in MySQL database, table tb_sys for CONTEXT_PATH gsbsc-web.

Hope it helps.

Also, I am not familiar with dojo framework, so I am sure there are better ways to fix the above problems.

Cheers,

Anton

billchen198318 commented 6 years ago

Hi antoniusng, are you browser use Chrome or firefox ?

I think maybe is manual DOJO package the d3 & nv.d3 problems, In some environments will Loading error.

I will arrange some time for a revision change, use Echarts replace d3 & nv.d3 and Highcharts.

Hi antoniusng, can you help me try remove the script in index.jsp, on you environment. look load status.

<script>
var dojoConfig = {
            parseOnLoad: true,
            packages: [
                { name: "d3",       location: "<%=basePath%>/d3/",  main: "d3"      },
                { name: "nv",       location: "<%=basePath%>/d3/",  main: "nv.d3"   }
            ]   
};
</script> 
antoniusng commented 6 years ago

Hi @billchen198318,

Tried removing the script in index.jsp. Same problem widget not registered, so still had to do dojo.parser.parse.

Cheers,

Anton

billchen198318 commented 6 years ago

Hi antoniusng,

can you download and try use VM version on you environments . try if the VM version also happens it.

VM version download: https://github.com/billchen198318/bamboobsc/releases/download/v0.7.4/bamboobsc-0.7.4-RELEASE-VM.7z

and you browser is Chrome or firefox ?

thanks.

antoniusng commented 6 years ago

I deployed BambooBSC in my Linux Server.

I tried on Chrome and Firefox. Both have the same error.