Re: Issue running Websockets JSR356 with Tomcat 7.0.50 Embedded

2014-02-25 Thread Jacopo Cappellato
Any hints? I would really appreciate if someone could provide some pointers 
(e.g. classes involved etc) about the implementation of the mechanism used to 
discover and deploy endpoints; I will then try to study the code in order to 
figure out why it doesn't work when I set jarScanner.setScanClassPath(false)

Thanks,

Jacopo

On Feb 14, 2014, at 7:58 PM, Jacopo Cappellato jacopo.cappell...@gmail.com 
wrote:

 Here is the client code that I use to recreate the problem:
 
public static void main(String[] args) throws Exception {
 
String currentDir = new File(.).getCanonicalPath();
String tomcatDir = currentDir + File.separatorChar + tomcat;
String webRoot = currentDir + File.separatorChar + examples;
 
Tomcat tomcat = new Tomcat();
tomcat.setBaseDir(tomcatDir);
tomcat.setPort(8080);
 
tomcat.addWebapp(/examples, webRoot);
 
// this code gets the JarScanner and sets scanClassPath to false:
// with this setting the websockets are not deployed
Container[] containers = 
 tomcat.getService().getContainer().findChildren();
StandardHost host = (StandardHost)containers[0];
containers = host.findChildren();
StandardContext ctx = (StandardContext)containers[0];
StandardJarScanner jarScanner = 
 (StandardJarScanner)ctx.getJarScanner();
jarScanner.setScanClassPath(false); // if this is set to true the 
 websockets are deployed successfully
 
tomcat.start();
 
while (true) {
Thread.sleep(9);
}
}
 
 I run this code from a folder containing the examples webapp and the Tomcat 
 jars.
 
 Is there a way to deploy successfully the websockets with 
 setScanClassPath(false) ?
 
 Thanks,
 
 Jacopo


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Issue running Websockets JSR356 with Tomcat 7.0.50 Embedded

2014-02-25 Thread Mark Thomas
On 25/02/2014 15:14, Jacopo Cappellato wrote:
 Any hints? I would really appreciate if someone could provide some
 pointers (e.g. classes involved etc) about the implementation of the
 mechanism used to discover and deploy endpoints; I will then try to
 study the code in order to figure out why it doesn't work when I set
 jarScanner.setScanClassPath(false)

Presumably because the Endpoints you are trying to deploy are not part
of the web application (i.e. in WEB-INF/classes or WEB-INF/lib) and
loaded by the web application but are on the class path.

Mark

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Issue running Websockets JSR356 with Tomcat 7.0.50 Embedded

2014-02-25 Thread Jacopo Cappellato

On Feb 25, 2014, at 4:20 PM, Mark Thomas ma...@apache.org wrote:

 On 25/02/2014 15:14, Jacopo Cappellato wrote:
 Any hints? I would really appreciate if someone could provide some
 pointers (e.g. classes involved etc) about the implementation of the
 mechanism used to discover and deploy endpoints; I will then try to
 study the code in order to figure out why it doesn't work when I set
 jarScanner.setScanClassPath(false)
 
 Presumably because the Endpoints you are trying to deploy are not part
 of the web application (i.e. in WEB-INF/classes or WEB-INF/lib) and
 loaded by the web application but are on the class path.

Well, actually in my unit test (posted in this thread) I am deploying the 
examples application of Tomcat, and the websockets in it are under the WEB-INF 
folder.

Jacopo

 
 Mark
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org
 


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Issue running Websockets JSR356 with Tomcat 7.0.50 Embedded

2014-02-25 Thread Konstantin Kolinko
2014-02-25 19:14 GMT+04:00 Jacopo Cappellato jacopo.cappell...@gmail.com:
 Any hints? I would really appreciate if someone could provide some pointers 
 (e.g. classes involved etc) about the implementation of the mechanism used to 
 discover and deploy endpoints; I will then try to study the code in order to 
 figure out why it doesn't work when I set jarScanner.setScanClassPath(false)

