Play! framwork: running `h2-browser` works, but th

2019-04-13 16:52发布

问题:

When I run the command activator h2-browser it opens the browser with the following url:

192.168.1.17:8082

But I get (using Chrome):

This webpage is not available

The weird thing is it actually worked before. The only thing I changed since then is the JAVA_OPTS in order to enable debugging. I reinstalled Java and I think now there's no environment variable JAVA_OPTS.

Anyway, why is it happening?

Update
What is even more weird is that when I press view-source I get a webpage with this announcement (this is part of the webpage):

<h1>Welcome to H2</h1>
<h2>No Javascript</h2>
If you are not automatically redirected to the login page, then
Javascript is currently disabled or your browser does not support Javascript.
For this application to work, Javascript is essential.
Please enable Javascript now, or use another web browser that supports it.

But I do enable Javascript (I validated it by checking the settings, and also tried from Firefox)

Additional information
I'm using Java 1.8 and I don't know what was the value of JAVA_OPTS before I changed it, following this tutorial: http://andikanugraha.com/2014/05/debug-typesafe-activator-play-framework-using-eclipse/

I removed Java completely and reinstall it. I think right now there's no JAVA_OPTS variable at all.

this is my database config:

db.default.driver="org.h2.Driver"
db.default.url="jdbc:h2:file:main2.db" 
db.default.user=sa
db.default.password=""

回答1:

That happens because the app is terminating itself immediately. I guess this is a bug in Play.

When launching it in continuous mode, everything works fine:

activator ~h2-browser

or

sbt ~h2-browser

Alternatively, you can start activator or sbt first, and from its command-line run h2-browser.