EL 3.0 Streams Edge Case - Am I wrong or is Tomcat wrong?
I have an EL 3.0 edge case that I need help understanding. Am I doing something wrong (I don't think so) or is the Tomcat 8.0 implementation missing something? Consider the following EL expression: ${users.stream() .filter(u - fn:contains(u.username, '1')) .sorted((u1, u2) - u1.lastName.compareTo(u2.lastName) == 0 ? u1.firstName.compareTo(u2.firstName) : u1.lastName.compareTo(u2.lastName)) .toList()} This works as expected. However, it results in potentially evaluating u1.lastName.compareTo(u2.lastName) twice. My understanding is that the right-hand side of a lambda expression can be any valid EL expression, so I believe this should also work: ${users.stream() .filter(u - fn:contains(u.username, '1')) .sorted((u1, u2) - x = u1.lastName.compareTo(u2.lastName); x == 0 ? u1.firstName.compareTo(u2.firstName) : x) .toList()} However, this doesn't evaluate. I get the following error instead: org.apache.el.parser.ParseException: Encountered = = at line 3, column 38. Was expecting one of: . ... ) ... etc ... Next I tried to reduce the properties present in each user using the stream map method. Once again, with the understanding that the right-hand side of a lambda expression can be any valid EL expression, I use an EL Map literal to construct a reduced set of properties: ${users.stream() .filter(u - fn:contains(u.username, '1')) .map(u - {'username':u.username, 'first':u.firstName, 'last':u.lastName}) .sorted((u1, u2) - u1.lastName.compareTo(u2.lastName) == 0 ? u1.firstName.compareTo(u2.firstName) : u1.lastName.compareTo(u2.lastName)) .toList()} However, that doesn't work and I get this error: org.apache.el.parser.ParseException: Encountered EOF at line 3, column 88. Was expecting one of: . ... ) ... etc ... Section 2.3.6.4 of the specification uses the following example, where a LIST literal is used as the right-hand side of the mapping lambda expression: products.stream().filter(p-p.unitPrice = 10). .map(p-[p.name, p.unitPrice]) .toList() I tried to use this exact syntax, as shown in the spec, with my example: ${users.stream() .filter(u - fn:contains(u.username, '1')) .map(u - [u.username, u.firstName, u.lastName]) .sorted((u1, u2) - u1.lastName.compareTo(u2.lastName) == 0 ? u1.firstName.compareTo(u2.firstName) : u1.lastName.compareTo(u2.lastName)) .toList()} And now I get this lovely error: javax.el.ELException: java.lang.NumberFormatException: For input string: lastName javax.el.BeanELResolver.invoke(BeanELResolver.java:185) org.apache.jasper.el.JasperELResolver.invoke(JasperELResolver.java:147) org.apache.el.parser.AstValue.getValue(AstValue.java:158) ... I'm sure I'm doing something wrong here, but I'm not exactly sure what. On the other hand, it's possible that the Tomcat 8.0 implementation is just wrong. Can someone shed some light on this? Thanks, Nick - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: setting the text or binary buffer size for websockets
On 16/11/2013 14:12, Johan Compagner wrote: We have problems (with chrome) with all kinds of errors when sending these frames (invalid opcode, utf char encoding problem, reserved words 1 ,2 ,3 errors in the browser) So i want to see if i just don't use frames what the result is then Exactly which version of Tomcat 7 are you using? Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Deployment Problem - behavior changed from 5.x to 7.x
Hi. I got a Problem with Tomcat deployment. I am using TC 7.0.42, OS: Win2k8r2, J 1.7.0._45. We used to deploy unpacked webapps (dirs) on a Tomcat 5.0.26 outside the Webapps-dir. We used the manager (web-IF) to deploy these apps, giving the context name and the local directory. The tomcat ran the app from this location. It creates a contex.xml in it's config dir. Now in TC7, the tomcat COPIES the APP from the given location to the default Webapps directory. But we want it to run from where it is, not a copy. One way to archieve this is to manually create a context.xml file in the conf/server/localhost dir. But our deployment process needs it to be done via web interface. So, is there any possibility to configure tomcat 7 to behave like tomcat 5 when deploying local webapp directories from outside the webapps dir? I tried autoDeploy and unpackWars to false, but it didn't help. :( -- Björn Andersen - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: EL 3.0 Streams Edge Case - Am I wrong or is Tomcat wrong?
2013/11/17 Nick Williams nicho...@nicholaswilliams.net: I have an EL 3.0 edge case that I need help understanding. Am I doing something wrong (I don't think so) or is the Tomcat 8.0 implementation missing something? Consider the following EL expression: ${users.stream() .filter(u - fn:contains(u.username, '1')) .sorted((u1, u2) - u1.lastName.compareTo(u2.lastName) == 0 ? u1.firstName.compareTo(u2.firstName) : u1.lastName.compareTo(u2.lastName)) .toList()} This works as expected. However, it results in potentially evaluating u1.lastName.compareTo(u2.lastName) twice. My understanding is that the right-hand side of a lambda expression can be any valid EL expression, so I believe this should also work: ${users.stream() .filter(u - fn:contains(u.username, '1')) .sorted((u1, u2) - x = u1.lastName.compareTo(u2.lastName); x == 0 ? u1.firstName.compareTo(u2.firstName) : x) .toList()} However, this doesn't evaluate. I get the following error instead: org.apache.el.parser.ParseException: Encountered = = at line 3, column 38. Was expecting one of: . ... ) ... etc ... What if you add ( ) ? What operator has higher priority, - or ; ? Next I tried to reduce the properties present in each user using the stream map method. Once again, with the understanding that the right-hand side of a lambda expression can be any valid EL expression, I use an EL Map literal to construct a reduced set of properties: ${users.stream() .filter(u - fn:contains(u.username, '1')) .map(u - {'username':u.username, 'first':u.firstName, 'last':u.lastName}) .sorted((u1, u2) - u1.lastName.compareTo(u2.lastName) == 0 ? u1.firstName.compareTo(u2.firstName) : u1.lastName.compareTo(u2.lastName)) .toList()} However, that doesn't work and I get this error: org.apache.el.parser.ParseException: Encountered EOF at line 3, column 88. Was expecting one of: . ... ) ... etc ... I do not understand the above. Can you provide a simple test case? Which one of the expressions does not work? Can you remove the others? Section 2.3.6.4 of the specification uses the following example, where a LIST literal is used as the right-hand side of the mapping lambda expression: products.stream().filter(p-p.unitPrice = 10). .map(p-[p.name, p.unitPrice]) .toList() I tried to use this exact syntax, as shown in the spec, with my example: ${users.stream() .filter(u - fn:contains(u.username, '1')) .map(u - [u.username, u.firstName, u.lastName]) .sorted((u1, u2) - u1.lastName.compareTo(u2.lastName) == 0 ? u1.firstName.compareTo(u2.firstName) : u1.lastName.compareTo(u2.lastName)) .toList()} And now I get this lovely error: javax.el.ELException: java.lang.NumberFormatException: For input string: lastName javax.el.BeanELResolver.invoke(BeanELResolver.java:185) org.apache.jasper.el.JasperELResolver.invoke(JasperELResolver.java:147) org.apache.el.parser.AstValue.getValue(AstValue.java:158) ... I'm sure I'm doing something wrong here, but I'm not exactly sure what. On the other hand, it's possible that the Tomcat 8.0 implementation is just wrong. Can someone shed some light on this? Best regards, Konstantin Kolinko - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: setting the text or binary buffer size for websockets
On 17 November 2013 12:55, Mark Thomas ma...@apache.org wrote: On 16/11/2013 14:12, Johan Compagner wrote: We have problems (with chrome) with all kinds of errors when sending these frames (invalid opcode, utf char encoding problem, reserved words 1 ,2 ,3 errors in the browser) So i want to see if i just don't use frames what the result is then Exactly which version of Tomcat 7 are you using? currently testing it on 8 RC5 I can test on 7, but i guess thats the +/- the same code?
Re: Deployment Problem - behavior changed from 5.x to 7.x
2013/11/17 Andersen, Bjoern bjoern.ander...@atos.net: Hi. I got a Problem with Tomcat deployment. I am using TC 7.0.42, OS: Win2k8r2, J 1.7.0._45. We used to deploy unpacked webapps (dirs) on a Tomcat 5.0.26 outside the Webapps-dir. We used the manager (web-IF) to deploy these apps, giving the context name and the local directory. The tomcat ran the app from this location. It creates a contex.xml in it's config dir. Now in TC7, the tomcat COPIES the APP from the given location to the default Webapps directory. But we want it to run from where it is, not a copy. One way to archieve this is to manually create a context.xml file in the conf/server/localhost dir. But our deployment process needs it to be done via web interface. So, is there any possibility to configure tomcat 7 to behave like tomcat 5 when deploying local webapp directories from outside the webapps dir? I tried autoDeploy and unpackWars to false, but it didn't help. :( 5.0 was deprecated so long ago, that it is beyond my knowledge. What exactly are you trying to do, step by step? Documentation for the Manager webapp is here: http://tomcat.apache.org/tomcat-7.0-doc/manager-howto.html#Deploy_A_New_Application_from_a_Local_Path There exist Ant and Maven front-ends (HTTP clients) for that API which are documented elsewhere. But our deployment process needs it to be done via web interface. Why? What is your deployment process? Best regards, Konstantin Kolinko - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: setting the text or binary buffer size for websockets
On 17/11/2013 13:09, Johan Compagner wrote: On 17 November 2013 12:55, Mark Thomas ma...@apache.org wrote: On 16/11/2013 14:12, Johan Compagner wrote: We have problems (with chrome) with all kinds of errors when sending these frames (invalid opcode, utf char encoding problem, reserved words 1 ,2 ,3 errors in the browser) So i want to see if i just don't use frames what the result is then Exactly which version of Tomcat 7 are you using? currently testing it on 8 RC5 I can test on 7, but i guess thats the +/- the same code? Latest 8 RC is fine but then why are you looking at the Tomcat 7 docs? Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: setting the text or binary buffer size for websockets
Exactly which version of Tomcat 7 are you using? currently testing it on 8 RC5 I can test on 7, but i guess thats the +/- the same code? Latest 8 RC is fine but then why are you looking at the Tomcat 7 docs? first that i found, and also this http://tomcat.apache.org/tomcat-8.0-doc/web-socket-howto.html is the same i will look at it a bit more then, but for my current tests it didn't have any effect as far as i could see.
Re: EL 3.0 Streams Edge Case - Am I wrong or is Tomcat wrong?
On Nov 17, 2013, at 6:00 AM, Konstantin Kolinko wrote: 2013/11/17 Nick Williams nicho...@nicholaswilliams.net: I have an EL 3.0 edge case that I need help understanding. Am I doing something wrong (I don't think so) or is the Tomcat 8.0 implementation missing something? Consider the following EL expression: ${users.stream() .filter(u - fn:contains(u.username, '1')) .sorted((u1, u2) - u1.lastName.compareTo(u2.lastName) == 0 ? u1.firstName.compareTo(u2.firstName) : u1.lastName.compareTo(u2.lastName)) .toList()} This works as expected. However, it results in potentially evaluating u1.lastName.compareTo(u2.lastName) twice. My understanding is that the right-hand side of a lambda expression can be any valid EL expression, so I believe this should also work: ${users.stream() .filter(u - fn:contains(u.username, '1')) .sorted((u1, u2) - x = u1.lastName.compareTo(u2.lastName); x == 0 ? u1.firstName.compareTo(u2.firstName) : x) .toList()} However, this doesn't evaluate. I get the following error instead: org.apache.el.parser.ParseException: Encountered = = at line 3, column 38. Was expecting one of: . ... ) ... etc ... What if you add ( ) ? What operator has higher priority, - or ; ? - has higher priority than both = and ;, according to the spec. In this particular case, I'm not sure whether that means parenthesis are absolutely required or not. However, I can confirm that adding parenthesis here solves this problem, so perhaps that's what I was doing wrong for this error. This expression now works: ${users.stream() .filter(u - fn:contains(u.username, '1')) .sorted((u1, u2) - (x = u1.lastName.compareTo(u2.lastName); x == 0 ? u1.firstName.compareTo(u2.firstName) : x)) .toList()} Next I tried to reduce the properties present in each user using the stream map method. Once again, with the understanding that the right-hand side of a lambda expression can be any valid EL expression, I use an EL Map literal to construct a reduced set of properties: ${users.stream() .filter(u - fn:contains(u.username, '1')) .map(u - {'username':u.username, 'first':u.firstName, 'last':u.lastName}) .sorted((u1, u2) - u1.lastName.compareTo(u2.lastName) == 0 ? u1.firstName.compareTo(u2.firstName) : u1.lastName.compareTo(u2.lastName)) .toList()} However, that doesn't work and I get this error: org.apache.el.parser.ParseException: Encountered EOF at line 3, column 88. Was expecting one of: . ... ) ... etc ... I do not understand the above. Can you provide a simple test case? Which one of the expressions does not work? Can you remove the others? So, as mentioned above, the following expression works: ${users.stream() .filter(u - fn:contains(u.username, '1')) .sorted((u1, u2) - (x = u1.lastName.compareTo(u2.lastName); x == 0 ? u1.firstName.compareTo(u2.firstName) : x)) .toList()} If I now add the map operation to it, I get the EOF error. Nothing else about the expression changed: ${users.stream() .filter(u - fn:contains(u.username, '1')) .sorted((u1, u2) - (x = u1.lastName.compareTo(u2.lastName); x == 0 ? u1.firstName.compareTo(u2.firstName) : x)) .map(u - {'username':u.username, 'first':u.firstName, 'last':u.lastName}) .toList()} javax.el.ELException: Failed to parse the expression [${users.stream() .filter(u - fn:contains(u.username, '1')) .sorted((u1, u2) - (x = u1.lastName.compareTo(u2.lastName); x == 0 ? u1.firstName.compareTo(u2.firstName) : x)) .map(u - {'username':u.username, 'first':u.firstName, 'last':u.lastName}] ... root cause org.apache.el.parser.ParseException: Encountered EOF at line 6, column 38. Was expecting one of: . ... ) ... etc... Notice that it thinks the expression is ending after the closing } of the map-literal. Now the example in 2.3.6.4 of the specification alludes to the fact that my use of the map-literal here is correct. In that example they use a list-literal instead (.map(p-[p.name, p.unitPrice])). I tried changing to use a list-literal instead of a map-literal, and that's when I got the NumberFormatException described earlier. I _believe_ both should be legal; the specification clearly intends that at least using the list-literal should be legal. Neither work in Tomcat. Does this make sense? Section 2.3.6.4 of the specification uses the following example, where a LIST literal is used as the right-hand side of the mapping lambda expression: products.stream().filter(p-p.unitPrice = 10). .map(p-[p.name, p.unitPrice])
Re: Restrict the use of JDK classes Tomcat 7 or 6
Thank you very much. I have been working in creating my own permission and I have some questions: - In the Java documentation says it is necessary to add a checkPermission in the application's resource management code. My question is, when we are working with web applications, which is the application's resource management code? And where is it? - When I create my own permission class, where do I have to store it? In order to the Security manager can find it. - I have read that it is not necessary to modify the Security Manager, when we are creating a new permission for secure the JVM. When we are working with Tomcat, and not with the JVM directly, is it the same? Or is it necessary to modify the Tomcat's Security Manager? Thank you very much. 2013/11/12 Aurélien Terrestris aterrest...@gmail.com Hello Analia I'm glad that you could play successfully with the Security Manager as I advised first :D About permissions, here you have a doc : http://docs.oracle.com/javase/6/docs/technotes/guides/security/spec/security-spec.doc3.html#20211 best regards 2013/11/11 ANALIA DE PEDRO SANTAMARIA 100074...@alumnos.uc3m.es: Hello, I have been working with the Security Manager and I think it is a good aproximation of what I need, thank you very much for the advice. I have read that it is possible to create your own Permission class, but I haven't found any documentation or example. Could anybody tell me where I can find information about create a Permission class? Thank you very much. 2013/10/23 Caldarale, Charles R chuck.caldar...@unisys.com From: Christopher Schultz [mailto:ch...@christopherschultz.net] Subject: Re: Restrict the use of JDK classes Tomcat 7 or 6 When you say Java classes, are you talking about re-defining something like java.lang.String? If so, then the servlet spec (3.0: 10.7.2) prohibits web applications from loading classes from any of these packages from a web application class loader. java.* javax.* Looking at current trunk, Tomcat appears to take a lazy view and just look for these two classes: javax.servlet.Servlet javax.el.Expression So it looks like you might be able to redefine java.lang.String if you want. As I recall, the JVM itself prevents loading of java.* classes from anywhere other than the registered JRE jar locations. Not sure about javax.* classes. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - 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
mySQL connector error
Hello, I'm new with Tomcat, so I hope for some help. I try to run www.icescrum.org on my Tomcat 7 on Ubuntu 12.04 with OpenJDK. I have installed Tomcat with apt-get and also I have installed the libmysql-java package. On starting Tomcat it reports on a stacktrace log, that the mySQL connector is not found (java.lang.ClassNotFoundException: com.mysql.jdbc.Driver). So I have try to create a symlink in Tomcats lib dir to the jar file and try to modify the properties of the search paths: common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar,/var/lib/tomcat7/common/classes,/var/lib/tomcat7/common/*.jar server.loader=/var/lib/tomcat7/server/classes,/var/lib/tomcat7/server/*.jar shared.loader=/var/lib/tomcat7/shared/classes,/var/lib/tomcat7/shared/*.jar The JDBC mySQL Jar is stored under /usr/share/java with two symlinks, I have tried to create a symlink from Tomcats lib dir (/usr/share/tomcat7/lib) to ../../java/mysql.jar but the mySQL is also not loaded. The CATALINA_HOME is set to /usr/share/tomcat7 and the CATALINA_BASE is /var/lib/tomcat7, so imho it should be worked How can I create a working IceScrum with mySQL and a shared mySQL connector? Thanks a lot Phil
Re: mySQL connector error
Hi Phil try to add Class.forName(com.mysql.jdbc.Driver); to your code Israel On Sun, Nov 17, 2013 at 8:56 PM, Philipp Kraus philipp.kr...@tu-clausthal.de wrote: Hello, I'm new with Tomcat, so I hope for some help. I try to run www.icescrum.org on my Tomcat 7 on Ubuntu 12.04 with OpenJDK. I have installed Tomcat with apt-get and also I have installed the libmysql-java package. On starting Tomcat it reports on a stacktrace log, that the mySQL connector is not found (java.lang.ClassNotFoundException: com.mysql.jdbc.Driver). So I have try to create a symlink in Tomcats lib dir to the jar file and try to modify the properties of the search paths: common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar,/var/lib/tomcat7/common/classes,/var/lib/tomcat7/common/*.jar server.loader=/var/lib/tomcat7/server/classes,/var/lib/tomcat7/server/*.jar shared.loader=/var/lib/tomcat7/shared/classes,/var/lib/tomcat7/shared/*.jar The JDBC mySQL Jar is stored under /usr/share/java with two symlinks, I have tried to create a symlink from Tomcats lib dir (/usr/share/tomcat7/lib) to ../../java/mysql.jar but the mySQL is also not loaded. The CATALINA_HOME is set to /usr/share/tomcat7 and the CATALINA_BASE is /var/lib/tomcat7, so imho it should be worked How can I create a working IceScrum with mySQL and a shared mySQL connector? Thanks a lot Phil
Re: Tomcat setting as a service after installing the binaries
Thanks for the info Chris, that info is helpful. On Mon, Nov 11, 2013 at 10:48 PM, Christopher Schultz ch...@christopherschultz.net wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Jojy, On 11/11/13, 5:34 AM, Jojy George wrote: I just checked and found out that it was problem with the wrong jdk version. it was using 32 bit instead of 64 bit and i installed the 64 bit and that fixed the issue. Just checking: do you actually need a 64-bit JVM? If a 32-bit JVM will work okay for you, you might want to use it instead. It's likely to be a bit faster as long as you don't need large heaps (~1.5GiB). - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.15 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIcBAEBCAAGBQJSgRFpAAoJEBzwKT+lPKRYqkYP/1ooG6AIbrcW5nT0vIe/HQ3e 4aL5TpJ3QkjemSjUNT7cObx0NZog1J/X/6GHuQs5u0gayI0Km/qU/QUAYEyD5pCh cYCYnLijFCcg5L/Rgtl9wHMPivs32+h05FwticD27IY9WDuS+t6wm8dOGU1yidxl /AX+4izIX5TH2KbJIGAUBpIkxmoNzhjZ9N5enNL38Uz1rLJBd4SAqA0NQC5N4PJ/ 8nOjjrvYqvW6lxcZJxCjKmd4tq/IqXetj5tT1Gkxaf1cqOykn8jmk4ou4/C26VjX hn+dfV8RcjTmvJrhLvjCorUSzsHFVnCv3xwkwZGsBbK8MJGQrQZY8lucFvd3pM2Z 4CyXnNccnap6meNDrqtHjVEjRoQaIAGoR0n0VGqwfqN78qwpXOhaQriRy2g/ncrL fuMj2nusTM4BG5NB465wmoTF609IOm+sb4garH4P547LM5Rn/zhyMM/3bNq1Usi6 T3/33Lbt2MdFrMm9PO5gKd58N/JWJzXlTEKEq5fRrHPM/aRysRIkJep51L9zePa4 Tac5Vhmt0BVwbJiAPzix1xwVaBF/Qkqb4IPaMqKsXz8G6cIRBHrWmxRTbzdXmVjL IVJYD01JlQs4Trqpkm2q0jbiWAyDkwoLr4LjWfVIv0xb5pUlCUX8RiQYz4pQI6m2 8yUALsz1/P8RkamxZPOk =Rgbf -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org