Re: Tomcat 7.0.68 - using websocket @ServerEndpoint to listen on alternate port
Hi Chris. You are right. After opening a dedicated port for my Tomcat instance all is working fine. My servlet code (Jersey resources and ServerEndpoints) does not reference any port. Client code uses window.location.host and picks up any port from the URL. Only drawback is that the URL users enter in the browser contains the port. Apparently, the hosting provider does not want to enable websocket traffic through the front end redirectors and web servers, which I think are Apache web servers. The dedicated port does the trick and enables WS only for my Tomcat instance. Cheers, Luigi -Original Message- From: Christopher Schultz Sent: Thursday, March 24, 2016 1:33 PM To: Tomcat Users List Subject: Re: Tomcat 7.0.68 - using websocket @ServerEndpoint to listen on alternate port Luigi, On 3/23/16 12:26 PM, Luigi Suardi wrote: I have a working websocket based application based on Tomcat 7.0.68 examples in my local environment. There are issues (i.e. java.lang.UnsupportedOperationException: HTTP upgrade is not supported by the AJP protocol) when running the same in a data center with an Apache web server front end that acts as a load balancer. It's true: the AJP protocol does not support upgrading to other protocols (e.g. websocket, HTTP/2). In this scenario, the Java hosting provider is asking me to run websocket traffic through separate dedicated port . So I would have to respond to regular HTTP requests over default 8080 port and to HTTP websocket requests over port . Is it possible to still use the annotated @ServerEndpoint or similar approach and tell it to listen on the port? How can I do this under Tomcat? You shouldn't need to do that: Tomcat will take care of the port mappings; just write your application as usual without any port numbers. If you have a client using a ws:// URL, they will connect through port and the upgrade should succeed. I'm not exactly sure how the web server will be configured to handle this, though. Or were you planning to generate ws:// URLs with embedded port numbers? -chris - 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: Tomcat 8 Connection Reset Issue
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Theo, On 3/24/16 1:19 PM, Theo Sweeny wrote: > Hello - we are running Tomcat v8.0.21 on RH7 with Java7. > > Recently we changed the datasource's to use connection pooling but > as a result we are seeing connection timeouts in the logs as seen > here - > > 2016-03-24 16:27:36,638 14321113 [http-nio-20180-exec-3] INFO > org.springframework.security.oauth2.provider.endpoint.TokenEndpoint > > Correlation-Identifier=77063426-8942-4259-aafd-cd9bc1d03305, > Timestamp=2016-03-24T14:54:46.084Z - Handling error: > ResourceAccessException, I/O error on POST request for > "https://localhost:8080/membership/programmes/ATRP/member-identificati on":Connection > > reset; nested exception is java.net.SocketException: Connection > reset That looks like an error with a Spring-related component, not Tomcat. (Right?). There are plenty of folks here who might be able to answer this question, but I think this is actually off-topic for this list. (No problem; carry on. Just pointing it out). > The timeouts occur about every 1 in 3 attempts. > > > Here is the new datasource config - > > > factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" > type="javax.sql.DataSource" > driverClassName="oracle.jdbc.OracleDriver" > url="jdbc:oracle:thin:@myhost:1521:MYSID" username="MYUSER" > password="x" removeAbandoned="True" > removeAbandonedTimeout="30" logAbandoned="True" > abandonWhenPercentageFull="0" testOnBorrow="True" > testOnReturn="False" testWhileIdle="True" maxActive="32" > initialSize="8" maxIdle="8" minIdle="8" > minEvictableIdleTimeMillis="15000" validationQuery="select 1 from > dual" validationInterval="15000" validationQueryTimeout="15" > timeBetweenEvictionRunsMillis="15000" logValidationErrors="True" > jdbcInterceptors="ConnectionState;StatementFinalizer;SlowQueryReport(t hreshold=1500);QueryTimeoutInterceptor(queryTimeout=10),ResetAbandonedTi mer" > > maxWait="-1"/> > > Are there any conflicts within this config that could be resulting > in this issue? I don't believe your JNDI DataSource has anything to do with making outgoing connections to OAuth providers... - -chris -BEGIN PGP SIGNATURE- Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlb0Qx0ACgkQ9CaO5/Lv0PA7KACfYVLubbNfIxKrInh9SNwY/JHf h+kAnRRevkPjZBdCl0RD53QdtsndtXGe =h3bQ -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: the new code in WebappClassLoaderBase.filter() is not working correctly with Rhino engine anymore
Hi, 2016-03-24 18:02 GMT+02:00 Johan Compagner : > > Hi, > > we now get this exception: > > java.lang.StringIndexOutOfBoundsException: String index out of range: 3 >at java.lang.String.charAt(String.java:658) >at > org.apache.catalina.loader.WebappClassLoaderBase.filter(WebappClassLoaderBase.java:2780) >at > org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1253) >at java.lang.ClassLoader.loadClass(ClassLoader.java:411) >at java.lang.ClassLoader.loadClass(ClassLoader.java:411) >at java.lang.ClassLoader.loadClass(ClassLoader.java:411) >at java.lang.ClassLoader.loadClass(ClassLoader.java:357) >at org.mozilla.javascript.Kit.classOrNull(Kit.java:89) >at > org.mozilla.javascript.NativeJavaPackage.getPkgProperty(NativeJavaPackage.java:154) >at > org.mozilla.javascript.NativeJavaPackage.get(NativeJavaPackage.java:111) >at > org.mozilla.javascript.NativeJavaTopPackage.init(NativeJavaTopPackage.java:119) > Check this [1] Tomcat 8.0.33 just passed the vote [2] Regards, Violeta [1] https://bz.apache.org/bugzilla/show_bug.cgi?id=58999 [2] http://marc.info/?l=tomcat-dev&m=145883995817915&w=2 > > that is because WebappClassLoaderBase.filter() is really changed in this > release and assumes: > > } else if (name.startsWith("org")) { > /* 3 == length("org") */ > ch = name.charAt(3); > > that when it gets "org" it can get the 4 the (position 3) char > That bombs out now > > This is because NativeJavaPackage tries to load anything that it gets > through its get method so it does try "org" until it sees somethign that is > a class. (so org.xxx then org.xxx.Yyy will be seen as a class) > > I guess that code could be written with a simple length check in that if > above > or write it a bit different and have something like: > > } else if (isClassName && name.startsWith("org.apache.")) { > /* 11 == length("org.apache.") */ > if (name.startsWith("tomcat.jdbc.", 11)) { > return false; > } > if (name.startsWith("el.", 11) || > name.startsWith("catalina.", 11) || > name.startsWith("jasper.", 11) || > name.startsWith("juli.", 11) || > name.startsWith("tomcat.", 11) || > name.startsWith("naming.", 11) || > name.startsWith("coyote.", 11)) { > return true; > } > } else if (!isClassName && name.startsWith("org/apache/")) { > /* 11 == length("org/apache/") */ > if (name.startsWith("tomcat/jdbc/", 11)) { > return false; > } > if (name.startsWith("el/", 11) || > name.startsWith("catalina/", 11) || > name.startsWith("jasper/", 11) || > name.startsWith("juli/", 11) || > name.startsWith("tomcat/", 11) || > name.startsWith("naming/", 11) || > name.startsWith("coyote/", 11)) { > return true; > } > } > > *that seems a bit shorter and should do the same.* > > -- > Johan Compagner > Servoy
Re: the new code in WebappClassLoaderBase.filter() is not working correctly with Rhino engine anymore
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 John, Quick question: what exact Tomcat version are you running? - -chris On 3/24/16 12:02 PM, Johan Compagner wrote: > Hi, > > we now get this exception: > > java.lang.StringIndexOutOfBoundsException: String index out of > range: 3 at java.lang.String.charAt(String.java:658) at > org.apache.catalina.loader.WebappClassLoaderBase.filter(WebappClassLoa derBase.java:2780) > > at > org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClass LoaderBase.java:1253) > > at java.lang.ClassLoader.loadClass(ClassLoader.java:411) > at java.lang.ClassLoader.loadClass(ClassLoader.java:411) at > java.lang.ClassLoader.loadClass(ClassLoader.java:411) at > java.lang.ClassLoader.loadClass(ClassLoader.java:357) at > org.mozilla.javascript.Kit.classOrNull(Kit.java:89) at > org.mozilla.javascript.NativeJavaPackage.getPkgProperty(NativeJavaPack age.java:154) > > at > org.mozilla.javascript.NativeJavaPackage.get(NativeJavaPackage.java:11 1) > > at > org.mozilla.javascript.NativeJavaTopPackage.init(NativeJavaTopPackage. java:119) > > > > that is because WebappClassLoaderBase.filter() is really changed in > this release and assumes: > > } else if (name.startsWith("org")) { /* 3 == length("org") */ ch = > name.charAt(3); > > that when it gets "org" it can get the 4 the (position 3) char That > bombs out now > > This is because NativeJavaPackage tries to load anything that it > gets through its get method so it does try "org" until it sees > somethign that is a class. (so org.xxx then org.xxx.Yyy will be > seen as a class) > > I guess that code could be written with a simple length check in > that if above or write it a bit different and have something like: > > } else if (isClassName && name.startsWith("org.apache.")) { /* 11 > == length("org.apache.") */ if (name.startsWith("tomcat.jdbc.", > 11)) { return false; } if (name.startsWith("el.", 11) || > name.startsWith("catalina.", 11) || name.startsWith("jasper.", 11) > || name.startsWith("juli.", 11) || name.startsWith("tomcat.", 11) > || name.startsWith("naming.", 11) || name.startsWith("coyote.", > 11)) { return true; } } else if (!isClassName && > name.startsWith("org/apache/")) { /* 11 == length("org/apache/") > */ if (name.startsWith("tomcat/jdbc/", 11)) { return false; } if > (name.startsWith("el/", 11) || name.startsWith("catalina/", 11) || > name.startsWith("jasper/", 11) || name.startsWith("juli/", 11) || > name.startsWith("tomcat/", 11) || name.startsWith("naming/", 11) > || name.startsWith("coyote/", 11)) { return true; } } > > *that seems a bit shorter and should do the same.* > -BEGIN PGP SIGNATURE- Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlb0MsEACgkQ9CaO5/Lv0PChFACguLV1eOlvZ9QGIM7d6ywWvCwk ulQAn3Yj/wwG34k6Gh1isN/EImBEQ/tm =7DjR -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Tomcat 8 Connection Reset Issue
Hello - we are running Tomcat v8.0.21 on RH7 with Java7. Recently we changed the datasource's to use connection pooling but as a result we are seeing connection timeouts in the logs as seen here - 2016-03-24 16:27:36,638 14321113 [http-nio-20180-exec-3] INFO org.springframework.security.oauth2.provider.endpoint.TokenEndpoint Correlation-Identifier=77063426-8942-4259-aafd-cd9bc1d03305, Timestamp=2016-03-24T14:54:46.084Z - Handling error: ResourceAccessException, I/O error on POST request for "https://localhost:8080/membership/programmes/ATRP/member-identification":Connection reset; nested exception is java.net.SocketException: Connection reset The timeouts occur about every 1 in 3 attempts. Here is the new datasource config - Are there any conflicts within this config that could be resulting in this issue? Thank you, Theo Avios Group (AGL) Ltd is a limited company registered in England (registered number 2260073 and VAT number 512566754) whose registered address is Astral Towers, Betts Way, London Road, Crawley, West Sussex RH10 9XY . Avios Group (AGL) Limited is part of the IAG group of companies This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager.
the new code in WebappClassLoaderBase.filter() is not working correctly with Rhino engine anymore
Hi, we now get this exception: java.lang.StringIndexOutOfBoundsException: String index out of range: 3 at java.lang.String.charAt(String.java:658) at org.apache.catalina.loader.WebappClassLoaderBase.filter(WebappClassLoaderBase.java:2780) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1253) at java.lang.ClassLoader.loadClass(ClassLoader.java:411) at java.lang.ClassLoader.loadClass(ClassLoader.java:411) at java.lang.ClassLoader.loadClass(ClassLoader.java:411) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at org.mozilla.javascript.Kit.classOrNull(Kit.java:89) at org.mozilla.javascript.NativeJavaPackage.getPkgProperty(NativeJavaPackage.java:154) at org.mozilla.javascript.NativeJavaPackage.get(NativeJavaPackage.java:111) at org.mozilla.javascript.NativeJavaTopPackage.init(NativeJavaTopPackage.java:119) that is because WebappClassLoaderBase.filter() is really changed in this release and assumes: } else if (name.startsWith("org")) { /* 3 == length("org") */ ch = name.charAt(3); that when it gets "org" it can get the 4 the (position 3) char That bombs out now This is because NativeJavaPackage tries to load anything that it gets through its get method so it does try "org" until it sees somethign that is a class. (so org.xxx then org.xxx.Yyy will be seen as a class) I guess that code could be written with a simple length check in that if above or write it a bit different and have something like: } else if (isClassName && name.startsWith("org.apache.")) { /* 11 == length("org.apache.") */ if (name.startsWith("tomcat.jdbc.", 11)) { return false; } if (name.startsWith("el.", 11) || name.startsWith("catalina.", 11) || name.startsWith("jasper.", 11) || name.startsWith("juli.", 11) || name.startsWith("tomcat.", 11) || name.startsWith("naming.", 11) || name.startsWith("coyote.", 11)) { return true; } } else if (!isClassName && name.startsWith("org/apache/")) { /* 11 == length("org/apache/") */ if (name.startsWith("tomcat/jdbc/", 11)) { return false; } if (name.startsWith("el/", 11) || name.startsWith("catalina/", 11) || name.startsWith("jasper/", 11) || name.startsWith("juli/", 11) || name.startsWith("tomcat/", 11) || name.startsWith("naming/", 11) || name.startsWith("coyote/", 11)) { return true; } } *that seems a bit shorter and should do the same.* -- Johan Compagner Servoy
Re: Tomcat 7.0.68 - using websocket @ServerEndpoint to listen on alternate port
Luigi, On 3/23/16 12:26 PM, Luigi Suardi wrote: > I have a working websocket based application based on Tomcat 7.0.68 > examples in my local environment. There are issues (i.e. > java.lang.UnsupportedOperationException: HTTP upgrade is not > supported by the AJP protocol) when running the same in a data > center with an Apache web server front end that acts as a load > balancer. It's true: the AJP protocol does not support upgrading to other protocols (e.g. websocket, HTTP/2). > In this scenario, the Java hosting provider is asking me to run > websocket traffic through separate dedicated port . So I would > have to respond to regular HTTP requests over default 8080 port and > to HTTP websocket requests over port . Is it possible to still > use the annotated @ServerEndpoint or similar approach and tell it to > listen on the port? How can I do this under Tomcat? You shouldn't need to do that: Tomcat will take care of the port mappings; just write your application as usual without any port numbers. If you have a client using a ws:// URL, they will connect through port and the upgrade should succeed. I'm not exactly sure how the web server will be configured to handle this, though. Or were you planning to generate ws:// URLs with embedded port numbers? -chris - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: response.sendRedirect is not working in application after upgrade from 7.0.65 to 7.0.67
2016-03-24 9:11 GMT+02:00 Palod, Manish : > > Hi Violeta, > We have tried 7.0.68 also, but same issue. OK We have a fix for something similar http://svn.apache.org/viewvc?view=revision&revision=1734262 The fix will be available in 7.0.69 Can you build Tomcat 7 trunk and test your scenario? Thanks, Violeta > Regards > Manish > -Original Message- > From: Violeta Georgieva [mailto:miles...@gmail.com] > Sent: Thursday, March 24, 2016 12:36 PM > To: Tomcat Users List > Subject: Re: response.sendRedirect is not working in application after upgrade from 7.0.65 to 7.0.67 > > Hi, > > 2016-03-24 8:18 GMT+02:00 Palod, Manish : > > > > Hello Experts, > > We are using tomcat in our application from many years and things were > working fine. > > > > After upgrade from tomcat 7.0.65 to 7.0.67, response.sendRedirect is > > not > working properly in application. > > > > We are having spaces in between url attributes all the time ex. > companyName=XYZ Inc&Address=ABC Road etc. and didn't face any issues. > > > > We are encoding the URL's using "response.encodeURL" before passing > > url > param to response.sendRedirect > > > > After upgrade to .67, sendRedirect started failing, hence I tried > changing url encoding using "response.encodeRedirectURL", still redirection didn't work > > > > is this the known issue? > > is there any work around for this? > > > > Please try 7.0.68 > This is the last released Tomcat 7 version. > > Regards, > Violeta > > > Thanks > > Manish > >
RE: response.sendRedirect is not working in application after upgrade from 7.0.65 to 7.0.67
Hi Violeta, We have tried 7.0.68 also, but same issue. Regards Manish -Original Message- From: Violeta Georgieva [mailto:miles...@gmail.com] Sent: Thursday, March 24, 2016 12:36 PM To: Tomcat Users List Subject: Re: response.sendRedirect is not working in application after upgrade from 7.0.65 to 7.0.67 Hi, 2016-03-24 8:18 GMT+02:00 Palod, Manish : > > Hello Experts, > We are using tomcat in our application from many years and things were working fine. > > After upgrade from tomcat 7.0.65 to 7.0.67, response.sendRedirect is > not working properly in application. > > We are having spaces in between url attributes all the time ex. companyName=XYZ Inc&Address=ABC Road etc. and didn't face any issues. > > We are encoding the URL's using "response.encodeURL" before passing > url param to response.sendRedirect > > After upgrade to .67, sendRedirect started failing, hence I tried changing url encoding using "response.encodeRedirectURL", still redirection didn't work > > is this the known issue? > is there any work around for this? > Please try 7.0.68 This is the last released Tomcat 7 version. Regards, Violeta > Thanks > Manish >
Re: response.sendRedirect is not working in application after upgrade from 7.0.65 to 7.0.67
Hi, 2016-03-24 8:18 GMT+02:00 Palod, Manish : > > Hello Experts, > We are using tomcat in our application from many years and things were working fine. > > After upgrade from tomcat 7.0.65 to 7.0.67, response.sendRedirect is not working properly in application. > > We are having spaces in between url attributes all the time ex. companyName=XYZ Inc&Address=ABC Road etc. and didn't face any issues. > > We are encoding the URL's using "response.encodeURL" before passing url param to response.sendRedirect > > After upgrade to .67, sendRedirect started failing, hence I tried changing url encoding using "response.encodeRedirectURL", still redirection didn't work > > is this the known issue? > is there any work around for this? > Please try 7.0.68 This is the last released Tomcat 7 version. Regards, Violeta > Thanks > Manish >