The discovery is done with an SCI
(javax.servlet.ServletContainerInitializer), as defined in
tomcat7-websocket.jar/META-INF/services.  The class name is
org.apache.tomcat.websocket.server.WsSci.
It seems that you prevented its discovery by skipping that jar in your
JarScanner.


You can also bootstrap web sockets by defining a listener in web.xml
(org.apache.tomcat.websocket.server.WsContextListener).
That listener just starts and shuts down the websocket engine, it does
not scan for endpoints.

http://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/tomcat/websocket/server/WsContextListener.html

Best regards,
Konstantin Kolinko

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Issue running Websockets JSR356 with Tomcat 7.0.50 Embedded

2014-02-14 Thread Jacopo Cappellato
Here is the client code that I use to recreate the problem:

public static void main(String[] args) throws Exception {

String currentDir = new File(.).getCanonicalPath();
String tomcatDir = currentDir + File.separatorChar + tomcat;
String webRoot = currentDir + File.separatorChar + examples;

Tomcat tomcat = new Tomcat();
tomcat.setBaseDir(tomcatDir);
tomcat.setPort(8080);

tomcat.addWebapp(/examples, webRoot);

// this code gets the JarScanner and sets scanClassPath to false:
// with this setting the websockets are not deployed
Container[] containers = 
tomcat.getService().getContainer().findChildren();
StandardHost host = (StandardHost)containers[0];
containers = host.findChildren();
StandardContext ctx = (StandardContext)containers[0];
StandardJarScanner jarScanner = (StandardJarScanner)ctx.getJarScanner();
jarScanner.setScanClassPath(false); // if this is set to true the 
websockets are deployed successfully

tomcat.start();

while (true) {
Thread.sleep(9);
}
}

I run this code from a folder containing the examples webapp and the Tomcat 
jars.

Is there a way to deploy successfully the websockets with 
setScanClassPath(false) ?

Thanks,

Jacopo


On Feb 13, 2014, at 6:47 PM, Jacopo Cappellato jacopo.cappell...@gmail.com 
wrote:

 Hello all,
 
 I did further tests and I have now implemented a test client that executes a 
 Tomcat embedded instance that is successfully running websockets.
 The client code resembles quite closely what we are doing in OFBiz to prepare 
 the Tomcat instance... and I think I have found the settings that is causing 
 the issue in OFBiz.
 When in OFBiz we create the Context objects we set in their JarScanner (we 
 use the StandardJarScanner): setScanClassPath(false)
 
 I have noticed that if in my test client I set the same the websockets are 
 not mounted; they only work with setScanClassPath(true).
 
 Since I doubt we will be able to set it to true in OFBiz, I would really 
 appreciate if you could provide some hints about the mechanism that Tomcat 
 uses to deploy websockets.
 
 Am I completely off track?
 
 Thanks,
 
 Jacopo
 
 On Jan 29, 2014, at 4:42 PM, Jacopo Cappellato jacopo.cappell...@gmail.com 
 wrote:
 
 Hello all,
 
 I am trying to deploy and use Websockets using the Tomcat 7.0.50 *Embedded* 
 distribution [*].
 
 Some more details on my environment:
 * I have the following jars in my classpath:
 ** tomcat-7.0.50-tomcat-embed-core.jar
 ** tomcat-7.0.50-tomcat-embed-jasper.jar
 ** tomcat-7.0.50-tomcat-embed-logging-log4j.jar
 ** tomcat-7.0.50-tomcat7-websocket.jar
 ** tomcat-7.0.50-websocket-api.jar
 ** ecj-4.2.2.jar
 ** annotations-api-3.0.jar
 ** jsp-api-2.2.jar
 ** servlet-api-3.0.jar
 * I have mounted the examples webapp that comes with Tomcat (Core 
 distribution) using the Embedded Tomcat instance: all the examples work fine 
 (including the websocket-deprecated ones) except for the Websockets JSR356 
 ones
 
 When I try to run the Websockets JSR356 examples, when I try to Connect 
 (either using the programmatic API or the annotation API) I get the message: 
 Info: WebSocket connection closed.
 Nothing appears in the console.
 
 Any hints would be greatly appreciated. Thanks in advance
 
 Jacopo
 
 [*] The reason I am using the Embedded version of Tomcat is that I am trying 
 to add support for Websockets to Apache OFBiz (ofbiz.apache.org) and OFBiz 
 runs Tomcat in embedded mode.
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org
 
 


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Issue running Websockets JSR356 with Tomcat 7.0.50 Embedded

