Re: JNI and TOMCAT problem
Hi, is it really TC crashing or is it the JVM ? Have a look into your logfiles. Using native libraries it's likely that your native code is crashing the JVM. grisi - Original Message - From: J.Pablo M [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, January 08, 2004 10:57 PM Subject: JNI and TOMCAT problem Hi. I'm runnin a JSP based Web aplicacion wich uses a Java Class that loads a native library (JNI). This Class is placed in a jar file at /common/lib/ The .so file is placed inside the jdk at /JAVA_HOME/jre/lib/i386/ I sucesfully build and test a standalone application for the use of the JNI. When I invoke the method located in the jar file that uses the .so from the JSP with Tomcat , the Tomcat CRASH. I dont know if must keep the .so file placed at the jdk directory mencioned above, otherwise... WHERE shoud I place the .so file ?? J. Pablo _ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat 5.0.16 : manager-app access - solved
Hi Andy, yes, you were completely right with your assumption about the user roles. Thanks a lot greets Dirk - Original Message - From: Adam Hardy [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Thursday, December 11, 2003 10:33 PM Subject: Re: Tomcat 5.0.16 : manager-app access - solved Ah! If only you hadn't dropped the thread! Oh well, glad you got it sorted. As for the commas, looks like you found a bug - although I would check that user_roles=admin works for admin only as well. Adam On 12/11/2003 04:09 PM Dirk Griesbach wrote: I traced the problem down to the 'user_role' entry in the database: The role of the user used by the manager-app had role admin,manager (like in 'tomcat-users.xml' in a memory Realm) which does not work. Changing the user_role to 'manager' puts it..but now the admin-app using the same user complains. Maybe class org.apache.catalina.realm.DataSourceRealm works different than org.apache.catalina.realm.UserDatabaseRealm regarding comma seperated roles ? grisi - Original Message - From: Dirk Griesbach [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Thursday, December 11, 2003 9:57 AM Subject: Re: Tomcat 5.0.16 : manager-app access Hi Adam, thanx for your hint, is there a FAQ or Readme on TC5 I missed ? I moved the manager.xml to ...\conf\catalina\localhost. It has the following content: Context path=/manager docBase=../server/webapps/manager debug=0 privileged=true ResourceLink name=users global=UserDatabase type=javax.sql.DataSource/ /Context You're right, the Realm is defined in the server.xml: ... GlobalNamingResources ... Resource name=UserDatabase auth=Container type=javax.sql.DataSource / ResourceParams name=UserDatabase /ResourceParams /GlobalNamingResources Unfortunately: no effect, 403 - Access to the requested resource has been denied The admin-app still shows no entry in 'User database Is there something else that's worth having a look at ? Dirk - Original Message - From: Adam Hardy [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Wednesday, December 10, 2003 10:17 PM Subject: Re: Tomcat 5.0.16 : manager-app access On 12/10/2003 05:49 PM Dirk Griesbach wrote: hello folks, a question on datasource realms and the manager app: When I installed TC 5.0.16 'out-of-the-box' I could start the manager-app. Then I deployed our webapp (manually), configured a DataSourceRealm using mysql for authentification, configured SSL, form based LogIn and ... the webapp works fine. (The resource name is still UserDatabase) But if I now try to use the manager-app I get the error: 403 - access denied without even being prompted. I've modified ..server\webapps\manager\WEB-INF\web.xml so that it reads: ... resource-env-ref-nameUserDatabase/resource-env-ref-name resource-env-ref-typejavax.sql.DataSource/resource-env-ref-type and ..server\webapps\manager\manager.xml that it reads ... ResourceLink name=users global=UserDatabase type=javax.sql.DataSource/ no effect. Even more strange the behaviour of the admin-app: The Login-screen appears as usual and login data that complies with the the DataSource Realm is being accepted. Clicking on dataSource shows up the 'mysql-jdbc' Installation. Clicking on 'user database' showsnothing. Clicking on 'user roles, groups' etc. results in an error The server encountered an internal error (Error retrieving attribute groups) that prevented it from fulfilling this request. Admin-app uses struts with TagLibs, is there something hardcoded in there ? Why do the these two applications not recognize the new Realm ? Hi Dirk, presumably you configured the realm in the server.xml. You need to put the manager.xml file in conf/Catalina/localhost/ which is the new place for it in 5.x Adam -- struts 1.1 + tomcat 5.0.16 + java 1.4.2 Linux 2.4.20 Debian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- struts 1.1 + tomcat 5.0.16 + java 1.4.2 Linux 2.4.20 Debian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED
Tomcat 5.0.16 : manager-app access - solved
I traced the problem down to the 'user_role' entry in the database: The role of the user used by the manager-app had role admin,manager (like in 'tomcat-users.xml' in a memory Realm) which does not work. Changing the user_role to 'manager' puts it..but now the admin-app using the same user complains. Maybe class org.apache.catalina.realm.DataSourceRealm works different than org.apache.catalina.realm.UserDatabaseRealm regarding comma seperated roles ? grisi - Original Message - From: Dirk Griesbach [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Thursday, December 11, 2003 9:57 AM Subject: Re: Tomcat 5.0.16 : manager-app access Hi Adam, thanx for your hint, is there a FAQ or Readme on TC5 I missed ? I moved the manager.xml to ...\conf\catalina\localhost. It has the following content: Context path=/manager docBase=../server/webapps/manager debug=0 privileged=true ResourceLink name=users global=UserDatabase type=javax.sql.DataSource/ /Context You're right, the Realm is defined in the server.xml: ... GlobalNamingResources ... Resource name=UserDatabase auth=Container type=javax.sql.DataSource / ResourceParams name=UserDatabase /ResourceParams /GlobalNamingResources Unfortunately: no effect, 403 - Access to the requested resource has been denied The admin-app still shows no entry in 'User database Is there something else that's worth having a look at ? Dirk - Original Message - From: Adam Hardy [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Wednesday, December 10, 2003 10:17 PM Subject: Re: Tomcat 5.0.16 : manager-app access On 12/10/2003 05:49 PM Dirk Griesbach wrote: hello folks, a question on datasource realms and the manager app: When I installed TC 5.0.16 'out-of-the-box' I could start the manager-app. Then I deployed our webapp (manually), configured a DataSourceRealm using mysql for authentification, configured SSL, form based LogIn and ... the webapp works fine. (The resource name is still UserDatabase) But if I now try to use the manager-app I get the error: 403 - access denied without even being prompted. I've modified ..server\webapps\manager\WEB-INF\web.xml so that it reads: ... resource-env-ref-nameUserDatabase/resource-env-ref-name resource-env-ref-typejavax.sql.DataSource/resource-env-ref-type and ..server\webapps\manager\manager.xml that it reads ... ResourceLink name=users global=UserDatabase type=javax.sql.DataSource/ no effect. Even more strange the behaviour of the admin-app: The Login-screen appears as usual and login data that complies with the the DataSource Realm is being accepted. Clicking on dataSource shows up the 'mysql-jdbc' Installation. Clicking on 'user database' showsnothing. Clicking on 'user roles, groups' etc. results in an error The server encountered an internal error (Error retrieving attribute groups) that prevented it from fulfilling this request. Admin-app uses struts with TagLibs, is there something hardcoded in there ? Why do the these two applications not recognize the new Realm ? Hi Dirk, presumably you configured the realm in the server.xml. You need to put the manager.xml file in conf/Catalina/localhost/ which is the new place for it in 5.x Adam -- struts 1.1 + tomcat 5.0.16 + java 1.4.2 Linux 2.4.20 Debian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tomcat 5.0.16 : manager-app access
hello folks, a question on datasource realms and the manager app: When I installed TC 5.0.16 'out-of-the-box' I could start the manager-app. Then I deployed our webapp (manually), configured a DataSourceRealm using mysql for authentification, configured SSL, form based LogIn and ... the webapp works fine. (The resource name is still UserDatabase) But if I now try to use the manager-app I get the error: 403 - access denied without even being prompted. I've modified ..server\webapps\manager\WEB-INF\web.xml so that it reads: ... resource-env-ref-nameUserDatabase/resource-env-ref-name resource-env-ref-typejavax.sql.DataSource/resource-env-ref-type and ..server\webapps\manager\manager.xml that it reads ... ResourceLink name=users global=UserDatabase type=javax.sql.DataSource/ no effect. Even more strange the behaviour of the admin-app: The Login-screen appears as usual and login data that complies with the the DataSource Realm is being accepted. Clicking on dataSource shows up the 'mysql-jdbc' Installation. Clicking on 'user database' showsnothing. Clicking on 'user roles, groups' etc. results in an error The server encountered an internal error (Error retrieving attribute groups) that prevented it from fulfilling this request. Admin-app uses struts with TagLibs, is there something hardcoded in there ? Why do the these two applications not recognize the new Realm ?
Re: TC 4 -oreillyMultipart- TC5: Corrupt form data: premature ending
Rémy, how would you have done it ? Maybe there can be applied a fix to it. grisi - Original Message - From: Remy Maucherat [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Thursday, December 04, 2003 6:37 PM Subject: Re: TC 4 -oreillyMultipart- TC5: Corrupt form data: premature ending Dirk Griesbach wrote: Rémy, I'm quite sure. With a summary of oreilly´s sources I see: class MultipartParser { ... private ServletInputStream in; private byte[] buf = new byte[8 * 1024]; ... ServletInputStream in = req.getInputStream(); ... do { String line = readLine(); if (line == null) { throw new IOException(Corrupt form data: premature ending); thrown when using TC5, but not on TC4 } ... private String readLine() throws IOException { int result; StringBuffer sbuf = new StringBuffer(); do { result = in.readLine(buf , 0, buf.length); ... sbuf.append(new String(buf, 0, result, encoding)); } ... return sbuf.toString(); } } looks quite normal, doesn't it ? If they're doing *that*, they might as well use the buffered reader readLine method ;-) Byte by byte input works (it's inefficent, obviously, but it works). I recommend adding some debug in their readLine method to see what is being returned. -- x Rémy Maucherat Senior Developer Consultant JBoss Group (Europe) SàRL x - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: TC 4 -oreillyMultipart- TC5: Corrupt form data: premature ending
Hello Rémy, Dirk Griesbach wrote: Rémy, how would you have done it ? Maybe there can be applied a fix to it. You could add a sys.out in their readLine() method to see what is actually being read :) you hit my thoughts thinking on debugging (:-)), but we now know that this causes trouble somehow so it's worth thinking how to do it differently. Instead of using the 'ServletInputStream' and instead of using the 'readLine()' Method (which is the only one within this class) reading multipart stream byte-by-byte. Reading bytewise is essential, I think, beacuse mostly uploaded data is of binary content. So do you have a suggestion how to avoid the 'readLine()'-thing being more performant ? regards grisi -- x Rémy Maucherat Senior Developer Consultant JBoss Group (Europe) SàRL x - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: TC 4 -oreillyMultipart- TC5: Corrupt form data: premature ending
Yoav, Rémy, thanks for your suggestions. We will consider that; the reason why we hesitate is simply that we would have to apply modifications to the cos-lib we've done would have to be ported to commons fileupload also (with testing, adapting deployment etc). BTW, testing with TC5.0.16 was successful again. Obviously there are side effects of TC' implementation (inputStream-) details, but this only FYI. Again, thanks for your responses and see you soon on this list...(;-)) (I'm not a patient debugger, too...) grisi - Original Message - From: Shapira, Yoav [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Friday, December 05, 2003 3:11 PM Subject: RE: TC 4 -oreillyMultipart- TC5: Corrupt form data: premature ending Howdy, If I were you, Senor Griesbach, I would dump COS in favor of jakarta commons fileupload instead of spending significant time debugging intricate input stream problems... But that's just me, and I'm not a patient debugger ;) Yoav Shapira Millennium ChemInformatics -Original Message- From: Dirk Griesbach [mailto:[EMAIL PROTECTED] Sent: Friday, December 05, 2003 5:57 AM To: Tomcat Users List Subject: Re: TC 4 -oreillyMultipart- TC5: Corrupt form data: premature ending Hello Rémy, Dirk Griesbach wrote: Rémy, how would you have done it ? Maybe there can be applied a fix to it. You could add a sys.out in their readLine() method to see what is actually being read :) you hit my thoughts thinking on debugging (:-)), but we now know that this causes trouble somehow so it's worth thinking how to do it differently. Instead of using the 'ServletInputStream' and instead of using the 'readLine()' Method (which is the only one within this class) reading multipart stream byte-by-byte. Reading bytewise is essential, I think, beacuse mostly uploaded data is of binary content. So do you have a suggestion how to avoid the 'readLine()'-thing being more performant ? regards grisi -- x Rémy Maucherat Senior Developer Consultant JBoss Group (Europe) SàRL x - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: TC 4 -oreillyMultipart- TC5
Hi Joav, the hint putting the lib into WEB-INF/lib instead of $CATALINA_HOME/common/lib put it, thanks to you. But why ? Another classloader issue ? I think this could only be a workaround, not really a solution because this public lib may be used by other servlets, too. What worries is that not all of the classes inside the lib were rejected but only one of them. Is there a kind of class-version-control ? Strange... Hope this gets fixed in the upcoming non-beta release of TC 5. grisi - Original Message - From: Shapira, Yoav [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Wednesday, December 03, 2003 3:53 PM Subject: RE: TC 4 -oreillyMultipart- TC5 Howdy, I don't have an immediate idea, which is worrisome (to me at least ;)). Let's try to not put this oreilly jar in commons/lib, but instead in WEB-INF/lib. Yoav Shapira Millennium ChemInformatics -Original Message- From: Dirk Griesbach [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 03, 2003 9:44 AM To: Tomcat Users List Subject: Re: TC 4 -oreillyMultipart- TC5 Hi Yoav, the 'full' error trace is: java.lang.IllegalAccessError: tried to access method com.oreilly.servlet.multipart.Part.init(Ljava/lang/String;)V from class com.oreilly.servlet.multipart.ParamPart at com.oreilly.servlet.multipart.ParamPart.init(ParamPart.java:42) at com.oreilly.servlet.multipart.MultipartParser.readNextPart(MultipartPar ser. j ava:341) ... the calling servlet method ... the source code mentioned reads: STARTSNIP of class ParamPart public class ParamPart extends Part { /** contents of the parameter */ private byte[] value; HashMap hashMap; private String encoding; /** * Constructs a parameter part; this is called by the parser. * ... */ ParamPart(HashMap hashMap, String name, ServletInputStream in, String boundary, String encoding) throws IOException { super(name); --- start of error-trace this.encoding = encoding; .. ENDSNIP class 'ParamPart' STARTSNIP of class 'Part' public abstract class Part { private String name; /** * Constructs an upload part with the given name. */ Part(String name) { -- this constructor being called causes the error I think this.name = name; } /** * Returns the name of the form element that this Part corresponds to. * * @return the name of the form element that this Part corresponds to. */ public String getName() { return name; } . ENDSNIP class 'ParamPart' I have used TC 5 'as is' after standard installation; no changes to server.xml. Same web.xml. Same with TC4. The multipartlibrary both times (TC4 and TC5) being in ../common/lib Same (web-)application, different results. Any ideas ? grisi - Original Message - From: Shapira, Yoav [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Wednesday, December 03, 2003 3:08 PM Subject: RE: TC 4 -oreillyMultipart- TC5 Howdy, Class ParamPart is public and its constructor is public as well? Strange. Are you running with different security settings? Did you put the library in a different place? Yoav Shapira Millennium ChemInformatics -Original Message- From: Dirk Griesbach [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 03, 2003 8:28 AM To: Tomcat Users List Subject: TC 4 -oreillyMultipart- TC5 Hi folks, I encountered a strange behaviour using 'oreilly's' multipartlibary (from Nov,2002): It works fine on TC 4.1.27 but exactly the same servlet and library with TC 5.0.12 and 5.0.14 (just copied them) the error log reads: java.lang.IllegalAccessError: tried to access method com.oreilly.servlet.multipart.Part.init(Ljava/lang/String;)V from class com.oreilly.servlet.multipart.ParamPart Class 'Part' IS public, so why this error on TC5 ? And no error on TC 4 ? Any suggestions ? greets grisi This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed
Re: TC 4 -oreillyMultipart- TC5: Corrupt form data: premature ending
Another issue came up comparing TC4 and TC5: using the oreilly multipart lib on TC5 causes the error ...Corrupt form data: premature ending on POST uploads. As stated in the FAQ's at http://www.servlets.com/cos/faq.html this problem is merely due to the webcontainer and has been fixed with Tomcat 4. I tested and can state that this problem doesn't occur with TC4. But it is apparent with TC5 again. Will this be fixed ? grisi - Original Message - From: Shapira, Yoav [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Wednesday, December 03, 2003 3:53 PM Subject: RE: TC 4 -oreillyMultipart- TC5 Howdy, I don't have an immediate idea, which is worrisome (to me at least ;)). Let's try to not put this oreilly jar in commons/lib, but instead in WEB-INF/lib. Yoav Shapira Millennium ChemInformatics -Original Message- From: Dirk Griesbach [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 03, 2003 9:44 AM To: Tomcat Users List Subject: Re: TC 4 -oreillyMultipart- TC5 Hi Yoav, the 'full' error trace is: java.lang.IllegalAccessError: tried to access method com.oreilly.servlet.multipart.Part.init(Ljava/lang/String;)V from class com.oreilly.servlet.multipart.ParamPart at com.oreilly.servlet.multipart.ParamPart.init(ParamPart.java:42) at com.oreilly.servlet.multipart.MultipartParser.readNextPart(MultipartPar ser. j ava:341) ... the calling servlet method ... the source code mentioned reads: STARTSNIP of class ParamPart public class ParamPart extends Part { /** contents of the parameter */ private byte[] value; HashMap hashMap; private String encoding; /** * Constructs a parameter part; this is called by the parser. * ... */ ParamPart(HashMap hashMap, String name, ServletInputStream in, String boundary, String encoding) throws IOException { super(name); --- start of error-trace this.encoding = encoding; .. ENDSNIP class 'ParamPart' STARTSNIP of class 'Part' public abstract class Part { private String name; /** * Constructs an upload part with the given name. */ Part(String name) { -- this constructor being called causes the error I think this.name = name; } /** * Returns the name of the form element that this Part corresponds to. * * @return the name of the form element that this Part corresponds to. */ public String getName() { return name; } . ENDSNIP class 'ParamPart' I have used TC 5 'as is' after standard installation; no changes to server.xml. Same web.xml. Same with TC4. The multipartlibrary both times (TC4 and TC5) being in ../common/lib Same (web-)application, different results. Any ideas ? grisi - Original Message - From: Shapira, Yoav [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Wednesday, December 03, 2003 3:08 PM Subject: RE: TC 4 -oreillyMultipart- TC5 Howdy, Class ParamPart is public and its constructor is public as well? Strange. Are you running with different security settings? Did you put the library in a different place? Yoav Shapira Millennium ChemInformatics -Original Message- From: Dirk Griesbach [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 03, 2003 8:28 AM To: Tomcat Users List Subject: TC 4 -oreillyMultipart- TC5 Hi folks, I encountered a strange behaviour using 'oreilly's' multipartlibary (from Nov,2002): It works fine on TC 4.1.27 but exactly the same servlet and library with TC 5.0.12 and 5.0.14 (just copied them) the error log reads: java.lang.IllegalAccessError: tried to access method com.oreilly.servlet.multipart.Part.init(Ljava/lang/String;)V from class com.oreilly.servlet.multipart.ParamPart Class 'Part' IS public, so why this error on TC5 ? And no error on TC 4 ? Any suggestions ? greets grisi This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you
Re: TC 4 -oreillyMultipart- TC5: Corrupt form data: premature ending
Rémy, I had a look into the sources. There it reads: class MultipartParser: do { String line = readLine(); if (line == null) { throw new IOException(Corrupt form data: premature ending); } (:-) By which method should 'readLine()' be replaced to achieve best performance ? grisi - Original Message - From: Remy Maucherat [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Thursday, December 04, 2003 3:23 PM Subject: Re: TC 4 -oreillyMultipart- TC5: Corrupt form data: premature ending Shapira, Yoav wrote: Howdy, Another issue came up comparing TC4 and TC5: using the oreilly multipart lib on TC5 causes the error ...Corrupt form data: premature ending on POST uploads. As stated in the FAQ's at http://www.servlets.com/cos/faq.html this problem is merely due to the webcontainer and has been fixed with Tomcat 4. Umm, you misread that section of the FAQ. It states that there are many possible causes for this bug. A small subcase (IE, client hitting stop then starting again, leading to empty input stream) was isolated and fixed in a couple of containers (tomcat 4.0 and weblogic 6.1 according to the FAQ). I tested and can state that this problem doesn't occur with TC4. But it is apparent with TC5 again. Will this be fixed ? If you provide a concise description along with a test case or steps to reproduce your problems, there's a chance it might be fixed. There has been enough testing for uploading (with the standalone connector, at least, but there's no difference with JK for this), that I can confidently say that there's very little likelihood of a Tomcat bug in this area. Maybe if the thing uses readLine on the Tomcat provided reader (a rather annoying method to implement, so maybe there could be a bug), but in the unlikely case it does, I recommend dumping that library in favor of commons-fileupload (readLine is by definition awful performance wise). -- x Rémy Maucherat Senior Developer Consultant JBoss Group (Europe) SàRL x - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: TC 4 -oreillyMultipart- TC5: Corrupt form data: premature ending
Rémy, this copy is of type javax.servlet.ServletInputStream.readLine() acquired by HttpServletRequest.getInputStream(); Would you agree that this is a good idea ? grisi - Original Message - From: Remy Maucherat [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Thursday, December 04, 2003 3:49 PM Subject: Re: TC 4 -oreillyMultipart- TC5: Corrupt form data: premature ending Dirk Griesbach wrote: Rémy, I had a look into the sources. There it reads: class MultipartParser: do { String line = readLine(); if (line == null) { throw new IOException(Corrupt form data: premature ending); } (:-) By which method should 'readLine()' be replaced to achieve best performance ? Yes, but what does this readLine method does and when is it called ? I was talking about request.getReader().readLine(). -- x Rémy Maucherat Senior Developer Consultant JBoss Group (Europe) SàRL x - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: TC 4 -oreillyMultipart- TC5: Corrupt form data: premature ending
Rémy, I'm quite sure. With a summary of oreilly´s sources I see: class MultipartParser { ... private ServletInputStream in; private byte[] buf = new byte[8 * 1024]; ... ServletInputStream in = req.getInputStream(); ... do { String line = readLine(); if (line == null) { throw new IOException(Corrupt form data: premature ending); thrown when using TC5, but not on TC4 } ... private String readLine() throws IOException { int result; StringBuffer sbuf = new StringBuffer(); do { result = in.readLine(buf , 0, buf.length); ... sbuf.append(new String(buf, 0, result, encoding)); } ... return sbuf.toString(); } } looks quite normal, doesn't it ? grisi - Original Message - From: Remy Maucherat [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Thursday, December 04, 2003 4:16 PM Subject: Re: TC 4 -oreillyMultipart- TC5: Corrupt form data: premature ending Dirk Griesbach wrote: Rémy, this copy is of type javax.servlet.ServletInputStream.readLine() acquired by HttpServletRequest.getInputStream(); Would you agree that this is a good idea ? Are you sure ? There's a ServletIS.readLine(byte[] b, int off, int len) method, but no readLine returning a String (that's in the BufferedReader). SevletIS.readLine is not optimal already (I thought nobody would use it). Maybe it would be a good idea to attempt to reimplement it eventually. -- x Rémy Maucherat Senior Developer Consultant JBoss Group (Europe) SàRL x - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
TC 4 -oreillyMultipart- TC5
Hi folks, I encountered a strange behaviour using 'oreilly's' multipartlibary (from Nov,2002): It works fine on TC 4.1.27 but exactly the same servlet and library with TC 5.0.12 and 5.0.14 (just copied them) the error log reads: java.lang.IllegalAccessError: tried to access method com.oreilly.servlet.multipart.Part.init(Ljava/lang/String;)V from class com.oreilly.servlet.multipart.ParamPart Class 'Part' IS public, so why this error on TC5 ? And no error on TC 4 ? Any suggestions ? greets grisi
Re: TC 4 -oreillyMultipart- TC5
Hi Yoav, the 'full' error trace is: java.lang.IllegalAccessError: tried to access method com.oreilly.servlet.multipart.Part.init(Ljava/lang/String;)V from class com.oreilly.servlet.multipart.ParamPart at com.oreilly.servlet.multipart.ParamPart.init(ParamPart.java:42) at com.oreilly.servlet.multipart.MultipartParser.readNextPart(MultipartParser.j ava:341) ... the calling servlet method ... the source code mentioned reads: STARTSNIP of class ParamPart public class ParamPart extends Part { /** contents of the parameter */ private byte[] value; HashMap hashMap; private String encoding; /** * Constructs a parameter part; this is called by the parser. * ... */ ParamPart(HashMap hashMap, String name, ServletInputStream in, String boundary, String encoding) throws IOException { super(name); --- start of error-trace this.encoding = encoding; .. ENDSNIP class 'ParamPart' STARTSNIP of class 'Part' public abstract class Part { private String name; /** * Constructs an upload part with the given name. */ Part(String name) { -- this constructor being called causes the error I think this.name = name; } /** * Returns the name of the form element that this Part corresponds to. * * @return the name of the form element that this Part corresponds to. */ public String getName() { return name; } . ENDSNIP class 'ParamPart' I have used TC 5 'as is' after standard installation; no changes to server.xml. Same web.xml. Same with TC4. The multipartlibrary both times (TC4 and TC5) being in ../common/lib Same (web-)application, different results. Any ideas ? grisi - Original Message - From: Shapira, Yoav [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Wednesday, December 03, 2003 3:08 PM Subject: RE: TC 4 -oreillyMultipart- TC5 Howdy, Class ParamPart is public and its constructor is public as well? Strange. Are you running with different security settings? Did you put the library in a different place? Yoav Shapira Millennium ChemInformatics -Original Message- From: Dirk Griesbach [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 03, 2003 8:28 AM To: Tomcat Users List Subject: TC 4 -oreillyMultipart- TC5 Hi folks, I encountered a strange behaviour using 'oreilly's' multipartlibary (from Nov,2002): It works fine on TC 4.1.27 but exactly the same servlet and library with TC 5.0.12 and 5.0.14 (just copied them) the error log reads: java.lang.IllegalAccessError: tried to access method com.oreilly.servlet.multipart.Part.init(Ljava/lang/String;)V from class com.oreilly.servlet.multipart.ParamPart Class 'Part' IS public, so why this error on TC5 ? And no error on TC 4 ? Any suggestions ? greets grisi This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to stop the URL comming up?
...another possibilty could be to switch to POST-actions to navigate within your site and make your entry page the only one being served via GET. grisi - Original Message - From: BAO RuiXian [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Thursday, November 27, 2003 12:52 PM Subject: Re: How to stop the URL comming up? Andoni wrote: Hello, I am looking for a way to stop my users bookmarking pages in the site. There is a login screen and they shouldn't even really be let bookmark this. I was given someone's card today an then I went to his site: http://www.xeotrope.net and when I find that as I look around the site the url in the URL bar of my browser stays at http://www.xeotrope.net and never includes the page name. This means that all bookmarks only bring up the main page. Is there any way to do this with apache / Tocmat? As long as I know, not Apache nor Tomcat can achieve this. But, you can implement this by using frame to design your web pages. Again, this is only fool-proof, for experienced users, they can still show your sub-frame login page in a separate browser by right-clicking the mouse and then book mark it. Best Bao - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Where to I put .so for JNI access?
Hi Jim, just make sure your OS can find the shared lib. Under Win: make sure it can be found using your PATH-variable. Under (L)UNIX: the same. Add an environment variable LD_LIBRARAY_PATH and put your .so there. greets grisi - Original Message - From: Jim Lynch [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Monday, November 10, 2003 4:26 PM Subject: Where to I put .so for JNI access? I've searched google for jni and tomcat, but I can't figure out where to put a shared lib so a Tomcat application will find it. All the people looking for help have already figured this out, apparently. Anyway, running Linux on Intel, Tomcat 4.1.24. Where does my .so file go so my SystemLoadLibrary(Replace); might find it? Thanks, Jim. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: memory-leaks in servlets, tool for tracing ?
Christopher, thanks for your comprehensive response ! See more comments down ... - Original Message - From: Christopher Schultz [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Wednesday, October 29, 2003 3:29 PM Subject: Re: memory-leaks in servlets, tool for tracing ? Grisi, our TC-based webapplication performs well but the java-processes concerned are showing increasing memory usage over time. For tracing we already stripped the app down to the very basic to get a clue. Wasn't successful enough. Have you looked at the memory over a long time, including several large GCs? I've had to do this in the past, and it's no fun without a profiler. No, it isn't indeed. I've been checking LINUX' 'top' over a period of time. A mem-hole is apparent. Unfortunately our app makes use of a (self-developed) JNI-Module (C) which makes it even more difficult because the C-code also runs in the Java-context. Unfortunately, profiling tools can get expensive. Anyone know of any decent OSS ones out there? 'JProbe' and 'OptimizeIt!' are really no bargains ! When I've done this sans profiler in the past, I did two things: 1. Turn on verbose GC for the VM (dumps GC stats to stdout) 2. Write a program to parse the GC lines and graph them over time We got a curve that looked like this: - max memory /\ / used memory-/\ / \___/ /\ / \___/ / \___/ --/ ^ OutOfMemoryError This indicated that we were really screwing up somewhere. Had the curve looked like this, we would be happy: - max memory /\ /\ /\ / \ / \ / \ /\ /\ /\ / \_/ \_/ \ _/ ... or even with high-frequency perturbations in there (usually from minor GCs happening periodically). It often helps to set the initial heap size and the maximum heap size to the same value (usually something like 256MB, 512MB, or 1024MB). Just remember that the higher it is, the longer you'll have to wait for a full GC. GCs don't always free everything they can. If they did, they'd take forever. It's only when the VM gets near its maximum heap size that the GC panics and goes on a collection rampage. If you ever get an OutOfMemoryError, go and get a thread-dump. On UNIX, you can sent the VM a STOP signal using kill or by pressing CTRL-\ if the VM is running in a terminal. Good idea, I also achieved this by narrowing available mem on the machine until java gave up quitting with an 'out-of-mem' err. The problem is that the dump written only contains the hex-adresses of the modules being involved. No possibilty to trace those adressesdown to the functions or even modules involved. Even more difficult: the root cause given by this dump is not the function(s)/method(s) causing the memory problems. You'll get lots of good information including the number of threads and where they are. You might find that there are threads there that you thought had terminated long ago. Old active threads are always a source of tied-up memory. Does anybody's got experience with a profiling toolkit which she/he can suggest ? There is a tool provided by SUN itself called 'HAT' (HeapAnalyzingTool) http://java.sun.com/people/billf/heap/ but this seems to be only applicable to java programs, not servlets. With Tomcat there were errors. May be in different cases this would help. I have some experience with Borland's OptimizeIt, and I've even recently installed it on Linux and run Tomcat 4.1 through it. I was able to determine something about the VM and Tomcat that might help you. I thought I had a memory leak, too. In our case it was helpful to operate java with the -Xincgc option that causes the GC to collect smaller amounts of mem; but does this more often. It gives a more accurate impression in the current memory status. What we did is the following: - separate the JNI-module and write a little main()-frame around it to run it alone. - compile this with the 'dmalloc'-library to identify mem not being free'd there. - running the Servlet in one scenario (without JNI) and examine the few methods being touched. - rewrite java-code being in question. - test it on mem-behavior. - iterate with the next scenario etc. Could be more satisfying, this kind of work, but it should be straight-forward. It turns out that when you recompile your servlets and Tomcat does an auto-reload (I have it configured that way), a new ClassLoader gets installed to hold the classes loaded for the new context. However, the classes loaded from the old context stick around because the JVM doesn't want to discard java.lang.Class objects in case they're useful in the future. This increases the number of java.lang.Class objects by about 600 every time I recompiled. After many compile-deploy-reload cycles, my VM was hogging all my memory and lots of
memory-leaks in servlets, tool for tracing ?
hi everybody, our TC-based webapplication performs well but the java-processes concerned are showing increasing memory usage over time. For tracing we already stripped the app down to the very basic to get a clue. Wasn't successful enough. Does anybody's got experience with a profiling toolkit which she/he can suggest ? grisi
Re: Application Configuration
Michael, the servlet-mapping is missung in your web-xml: add the following: servlet-mapping servlet-name your servlet /servlet-name url-pattern the URL through which it should be accessible /url-pattern /servlet-mapping Hope this helps Dirk - Original Message - From: Renda, Michael [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Friday, September 19, 2003 2:18 AM Subject: Application Configuration Hi, I'm having a simple application configuration problem. 1. Tomcat 4.1.27 2. I can run all of the applications in the examples directory. 3. I've created a new directory structure called myApp. Within it is WEB-INF and within that is classes. Within myApp/WEB-INF/classes is a servlet called TestingServlet. 4. I put a simple .jsp page in the /myApp directory and Tomcat serves it up just fine. 5. I cannot access the TestingServlet page, however. Tomcat reports a 404 - requested resource is not available. 6. If I move the servlet to the examples/WEB-INF/classes directory, Tomcat serves it up. 7. The myApp/WEB-INF directory has a web.xml file as follows: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app display-nameMy Java Applications/display-name description Example servlets and JSP pages. /description servlet servlet-nameTesting/servlet-name servlet-classTestingServlet/servlet-class /servlet /web-app 8. The log files show that the myApp application is being deployed at Tomcat startup with no errors. Any suggestions would be appreciated. Mike Renda - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Benefits of increasing bufferSize in server.xml
Hi Hakan, Servlet 2.2 specs provide a method HttpServletResponse.setBufferSize(int size) http://java.sun.com/products/servlet/2.2/javadoc/javax/servlet/ServletRespon se.html which I use to handle larger responses. (But I didn't yet measure its influence on response performance) Dirk - Original Message - From: Shapira, Yoav [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Thursday, September 18, 2003 2:33 PM Subject: RE: Benefits of increasing bufferSize in server.xml Howdy, Why wonder when you can use JMeter? Personally I haven't played enough with bufferSize to conclusively answer your question, but clearly the need for tuning that parameter is directly related to the contents of your webapp, so only you can tune if for your webapp ;) Yoav Shapira Millennium ChemInformatics -Original Message- From: Kilic, Hakan [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 17, 2003 10:09 PM To: '[EMAIL PROTECTED]' Subject: Benefits of increasing bufferSize in server.xml Hi all, I've been tunning my Tomcat server and just wondering about the effects of increasing the bufferSize in the server.xml. From the tomcat documentation bufferSize is The size (in bytes) of the buffer to be provided for input streams created by this connector. By default, buffers of 2048 bytes will be provided. Does this only apply to input streams (requests)? What about large files Tomcat has to serve up to request, how do you increase the buffer size it uses in this case (responses)? I'm basically looking for the Tomcat equivalent of SendBufferSize in Apache. Thanks in advance, -Hakan Kilic - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JNI and Tomcat
Hi Harald, Hi David, look at the fully classified name of your native functions in the DLL or in the .so and compare them to the ones you have in your jni.h headerfile (created using 'javah'). If you have a (windoze).DLL you can view at them using a tool like Depends.exe. Keep in mind that the functions in your shared lib contain the name of the (Java)library/Servlet calling ! If the library/Servlet calling the function does not find a function named _JAVA_name_of_the_calling_Javalib_name_of_native_function it will not work. Hope this helps grisi - Original Message - From: David LAFAY [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, September 16, 2003 1:05 PM Subject: Re: JNI and Tomcat Hi, I have exactly the same problem ! do you found a solution ? Thanks, David LAFAY -- -- -- Harald Wehr [EMAIL PROTECTED] a écrit dans le message news: [EMAIL PROTECTED] I use tomcat 4.0.1 on a SuSE Linux 7.3 and have the following problem: I try to use some functions of a c-shared library. This library works without problems within a jvm started from a console. To load this library in tomcat i made a little helper class with following code: ---snip public class version { static { try { System.loadLibrary(mapscript); System.out.println(Library loaded); } catch (UnsatisfiedLinkError e) { e.printStackTrace(); } ---snip This class is in $TOMCAT_HOME/classes. To be sure that the class is loaded for my servlet I explicit call this class in my servlet with: ---snip Class.forName(version); ---snip Everything works fine. Console shows that the library has been loaded. Nevertheless I get Unsatisfied.Link.Errors when i try to use some functions in my servlet in the same way i would use it in a normal java-program started from the console. Can anyone help me out of this? Thanks Harald -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
TC and JNI...
Hi there and good afternoon world, I have a question regarding JNI and Tomcat (4.1.27): A servlet loads a DLL via static { System.loadLibrary(SharedLib); } This statement placed directly in my servlet works fine. But when another servlet is about to use some functions included in the same .DLL you have to use a different classloader (than the one invoked out of /WEB-INF/classes) to avoid multiple loads of this DLL. So I wrote a primitive class that simply does this static load of the kind package abcd; public class LoadTheLib { public void LoadTheLib() {;}; static { System.loadLibrary(SharedLib); System.out.println(SharedLib loaded); } public String printVersion() { return (Loader 0.1); } } put the class (as jar) in '/common/lib', leave the DLL where it is (it will be found via PATH) restart and ...'unsatisfied link error'. When I call the constructor in my servlet via LoadTheLib loader = new LoadTheLib (); System.out.println(loader.printVersion()); ( which is nonsense in this context, but only to test) both messages appear ('SharedLib loaded' and 'Loader 0.1'); but still: 'unsatisfied link error'. Any idea of what's wrong ? How to make TC load this sharedlib on startup so that other servlets can share it ? best regards dirk
Tomcat and encoded spaces(%20) in URL
Hi folks, we encountered that Tomcat (or, Coyote) omits encoded space characters (%20-chars) when parsing a request (tested on 4.0.4, 4.1.7 and 4.1.24). So a request containing a param like ...PARAM=this%20is%20a%20test... ends up in PARAM=thisisatest. A config issue? A bug ? -- COMPUTERBILD 15/03: Premium-e-mail-Dienste im Test -- 1. GMX TopMail - Platz 1 und Testsieger! 2. GMX ProMail - Platz 2 und Preis-Qualitätssieger! 3. Arcor - 4. web.de - 5. T-Online - 6. freenet.de - 7. daybyday - 8. e-Post - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tomcat and encoded spaces(%20) in URL
Hi folks, we encountered that Tomcat (or, Coyote) omits encoded space characters (%20-chars) when parsing a request (tested on 4.0.4, 4.1.7 and 4.1.24). So a request containing a param like ...PARAM=this%20is%20a%20test... ends up in PARAM=thisisatest. A config issue? A bug ? -- COMPUTERBILD 15/03: Premium-e-mail-Dienste im Test -- 1. GMX TopMail - Platz 1 und Testsieger! 2. GMX ProMail - Platz 2 und Preis-Qualitätssieger! 3. Arcor - 4. web.de - 5. T-Online - 6. freenet.de - 7. daybyday - 8. e-Post - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]