webAllowOthers needed when running h2.bat?

2,211 views
Skip to first unread message

maxhearn

unread,
Oct 1, 2008, 12:45:59 PM10/1/08
to H2 Database
I upgraded from version 1.0.77 to 1.0.79 a few days ago. So far,
1.0.79 looks fine to me when I call it from my application, which is
all I really care about.

But, I've noticed one new behavior when using h2.bat to access the
database through a browser command window.

When I run h2.bat with no arguments, the H2 Console window pops up in
a browser, but it says, "Sorry, remote connections ('webAllowOthers')
are disabled on this server". Subsequent attempts to run h2.bat fail
by telling me that port 8082 is already in use, and I need to find and
kill the java process in task manager to free up the port.

When the port is free, if I run h2.bat specifying the -webAllowOthers
argument, all is fine.

I don't think I've had to specify -webAllowOthers in earlier
releases. Is that the intended behavior?

I've tried this on two machines, one of which was a clean install of
h2. I observe the same behavior on both.

Thomas Mueller

unread,
Oct 1, 2008, 4:32:36 PM10/1/08
to h2-da...@googlegroups.com
Hi,

I have a few questions.

> When I run h2.bat with no arguments, the H2 Console window pops up in
> a browser, but it says, "Sorry, remote connections ('webAllowOthers')
> are disabled on this server". Subsequent attempts to run h2.bat fail
> by telling me that port 8082 is already in use, and I need to find and
> kill the java process in task manager to free up the port.

On my machine, a small (AWT-) window appears with the title "H2
Console", the URL (http://localhost:8082 in my case), and a button
'Start Browser'. Does this window appear for you as well? What Java
version and operating system do you use?

Does it say anything on the command line after you started it? For me,
it does not. To what URL does the browser (try to) connect? For me
it's http://localhost:8082.

> I don't think I've had to specify -webAllowOthers in earlier
> releases. Is that the intended behavior?

It should only be required if you want to access the H2 Console from
another machine (this is disabled by default for security reasons).

Regards,
Thomas

maxhearn

unread,
Oct 1, 2008, 5:48:37 PM10/1/08
to H2 Database
I think this answers everything you asked:

1) Just as a sanity check, I've tried flipping back and forth between
version .77 and .79. I definitely don't see the problem with .77, but
I do see it with .79.

2) I've tried this with several Java versions: 1.6.12 and 1.5.4. I
get the same results each time.

3) I'm running on Windows XP.

4) In .77: I get the H2 Console window (AWT). The URL is http://localhost:8082.
Then I get the browser window, connecting to http://localhost:8082/login.jsp?jsessionid=xxx
. And the contents give me a login screen. In the DOS command
window, it says nothing on the command line after H2.

5) In .79: I get the H2 Console window (AWT). The URL is
http://144.xxx.xxx.xxx:8082. Then I get the browser window,
connecting to http://144.xxx.xxx.xxx:8082/ . And the contents say H2
Console. Sorry, remote connections ('webAllowOthers') are disabled on
this server. In the DOS command window, it says nothing on the
command line after H2. (Oh, and closing the H2 AWT window is
sufficient to allow me to try to connect again - I was wrong about
needing to kill the process in task manager.)

6) So, as you surmised, it doesn't think it is attempting to make a
local connection in version .79.


On Oct 1, 1:32 pm, "Thomas Mueller" <thomas.tom.muel...@gmail.com>
wrote:
> Hi,
>
> I have a few questions.
>
> > When I run h2.bat with no arguments, the H2 Console window pops up in
> > a browser, but it says, "Sorry, remote connections ('webAllowOthers')
> > are disabled on this server".  Subsequent attempts to run h2.bat fail
> > by telling me that port 8082 is already in use, and I need to find and
> > kill the java process in task manager to free up the port.
>
> On my machine, a small (AWT-) window appears with the title "H2
> Console", the URL (http://localhost:8082in my case), and a button
> 'Start Browser'. Does this window appear for you as well? What Java
> version and operating system do you use?
>
> Does it say anything on the command line after you started it? For me,
> it does not. To what URL does the browser (try to) connect? For me
> it'shttp://localhost:8082.

Thomas Mueller

unread,
Oct 2, 2008, 1:44:56 PM10/2/08
to h2-da...@googlegroups.com
Hi,

There was a change in the last release "The server tool now displays
the correct IP address if networked." This was changed to support
AUTO_SERVER mode, but also (I believe) it's nice to get the 'real' IP
address and not just 'localhost'. I can reproduce the problem now by
doing this:

- connect to a LAN (I get the IP address 10.0.x.x)
- start the H2 Console (this works so far)
- enable the WLAN (I get a second IP address: 10.10.x.x)
- open the URL http://10.0.x.x...

A workaround is to use 'localhost' to connect. I found a fix:

NetUtils.isLoopbackAddress(Socket socket) throws UnknownHostException {
InetAddress test = socket.getInetAddress();
boolean result = true;
//## Java 1.4 begin ##
result = test.isLoopbackAddress();
if (result) {
return result;
}
//## Java 1.4 end ##
InetAddress localhost = InetAddress.getLocalHost();
InetAddress[] list =
InetAddress.getAllByName(localhost.getCanonicalHostName());
for (int i = 0; i < list.length; i++) {
InetAddress addr = list[i];
if (test.equals(addr)) {
return true;
}
}
return false;
}

If you have time, could you test if this works for you? This shouldn't
ever throw an exception (but it's better to log them, just in case).
This will be included in the next release. The release notes will be:
"Connections from a local address other than 'localhost' were not
allowed if remote connections were disabled. This was always a
problem, but only got visible in the last release because the server
no longer connects to 'localhost' if networked."

Regards,
Thomas

Reply all
Reply to author
Forward
0 new messages