2014-02-13 Thread Jacopo Cappellato
Hello all,

I did further tests and I have now implemented a test client that executes a 
Tomcat embedded instance that is successfully running websockets.
The client code resembles quite closely what we are doing in OFBiz to prepare 
the Tomcat instance... and I think I have found the settings that is causing 
the issue in OFBiz.
When in OFBiz we create the Context objects we set in their JarScanner (we use 
the StandardJarScanner): setScanClassPath(false)

I have noticed that if in my test client I set the same the websockets are not 
mounted; they only work with setScanClassPath(true).

Since I doubt we will be able to set it to true in OFBiz, I would really 
appreciate if you could provide some hints about the mechanism that Tomcat uses 
to deploy websockets.

Am I completely off track?

Thanks,

Jacopo

On Jan 29, 2014, at 4:42 PM, Jacopo Cappellato jacopo.cappell...@gmail.com 
wrote:

 Hello all,
 
 I am trying to deploy and use Websockets using the Tomcat 7.0.50 *Embedded* 
 distribution [*].
 
 Some more details on my environment:
 * I have the following jars in my classpath:
 ** tomcat-7.0.50-tomcat-embed-core.jar
 ** tomcat-7.0.50-tomcat-embed-jasper.jar
 ** tomcat-7.0.50-tomcat-embed-logging-log4j.jar
 ** tomcat-7.0.50-tomcat7-websocket.jar
 ** tomcat-7.0.50-websocket-api.jar
 ** ecj-4.2.2.jar
 ** annotations-api-3.0.jar
 ** jsp-api-2.2.jar
 ** servlet-api-3.0.jar
 * I have mounted the examples webapp that comes with Tomcat (Core 
 distribution) using the Embedded Tomcat instance: all the examples work fine 
 (including the websocket-deprecated ones) except for the Websockets JSR356 
 ones
 
 When I try to run the Websockets JSR356 examples, when I try to Connect 
 (either using the programmatic API or the annotation API) I get the message: 
 Info: WebSocket connection closed.
 Nothing appears in the console.
 
 Any hints would be greatly appreciated. Thanks in advance
 
 Jacopo
 
 [*] The reason I am using the Embedded version of Tomcat is that I am trying 
 to add support for Websockets to Apache OFBiz (ofbiz.apache.org) and OFBiz 
 runs Tomcat in embedded mode.
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org
 


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Issue running Websockets JSR356 with Tomcat 7.0.50 Embedded

2014-01-29 Thread Jacopo Cappellato
Hello all,

I am trying to deploy and use Websockets using the Tomcat 7.0.50 *Embedded* 
distribution [*].

Some more details on my environment:
* I have the following jars in my classpath:
** tomcat-7.0.50-tomcat-embed-core.jar
** tomcat-7.0.50-tomcat-embed-jasper.jar
** tomcat-7.0.50-tomcat-embed-logging-log4j.jar
** tomcat-7.0.50-tomcat7-websocket.jar
** tomcat-7.0.50-websocket-api.jar
** ecj-4.2.2.jar
** annotations-api-3.0.jar
** jsp-api-2.2.jar
** servlet-api-3.0.jar
* I have mounted the examples webapp that comes with Tomcat (Core 
distribution) using the Embedded Tomcat instance: all the examples work fine 
(including the websocket-deprecated ones) except for the Websockets JSR356 ones

