You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@guacamole.apache.org by Michał Kalinowski <mi...@uni.opole.pl.INVALID> on 2020/08/31 12:14:42 UTC

Non-numeric character in element length error

Hello,

Recently I was trying to integrate Guacamole into my Spring application, 
but I encountered a Guacamole Exception just like in the description.

I create tunnel just like in guide:

protected GuacamoleTunnel doConnect(HttpServletRequest request)
         throws GuacamoleException {

         // Create our configuration
         GuacamoleConfiguration config = new GuacamoleConfiguration();
         config.setProtocol("vnc");
         config.setParameter("hostname", "localhost");
         config.setParameter("port", "5901");
         config.setParameter("password", "potato");

         // Connect to guacd - everything is hard-coded here.
         GuacamoleSocket socket = new ConfiguredGuacamoleSocket(
                 new InetGuacamoleSocket("localhost", 4822),
                 config
         );

         // Return a new tunnel which uses the connected socket
         return new SimpleGuacamoleTunnel(socket);;


Except in socket creation I mention my docker image of guacamole client instead of localhost and 4822 as arguments. When I use this address in web browser the guacamole
user interface pops out and it works just fine - I can connect to remote desktops via VNC.

I think the address I put in there isn't the one. I tried putting there the guacamole API address from the same docker image but with no use too.

There may be a problem as well with me invoking the connect method:

	public String VNC(HttpServletRequest request, String IP)
	{
		GuacamoleConnector guacConnect = new GuacamoleConnector();

		GuacamoleTunnel tunnel = guacConnect.doConnect(request,IP);
		request.setAttribute("tunnel", tunnel);
	}

But this exception really doesn't tell me what is going on, so I'd appreciate some clue on the case.

Kind regards,
Michael


Re: Non-numeric character in element length error

Posted by Nick Couchman <vn...@apache.org>.
On Mon, Aug 31, 2020 at 9:02 AM Michał Kalinowski
<mi...@uni.opole.pl.invalid> wrote:

> That is actually a very clever point that I didn't consider, but
> unfortunately both arguments for *setParameter* method must be a String.
> It will not accept an Integer. And this part is copy/paste exactly from the
> Guacamole guide, so I don't think that's the part that causes this error.
>
> Oops, sorry about that, you are correct.


> The exception tells that this operation:
>
>
> *GuacamoleSocket socket = new ConfiguredGuacamoleSocket(*
> *                    new
> InetGuacamoleSocket("http://exampledockerpage.mydomain.com"
> <http://exampledockerpage.mydomain.com>, 8443),*
> *                    config*
> *            );*
>
>
> causes it to be thrown. Description of *InetGuacamoleSocket *constructor shows
> that I should provide Guacamole proxy server and the port, but should those
> be the same as in the address that I can access Guacamole Clinet panel at?
>
>
>
No, the InetGuacamoleSocket should be connecting to your guacd system, so
it should be the hostname/IP of the system where guacd is running and the
port guacd is running on (4822 by default).  The example you cited has the
defaults - localhost (assuming guacd and Tomcat/Spring are running on the
same system, and 4822 by default.  In a Docker environment you'd just need
to change localhost to the internal hostname or IP of the container running
guacd.

-Nick

>

Re: Non-numeric character in element length error

Posted by Michał Kalinowski <mi...@uni.opole.pl.INVALID>.
That is actually a very clever point that I didn't consider, but 
unfortunately both arguments for /setParameter/ method must be a String. 
It will not accept an Integer. And this part is copy/paste exactly from 
the Guacamole guide, so I don't think that's the part that causes this 
error.

The exception tells that this operation:


/GuacamoleSocket socket = new ConfiguredGuacamoleSocket(//
//                    new 
InetGuacamoleSocket("http://exampledockerpage.mydomain.com", 8443),//
//                    config//
//            );/

/
/

causes it to be thrown. Description of /InetGuacamoleSocket 
/constructor//shows that I should provide Guacamole proxy server and the 
port, but should those be the same as in the address that I can access 
Guacamole Clinet panel at?


W dniu 31.08.2020 o 14:41, Nick Couchman pisze:
> On Mon, Aug 31, 2020 at 8:14 AM Michał Kalinowski 
> <mi...@uni.opole.pl.invalid> wrote:
>
>     Hello,
>
>     Recently I was trying to integrate Guacamole into my Spring
>     application, but I encountered a Guacamole Exception just like in
>     the description.
>
>     I create tunnel just like in guide:
>
>     protected GuacamoleTunnel doConnect(HttpServletRequest request)
>              throws GuacamoleException {
>
>              // Create our configuration
>              GuacamoleConfiguration config = new GuacamoleConfiguration();
>              config.setProtocol("vnc");
>              config.setParameter("hostname", "localhost");
>              config.setParameter("port", "5901");
>
>
> I think this is your issue, here - the port number should be an 
> integer value, not a string.
>
> -Nick

Re: Non-numeric character in element length error

Posted by Nick Couchman <vn...@apache.org>.
On Mon, Aug 31, 2020 at 8:14 AM Michał Kalinowski
<mi...@uni.opole.pl.invalid> wrote:

> Hello,
>
> Recently I was trying to integrate Guacamole into my Spring application,
> but I encountered a Guacamole Exception just like in the description.
>
> I create tunnel just like in guide:
>
> protected GuacamoleTunnel doConnect(HttpServletRequest request)
>         throws GuacamoleException {
>
>         // Create our configuration
>         GuacamoleConfiguration config = new GuacamoleConfiguration();
>         config.setProtocol("vnc");
>         config.setParameter("hostname", "localhost");
>         config.setParameter("port", "5901");
>
>
I think this is your issue, here - the port number should be an integer
value, not a string.

-Nick