Hi,
I have been struggling to set-up the Sebster Tunnel using apache port forwarding from port 80 for nearly a year.
Whilst I can seem to get a webclient working at least in the environment, I continue to struggle with Smart Client, and the tunnel.
I want to try to use this thread to sort this out and then write it up into a single document, so others can then do it with ease!
So, as people see the error of my ways, please comment and i will ammend my master “How To” Document and then publish it for all.
Here goes! (btw pltform is windows 2003 server, Servoy 5.2.2)
Step 1. Apache Server httpd.conf:
a. in the httpd.conf file, uncomment the following lines:
LoadModule include_module modules/mod_include.so
#LoadModule info_module modules/mod_info.so
LoadModule isapi_module modules/mod_isapi.so
#LoadModule ldap_module modules/mod_ldap.so
#LoadModule logio_module modules/mod_logio.so
LoadModule log_config_module modules/mod_log_config.so
#LoadModule log_forensic_module modules/mod_log_forensic.so
#LoadModule mem_cache_module modules/mod_mem_cache.so
LoadModule mime_module modules/mod_mime.so
#LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
#LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
#LoadModule reqtimeout_module modules/mod_reqtimeout.so
#LoadModule rewrite_module modules/mod_rewrite.so
LoadModule setenvif_module modules/mod_setenvif.so
#LoadModule speling_module modules/mod_speling.so
#LoadModule ssl_module modules/mod_ssl.so
#LoadModule status_module modules/mod_status.so
#LoadModule substitute_module modules/mod_substitute.so
#LoadModule unique_id_module modules/mod_unique_id.so
#LoadModule userdir_module modules/mod_userdir.so
#LoadModule usertrack_module modules/mod_usertrack.so
#LoadModule version_module modules/mod_version.so
#LoadModule vhost_alias_module modules/mod_vhost_alias.so
It appears that the important lines her are the: mod_proxy_http.so, mod_proxy_connect.so,mod_proxy_ajp.so and mod_proxy.so itself.
b. The other important setting is the virtual hosts nearer the bottom of the file:
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
It would appear the this allows the proxy module to communicate both over http and ajp (needed for sebsters tunnel) and also switched on the preference file to allow you to define your proxy settings.
Step 2. Apache Server Proxy Settings: extra/httpd-vhosts.conf
Whilst I dont fully understand this code and it has been taken from a couple of people. It would appear that this proxies port 80 when addressed as “corex.corexreports.co.uk” to port 8080 for http requests and 8009 for ajp requests. The ajp requests are what appear to be needed for sebs tunnel.
One aside, i dont understand why the “ProxyRequests Off” is needed, but it appears from the documentation that this doesnt do what you would think it does and switch the proxy off!?
NameVirtualHost *:80
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host.melbourne.co.uk
DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/docs/dummy-host.melbourne.co.uk"
ServerName corex.corexreports.co.uk
ErrorLog "logs/dummy-host.melbourne.co.uk-error.log"
CustomLog "logs/dummy-host.melbourne.co.uk-access.log" common
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPreserveHost On
ProxyPass /tunnel ajp://corex.corexreports.co.uk:8009/tunnel flushpackets=on
ProxyPass / http://corex.corexreports.co.uk:8080/
ProxyPassReverse / http://corex.corexreports.co.uk:8080/
So at this point it seems that all is set-up to pass all http requests to port 80 and back again and ajp requests to 8009.
Restart Apache
Step 3: Servoy Application Server: application_server\server\conf
In the server.xml file you need to add the ajp connector (). For completeness her is my sever.xml file
<Server port="8005" shutdown="SHUTDOWN_NOW">
<Service name="Catalina">
<Connector port="8080"
protocol="HTTP/1.1"
maxThreads="500" connectionTimeout="60000"
redirectPort="8443" useBodyEncodingForURI="true" />
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" connectionTimeout="60000" maxThreads="400" />
<Engine name="Catalina" defaultHost="localhost">
<Realm className="org.apache.catalina.realm.MemoryRealm" />
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs" prefix="localhost_access_log." suffix=".txt"
pattern="common"/>
<Context path="/lib" docBase="../../lib"/>
<Context path="/plugins" docBase="../../plugins"/>
<Context path="/beans" docBase="../../beans"/>
<Context path="/lafs" docBase="../../lafs"/>
</Host>
</Engine>
</Service>
</Server>
Step 4: Servoy Application Server: servoy.properties file.
The following need to be set:
- The Sebster Tunnel Switched on:
SocketFactory.rmiServerFactory=com.servoy.j2db.server.rmi.tunnel.ServerTunnelRMISocketFactoryFactory
SocketFactory.compress=true
SocketFactory.tunnelConnectionMode=http
SocketFactory.useSSL=true
SocketFactory.useTwoWaySocket=true
- Also, i think you need to tell servoy there is a proxy, so you refer it to the basic server url with
servoy.jnlpCodebaseOverride=http\://corex.corexreports.co.uk
One more tip, seb gave me when communicating was to add this to the properties file as well:
system.property.com.sebster.tunnel.http.client.chunked=true
So finally with this all done it should work!!!
BUT IT DOESN’T.
The webclient appears to work fine and proxies OK. When you try to download a smart client, having removed an 3rd party plugins, as they seemed to be stopping any download, then it doesnt seem to be finding the tunnel server:
Oct 9, 2010 12:36:23 PM sun.rmi.transport.tcp.TCPTransport$AcceptLoop executeAcceptLoop
WARNING: RMI TCP Accept-3000: accept loop for ServerSocket[addr=null,port=0,localport=0] throws
java.io.IOException: Tunnel server failed
at com.sebster.tunnel.impl.v.a(v.java:34)
at com.sebster.tunnel.impl.eb.b(eb.java:104)
at com.sebster.tunnel.impl.eb.accept(eb.java:26)
at com.sebster.tunnel.impl.gb.accept(gb.java:57)
at com.sebster.tunnel.TunnelServerSocket.accept(TunnelServerSocket.java:7)
at com.sebster.tunnel.TunnelServerSocket.accept(TunnelServerSocket.java:15)
at com.servoy.j2db.rmi.compressing.CompressingServerSocket.accept(CompressingServerSocket.java:46)
at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.executeAcceptLoop(TCPTransport.java:369)
at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.run(TCPTransport.java:341)
at java.lang.Thread.run(Thread.java:637)
Caused by: java.io.IOException: Error in read
at com.sebster.tunnel.impl.v.a(v.java:34)
at com.sebster.tunnel.impl.tc.b(tc.java:148)
at com.sebster.tunnel.impl.tc.f(tc.java:137)
at com.sebster.tunnel.impl.tc.read(tc.java:35)
at com.sun.net.ssl.internal.ssl.InputRecord.readFully(InputRecord.java:293)
at com.sun.net.ssl.internal.ssl.InputRecord.read(InputRecord.java:331)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:789)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:746)
at com.sun.net.ssl.internal.ssl.AppInputStream.read(AppInputStream.java:75)
at com.sun.net.ssl.internal.ssl.AppInputStream.read(AppInputStream.java:50)
at com.sebster.tunnel.impl.v.e(v.java:46)
at com.sebster.tunnel.impl.ad.run(ad.java:94)
... 1 more
Caused by: org.apache.http.NoHttpResponseException: The target server failed to respond
at org.apache.http.impl.conn.DefaultResponseParser.parseHead(DefaultResponseParser.java:101)
at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:252)
at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:271)
at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:227)
at org.apache.http.impl.conn.AbstractClientConnAdapter.receiveResponseHeader(AbstractClientConnAdapter.java:217)
at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:291)
at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:485)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:689)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:624)
at com.sebster.tunnel.impl.a.run(a.java:23)
... 1 more
Oct 9, 2010 12:36:23 PM com.sebster.tunnel.impl.sb a
INFO: using direct connection
Oct 9, 2010 12:36:23 PM com.sebster.tunnel.impl.sb a
INFO: jcifs library found; NTLM support enabled
network: Connecting socket://corex.corexreports.co.uk:80 with proxy=DIRECT
It is very frustrating, as one always feels just one step away from a working solution.
I wonder whether I am note understanding the code base override setting, but this is where the subdomain is pointing and the url i put into my local browser.
If anyone has this working sucessfully, then I would be keen to know what is wrong here, or if you are out there seb, perhaps you can spot the schoolboy error!
Thanks
David