When I try to run the Websockets JSR356 examples, when I try to Connect 
(either using the programmatic API or the annotation API) I get the message: 
Info: WebSocket connection closed.
Nothing appears in the console.

Any hints would be greatly appreciated. Thanks in advance

Jacopo

[*] The reason I am using the Embedded version of Tomcat is that I am trying to 
add support for Websockets to Apache OFBiz (ofbiz.apache.org) and OFBiz runs 
Tomcat in embedded mode.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Issue running Websockets JSR356 with Tomcat 7.0.50 Embedded

2014-01-29 Thread Mark Thomas
On 29/01/2014 15:42, Jacopo Cappellato wrote:
 Hello all,
 
 I am trying to deploy and use Websockets using the Tomcat 7.0.50 *Embedded* 
 distribution [*].

Java version?

 Some more details on my environment:
 * I have the following jars in my classpath:
 ** tomcat-7.0.50-tomcat-embed-core.jar
 ** tomcat-7.0.50-tomcat-embed-jasper.jar
 ** tomcat-7.0.50-tomcat-embed-logging-log4j.jar
 ** tomcat-7.0.50-tomcat7-websocket.jar
 ** tomcat-7.0.50-websocket-api.jar
 ** ecj-4.2.2.jar
 ** annotations-api-3.0.jar
 ** jsp-api-2.2.jar
 ** servlet-api-3.0.jar
 * I have mounted the examples webapp that comes with Tomcat (Core 
 distribution) using the Embedded Tomcat instance: all the examples work fine 
 (including the websocket-deprecated ones) except for the Websockets JSR356 
 ones

I think you may have duplicated some classes there. Some of those API
JARs may not be required.

 When I try to run the Websockets JSR356 examples, when I try to Connect 
 (either using the programmatic API or the annotation API) I get the message: 
 Info: WebSocket connection closed.
 Nothing appears in the console.

The HTTP headers send and received would help you to debug / enable us
to provide you with some pointers.

Mark


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Issue running Websockets JSR356 with Tomcat 7.0.50 Embedded

2014-01-29 Thread Jacopo Cappellato
Thank you Mark!

Please see inline:

On Jan 29, 2014, at 4:50 PM, Mark Thomas ma...@apache.org wrote:

 On 29/01/2014 15:42, Jacopo Cappellato wrote:
 Hello all,
 
 I am trying to deploy and use Websockets using the Tomcat 7.0.50 *Embedded* 
 distribution [*].
 
 Java version?

1.7.0_40

 
 Some more details on my environment:
 * I have the following jars in my classpath:
 ** tomcat-7.0.50-tomcat-embed-core.jar
 ** tomcat-7.0.50-tomcat-embed-jasper.jar
 ** tomcat-7.0.50-tomcat-embed-logging-log4j.jar
 ** tomcat-7.0.50-tomcat7-websocket.jar
 ** tomcat-7.0.50-websocket-api.jar
 ** ecj-4.2.2.jar
 ** annotations-api-3.0.jar
 ** jsp-api-2.2.jar
 ** servlet-api-3.0.jar
 * I have mounted the examples webapp that comes with Tomcat (Core 
 distribution) using the Embedded Tomcat instance: all the examples work fine 
 (including the websocket-deprecated ones) except for the Websockets JSR356 
 ones
 
 I think you may have duplicated some classes there. Some of those API JARs 
 may not be required.
 
 When I try to run the Websockets JSR356 examples, when I try to Connect 
 (either using the programmatic API or the annotation API) I get the message: 
 Info: WebSocket connection closed.
 Nothing appears in the console.
 
 The HTTP headers send and received would help you to debug / enable us
 to provide you with some pointers.

The error I am getting in the browser is the following:

[Error] WebSocket connection to 
'ws://localhost:8080/examples/websocket/echoAnnotation' failed: Unexpected 
response code: 404 (echo.xhtml, line 0)

It seems like the endpoint was not mounted but I amy be wrong.

Thanks,

Jacopo

 
 Mark
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org
 


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org