RE: Tomcat and path with pound sign (#) -> ClassNotFoundException
The # character starts a comment in the shell. Try quoting the pathname, or put a \ in front of the #. I would bet that your mkdir and cd commands didn't do what you think they did. -Original Message- From: Markus Schiegl [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 08, 2007 1:54 PM To: users@tomcat.apache.org Subject: Tomcat and path with pound sign (#) -> ClassNotFoundException Hi there, starting Tomcat from a path containing a pound sign (#) somewhere results in a ClassNotFoundException. I've checked this with - Solaris Sparc/X86 + Mac OS X - Java 5 + 6 - Tomcat 5.5.23 + 6.0.13 example: - mkdir /export/home/markus/tomcat#1 - extract tomcat within this directory - export JAVA_HOME=/usr/java (JDK 6) - /export/home/markus/tomcat#1/apache-tomcat-6.0.13/bin/startup.sh or cd /export/home/markus/tomcat#1/apache-tomcat-6.0.13/bin ; ./startup.sh output from catalina.sh with the java call (added set -x to catalina.sh - i.e. no problem of the calling script omitting something) /usr/java/bin/java -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file=/export/home/markus/tomcat#1/apache-tomcat-6.0.13/conf/logging.properties -Djava.endorsed.dirs=/export/home/markus/tomcat#1/apache-tomcat-6.0.13/endorsed -classpath :/export/home/markus/tomcat#1/apache-tomcat-6.0.13/bin/bootstrap.jar:/export/home/markus/tomcat#1/apache-tomcat-6.0.13/bin/commons-logging-api.jar -Dcatalina.base=/export/home/markus/tomcat#1/apache-tomcat-6.0.13 -Dcatalina.home=/export/home/markus/tomcat#1/apache-tomcat-6.0.13 -Djava.io.tmpdir=/export/home/markus/tomcat#1/apache-tomcat-6.0.13/temp org.apache.catalina.startup.Bootstrap start $cat catalina.out java.lang.ClassNotFoundException: org.apache.catalina.startup.Catalina at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at org.apache.catalina.startup.Bootstrap.init(Bootstrap.java:215) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:390) truss output: path was truncated after the # sign: ... 2717/2: read(5, "CAFEBABE\0\0\0 1\00701\0".., 142) = 142 2717/2: stat64("/export/home/markus/tomcat#1/apache-tomcat-6.0.13/bin/org/apache/catalina/security/SecurityClassLoad.class", 0xD230ABF0) Err#2 ENOENT 2717/2: llseek(9, 1422, SEEK_SET) = 1422 2717/2: read(9, " P K0304\n\0\0\0\b\0F91C".., 30) = 30 2717/2: llseek(9, 1504, SEEK_SET) = 1504 2717/2: read(9, "95 W k o14 U18 ~ f [DAC3".., 1634) = 1634 2717/2: brk(0x08172F08) = 0 2717/2: brk(0x08176F08) = 0 2717/9: pollsys(0x, 0, 0xCFCA9CD8, 0x) = 0 2717/2: stat64("/export/home/markus/tomcat#1/apache-tomcat-6.0.13/bin/org/apache/catalina/startup/Catalina.class", 0xD230B3D0) Err#2 ENOENT 2717/2: stat64("/export/home/markus/tomcat", 0xD230AA60) Err#2 ENOENT 2717/2: stat64("/export/home/markus/tomcat", 0xD230AA60) Err#2 ENOENT 2717/2: stat64("/export/home/markus/tomcat", 0xD230AA60) Err#2 ENOENT 2717/2: stat64("/export/home/markus/tomcat", 0xD230AA60) Err#2 ENOENT 2717/3: lwp_cond_wait(0x0806F7A0, 0x0806F788, 0xD208DB48, 0) (sleeping...) 2717/3: lwp_cond_wait(0x0806F7A0, 0x0806F788, 0xD208DB48, 0) Err#62 ETIME 2717/9: pollsys(0x, 0, 0xCFCA9CD8, 0x) = 0 2717/2: stat64("/export/home/markus/tomcat", 0xD230AA60) Err#2 ENOENT 2717/2: stat64("/export/home/markus/tomcat", 0xD230AA60) Err#2 ENOENT 2717/2: stat64("/export/home/markus/tomcat", 0xD230AA60) Err#2 ENOENT ... Although there is a rather old but maybe similar bug at: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4231042 i supose somewhere the road this has been fixed, as i have no problems with JAVA 5/6 and other java programs otherwise my tests where flawed. Installing the jdk in such a directory (e.g. /opt/java#6) works with tomcat, too. Can anybody confirm that "#" is still a special character (for tomcat)? Unfortunately i'm somewhat forced to place tomcat installations/ instances into such (with #) directories. Any fix possible? thanks in advance! kind regards, Markus - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: i am looking for professional tomcat support for enterprise
That could be fun. I tried to move a couple of small servlets from WAS to Tomcat. I found that Tomcat does not understand EAR files, so I had to use WAR files. Also Tomcat didn't like the format of the web.xml files. I ended up importing the .java files into Eclipse and building the the web.xml there. Then I created WAR files and deployed them. -Original Message- From: David Jackson SBS PGST [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 17, 2007 11:33 AM To: Tomcat Users List Subject: Re: i am looking for professional tomcat support for enterprise we currently have IBM websphere support. I did not know that IBM provided tomcat support. is this true? we are in Orlando and are looking to replace about 45 applications that are running on websphere 5.1 with tomcat. On 7/17/07, Johnny Kewl <[EMAIL PROTECTED]> wrote: > > If you really want a company, theres SUN and IBM. > But there are some terrific people on this group, guys that actually write > the code for tomcat, so you've came to the right place. > If you could give some idea of location... an Apache developer may be in > your area. > > > - Original Message - > From: "David Jackson SBS PGST" <[EMAIL PROTECTED]> > To: > Sent: Tuesday, July 17, 2007 8:06 PM > Subject: i am looking for professional tomcat support for enterprise > > > > does anyone of any good companies that provide tomcat AND/OR Geronimo > > support? > > thanks > > David > > Siemens PG > > > > > - > To start a new topic, e-mail: users@tomcat.apache.org > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- David Jackson Email Administrator SBS PGST DataCenter work: 407-736-2992 * [EMAIL PROTECTED] is an external test account used for testing email issues. * no reply is expected, but would be appreciated. * if you received this, your external incoming mail is likely working. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Where to find session cookies
It is up the servlet. As far as I know Tomcat cannot change this. As to how you get the servlet to use one or the other: I do not know enough about WEB programming to tell you. -Original Message- From: lightbulb432 [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 26, 2007 12:13 PM To: users@tomcat.apache.org Subject: RE: Where to find session cookies How can I configure Tomcat to use permanent cookies as opposed to session cookies? One of the reasons I'd like to know is to see the behavior of method isNew() of HttpSession, which I can do if I'm able to disable cookies. As the Javadoc for HttpSession says: "A servlet should be able to handle cases in which the client does not choose to join a session, such as when cookies are intentionally turned off." Fargusson.Alan wrote: > > Session cookies are not stored on disk. This is why they are more secure > then cookies (non-session). Since they only exist in RAM (ok, maybe in > swap files) nobody else using that machine can find them, and they go away > when the browser ends. > > -Original Message- > From: lightbulb432 [mailto:[EMAIL PROTECTED] > Sent: Tuesday, May 29, 2007 12:15 PM > To: users@tomcat.apache.org > Subject: Where to find session cookies > > > > When testing my application that uses sessions, I don't seem to see a > cookie > with domain localhost in my browser's cookies folder. Does Tomcat use some > internal folder to put its cookies, or am I just doing something else > wrong? > > I do have cookies enabled, so it's not writing the session id to the URL, > either. > > Thanks. > -- > View this message in context: > http://www.nabble.com/Where-to-find-session-cookies-tf3835973.html#a10860700 > Sent from the Tomcat - User mailing list archive at Nabble.com. > > > - > To start a new topic, e-mail: users@tomcat.apache.org > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > - > To start a new topic, e-mail: users@tomcat.apache.org > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/Where-to-find-session-cookies-tf3835973.html#a11311838 Sent from the Tomcat - User mailing list archive at Nabble.com. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Where to find session cookies
Session cookies are not stored on disk. This is why they are more secure then cookies (non-session). Since they only exist in RAM (ok, maybe in swap files) nobody else using that machine can find them, and they go away when the browser ends. -Original Message- From: lightbulb432 [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 29, 2007 12:15 PM To: users@tomcat.apache.org Subject: Where to find session cookies When testing my application that uses sessions, I don't seem to see a cookie with domain localhost in my browser's cookies folder. Does Tomcat use some internal folder to put its cookies, or am I just doing something else wrong? I do have cookies enabled, so it's not writing the session id to the URL, either. Thanks. -- View this message in context: http://www.nabble.com/Where-to-find-session-cookies-tf3835973.html#a10860700 Sent from the Tomcat - User mailing list archive at Nabble.com. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: TOMCAT ISSUE: System.Exit
Is System.exit implemented in Tomcat? I thought System.exit is implemented in the JVM. -Original Message- From: Johnny Kewl [mailto:[EMAIL PROTECTED] Sent: Thursday, May 24, 2007 11:47 AM To: Tomcat Users List; [EMAIL PROTECTED] Subject: Re: TOMCAT ISSUE: System.Exit Ok... beginning to think I'm the only one reading here... yes it is a kludge, and I doubt very much whether changing anything in catalina.policy will do anything in this case... because the security manager is probably incorporated in the web-app class loader... and yes this and the documentation makes sense when protecting Tomcat from a rouge web-app but thats not what I'm trying to do... I'm trying to protect an embedded application FROM TOMCAT itself. The code I have shown you is TOMCATS CODE... not the embedded application code which is using tomcat as a library... or a Web-App's code. Ok... think we got crossed lines somewhere... but just to recap... Tomcats System.Exit code kills the client calling tomcat... its rude ;) I suppose I could write a class loader in the client... tell it to stop System.Exits in a custom security manager... and then load up tomcat using that classloader... little bit too much work dont you think? All I think is happening is that those System.Exits make a lot of sense from a server perspective... but not from an embedded perspective... its not a disaster, it doenst make tomcat bad (its great), its just something to think about - Original Message - From: "Pid" <[EMAIL PROTECTED]> To: "Tomcat Users List" Sent: Thursday, May 24, 2007 8:04 PM Subject: Re: TOMCAT ISSUE: System.Exit > Johnny Kewl wrote: >> Ha ha... I think this is a kludge, > > Using a SecurityManager is a kludge? > > but ok, I have "read"... so help >> me... I want to stop Tomcat calling System.Exit(1)... what do I need to >> do to the catalina.policy file to do this? >> I imagine that instead of the embedded app shutting down the user will >> now get a security exception, which to me is wrong... but hey, I'll try >> it. > > The 'System.exit()' example is the usual one, as you will remember from > when you read the documentation: > > http://tomcat.apache.org/tomcat-5.0-doc/security-manager-howto.html > > p > > >> - Original Message - From: "Peter Crowther" >> <[EMAIL PROTECTED]> >> To: "Tomcat Users List" >> Sent: Thursday, May 24, 2007 6:21 PM >> Subject: RE: TOMCAT ISSUE: System.Exit >> >> >>> From: Johnny Kewl [mailto:[EMAIL PROTECTED] >>> Imagine I make a library for you... and your user application >>> does something >>> wrong... and then my library calls System.Exit and shuts down >>> the JVM... how >>> you going to fix that with a security manager?? >> >> The security manager can prevent the call from succeeding. Read, don't >> just assume it can't work. >> http://java.sun.com/j2se/1.5.0/docs/api/java/lang/System.html#exit(int) >> will give you hint on the fact that exit can be prevented by a security >> manager, for example. >> >> - Peter >> >> - >> To start a new topic, e-mail: users@tomcat.apache.org >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> >> - >> To start a new topic, e-mail: users@tomcat.apache.org >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Encoding in Tomcat 6
Is it valid to say "charset=UTF-8"? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, May 21, 2007 7:51 AM To: users@tomcat.apache.org Subject: Encoding in Tomcat 6 Hi all, I noticed some encoding problems inside servlets, when switching from Tomcat 5.5.20 to Tomcat 6.0.10. I looked for it in the mailing lists, but didn't find something appropriate. Scenario: An own servlet (that is: a class derived from HttpServlet) is creating very simple HTML output, containing (beside the necessary HTML tags , etc.) just some German special characters (ä ö ü). The java source code is UTF-8, the response instance is configured via response.setContentType( "text/html;charset=UTF-8" ); Just for safety I also added response.setCharacterEncoding( "UTF-8" ); The created HTML text contains a meta tag Nevertheless: when calling the corresponding URL, all the special characters are not displayed correctly in the browser (Firefox), when using Tomcat 6. If I switch the encoding of the displayed page to ISO-8859-1 in Firefox the characters are displayed correctly. That is: it seems to me that everything is okay with the servlet, except that the used encoding for the response is ISO-8859-1 instead of UTF-8. When using Tomcat 5.5 everything is displayed correctly as UTF-8. Java Server Pages do _not_ show similar behaviour. Has anyone experienced similar problems? - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Runaway catalina.out logging
At the risk of over explaining, this is one of those slightly tricky areas of shell syntax. The general form of the command below would be something like: ls -l | pr > Out Now there are two commands that might generate errors to the terminal. So you do this: ls -l | pr > Out 2>&1 Now you might still see errors output to the terminal. The above redirects the output of the pr command, but not the ls command. So you have to do this: ls -l 2>&1 | pr > Out 2>&1 The first 2>&1 redirects the stderr of the ls command into the pipe. The second 2>&1 redirects the output of pr to the file named Out. The syntax for redirecting stderr to a pipe is a little odd, but in order to get this right it needs to be something like this. -Original Message- From: Andy [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 08, 2007 7:11 PM To: Tomcat Users List Subject: Re: Runaway catalina.out logging Filip, This works, thanks, although I am still not sure why the original failed. Too many players in a single command... Regards, Andy On Wed, 9 May 2007, Filip Hanik - Dev Lists wrote: > change > | /u00/tomcat/bin/logger "$CATALINA_BASE"/logs/catalina 2>&1 & > to > 2>&1 | /u00/tomcat/bin/logger "$CATALINA_BASE"/logs/catalina 2>&1 & > > ie, redirect stderr into stdout before passing it into the logger > > Filip > > Andy wrote: >> This is a correction of the Subject: which I failed to set properly in my >> original message. Sorry... >> >> Hi there, >> >> We have recently switched to tomcat-5.5, on SuSE 9.3, and I ran into a >> strange problem that was not there before. >> >> I am using a custom script from catalina.out rotation. It works much the >> same way as cronolog, except it is much simpler and does more (if anyone >> wants to see/use it, let me know ;) ). The script is invoked using the >> same approach, from catalina.sh: >> >> I replace >> >>>> "$CATALINA_BASE"/logs/catalina.out 2>&1 & >> >> with >> >>| /u00/tomcat/bin/logger "$CATALINA_BASE"/logs/catalina 2>&1 & >> >> This used to work perfectly. But with ver.5.5, some startup and shutdown >> messages "escape" to the terminal. The rest goes to the script as before. >> It seems that for those messages, tomcat explicitly uses a file descriptor >> that corresponds to the terminal, or some such thing. >> >> Anyone has an idea why this is happening, and how I can capture the >> runaways? Any help would be greatly appreciated. >> >> Regards, >> >> Andy Tsouladze >> >> Escaping startup messages: >> >> May 8, 2007 5:45:41 PM org.apache.catalina.core.AprLifecycleListener >> lifecycleEvent >> INFO: The Apache Tomcat Native library which allows optimal performance in >> production environments was not found on the java.library.path: >> /usr/java/jre1.5.0_11/lib/amd64/server:/usr/java/jre1.5.0_11/lib/amd64:/usr/ >> java/jre1.5.0_11/../lib/amd64 >> May 8, 2007 5:45:41 PM org.apache.coyote.http11.Http11BaseProtocol init >> INFO: Initializing Coyote HTTP/1.1 on http-8080 >> May 8, 2007 5:45:42 PM org.apache.coyote.http11.Http11BaseProtocol init >> INFO: Initializing Coyote HTTP/1.1 on http-8443 >> > May 8, 2007 5:45:42 PM org.apache.catalina.startup.Catalina load >> INFO: Initialization processed in 1776 ms >> May 8, 2007 5:45:42 PM org.apache.catalina.core.StandardService start >> INFO: Starting service Catalina >> May 8, 2007 5:45:42 PM org.apache.catalina.core.StandardEngine start >> INFO: Starting Servlet Engine: Apache Tomcat/5.5.17 >> May 8, 2007 5:45:42 PM org.apache.catalina.core.StandardHost start >> INFO: XML validation disabled >> May 8, 2007 5:45:43 PM org.apache.catalina.core.StandardContext start >> SEVERE: Error listenerStart >> May 8, 2007 5:45:43 PM org.apache.catalina.core.StandardContext start >> SEVERE: Context [/axis] startup failed due to previous errors >> May 8, 2007 5:45:44 PM org.apache.coyote.http11.Http11BaseProtocol start >> INFO: Starting Coyote HTTP/1.1 on http-8080 >> May 8, 2007 5:45:44 PM org.apache.coyote.http11.Http11BaseProtocol start >> INFO: Starting Coyote HTTP/1.1 on http-8443 >> May 8, 2007 5:45:44 PM org.apache.jk.common.ChannelSocket init >> INFO: JK: ajp13 listening on /0.0.0.0:8009 >> May 8, 2007 5:45:44 PM org.apache.jk.server.JkMain start >> INFO: Jk running ID=0 time=0/82 config=null >> May 8, 2007 5:45:44 PM org.apache.catalina.storeconfig.StoreLoader load >> INFO: Find registry server-registry.xml at classpath resource >> May 8, 2007 5:45:44 PM org.apache.catalina.startup.Catalina start >> INFO: Server startup in 2181 ms >> >> >> Escaping shutdown messages: >> >> >> May 8, 2007 5:47:25 PM org.apache.coyote.http11.Http11BaseProtocol pause >> INFO: Pausing Coyote HTTP/1.1 on http-8080 >> May 8, 2007 5:47:25 PM org.apache.coyote.http11.Http11BaseProtocol pause >> INFO: Pausing Coyote HTTP/1.1 on http-8443 >> csapp02:/u00/jakarta/bin # May 8, 2007 5:47:26 PM >> org.apache.catalina.core.StandardService stop >> INFO: Stopping service Catalina >
RE: Tomcat randomly cannot connect to SMTP host
I see you got a number of good suggestions. If you still have this problem you could try doing a netstat command to see if your server is holding the connections to the SMTP server. I have seen this type of thing cause some weird problems. If your server is holding several connections to the SMTP server it would mean that the application isn't closing the socket when it is done. -Original Message- From: Raymond Holguin [mailto:[EMAIL PROTECTED] Sent: Friday, May 04, 2007 12:38 PM To: users@tomcat.apache.org Subject: Tomcat randomly cannot connect to SMTP host Hello, I have tomcat 5.0.28 running on my Linux machine, and all my applications running under this tomcat experience the same problem at the same time which is why I believe it to be a tomcat issue. When my applications attempt to send out an email I get this error message (Mail server connection failed; nested exception is javax.mail.MessagingException: Could not connect to SMTP host: xx, port: 25; nested exception is: java.net.ConnectException: Connection refused) The SMTP server is fine, because I can use it from other applications not on that tomcat server. I can also telnet into the SMTP server just fine from that same machine, so i don't believe its a server/port blocking issue on the OS or hardware level. The only way I am able to resolve the problem is to restart Tomcat. Once Tomcat is restarted, then all operation with emailing works fine again. I cannot seem to force the issue to happen so i don't know how reproduce it on demand, even though I know that would help in solving the issue. This problem just seems to come up randomly and wont go away until I restart tomcat. If anyone can please help me solve this issue that would be greatly appreciated. I have important applications running on this machine and its a great inconvenience to those using the applications when this problem comes up. Thank you -Ray -- Raymond Holguin Programmer Analyst College of Humanities, Arts, and Social Sciences Tel: (951) 827-6212 Email: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Log files always locked
I think this is a Windows issue. I doubt that Tomcat actually locks the log files. The reason I think that this is a Windows issue is that I run into the same thing with other programs. I don't run Tomcat on Windows, so I can't check Tomcat log files specifically. I think that this behavior depends on the type of filesystem used. In my case it seems that if a file is on a FAT filesystem I have this problem, but if it is on a NTFS filesystem I don't. I have not been able to prove this though. -Original Message- From: Johnny Kewl [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 02, 2007 11:34 AM To: Tomcat Users List Subject: Log files always locked Just something that bugs me. On windows if you try open a tomcat log file... which are typically associated with something like notepad, you get "In Use By Another Program". Why does Tomcat lock the file handle indefinitely? It maybe good programming practice but windows utilities generally dont give one the option of "will open as read only"... its always a mission just to read a log file. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: linux + tomcat, some path/link problem
I may be completely miss-understanding, but I think this is a browser trick. At least in IE7 when I have c: it assumes file:..., but when I don't have c: it assumes http:... . You will probably need to code file:///root/test.html (I may have the wrong number of / after file:) to get this to work. -Original Message- From: Lu Rui [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 24, 2007 9:46 AM To: users@tomcat.apache.org Subject: linux + tomcat, some path/link problem hi, all, i'm writing a jsp front-end of a desktop search program in linux using tomcat 5.5, here is my problem. say we need a result.jsp which can display the results from lucene and show the related links, codes like below (hard-coding for simple, as long as you can get my thougt is okay) // for winxp String filePath = new String("c:\\root\\test.html"); // for linux String filePath = new String("/root/test.html"); testlink i've test this page both in winxp and linux. in windows, right-click to check out the property of "testlink" you can see it goes to " file:///c:/root:/test.html " and left-click then the browser will open corresponding page, which is exactly what i've been expecting. but in linux here comes my trouble, i click "testlink" it goes to "404 not found", then i check out its property and find it leads to " http://localhost:8080/root/index.html ", it seems tomcat took " /root " as a subdir of " /tomcat/webapps " and messed things up, totally misunderstood my purpose. as far as i know path is always a confusing problem of tomcat, but in linux "/" stands for root of file system, so i'm clearly using an abusolute path, why tomcat still made such mistake while it works well in windows with " C:\\root\test.html" ? and as mentioned above, this link, actually these links, might go to anywhere in local file system, which makes the trouble more complex, so i don't think setup Context or docBase or relative-path could help much, i really need tomcat to be informed that i'm using abusolute path and i don't care it goes out of web project and that's what i want. plz help me out. thanks. and if what i said make you feel somehow offended, it's not my bad feelings just my bad english.. while ( true ) { help me out; } regards. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Problem with compiling tomcat native
401: ac_confdir: command not found ./configure: line 4402: ac_config_commands: command not found ./configure: line 4403: ac_config_files: command not found ./configure: line 4404: ac_config_guess: command not found ./configure: line 4405: ac_config_libobj_dir: command not found On 4/24/07, Orlando Reis <[EMAIL PROTECTED]> wrote: > > Ok, I understand your point of view, I've checked it and /bin/sh on debian > 4 points to /bin/bash, you might be right, question is, how do I do fix > this. > > When I say you might be right is because there are other scripts in > jni/native/build which are bourne shell scripts. Those scripts are called > when you do a ./configure > > vserv-deb:/usr/local/build/tomcat-native-1.1.10-src/jni/native# ls -l > build > total 156 > -rw-r--r-- 1 root root 26635 2007-04-23 20:21 apr_common.m4 > -rwxr-xr-x 1 500 root 2115 2007-01-05 17:33 buildcheck.sh > -rwxr-xr-x 1 root root 44208 2007-04-23 20:21 config.guess > -rwxr-xr-x 1 root root 32448 2007-04-23 20:21 config.sub > -rw-r--r-- 1 root root 6302 2007-04-23 20:21 find_apr.m4 > -rwxr-xr-x 1 500 root 1156 2007-01-05 17:33 get-version.sh > -rwxr-xr-x 1 root root 2631 2007-04-23 20:21 install.sh > -rw-r--r-- 1 500 root 3633 2007-01-05 21:57 lineends.pl > -rwxr-xr-x 1 500 root 980 2007-01-05 17:33 mkdir.sh > drwxr-xr-x 2 500 root 4096 2007-04-02 07:07 rpm > -rw-r--r-- 1 root root 6149 2007-04-23 20:21 rules.mk > -rw-r--r-- 1 500 root 10421 2007-04-02 05:51 tcnative.m4 > > > On the other hand, that already happened on debian 3.1 and I was able to > build the hole thing on a client: > apache(with apr and apr-util)/tomcat-native/tomcat-connector > > Same versions I'm trying to build now. > > Orlando Reis > > On 4/23/07, Fargusson.Alan <[EMAIL PROTECTED]> wrote: > > > > I just want to make one point clear: Even when you are using bash, if > > /bin/sh is linked to some other shell, or is a copy of some other shell, > > then shell scripts may be run by that other shell, and not bash. > > > > I have seen problems due to the order in which packages are > > installed. It seems that some packages link /bin/sh to the shell contained > > in that package, so even though bash was the default shell to start with, > > some other shell ends up replacing it, and fails to run configure scripts. > > > > -Original Message- > > From: Orlando Reis [mailto:[EMAIL PROTECTED] > > Sent: Monday, April 23, 2007 12:06 PM > > To: Tomcat Users List > > Subject: Re: Problem with compiling tomcat native > > > > > > Thanks for the reply Alan. > > > > I'm using bash, and have used bash in Solaris, Linux (Centos, RHE5, > > Fedora, > > Ubuntu). > > > > None of those platforms gave me a headache, only Debian 4.0, with > > Debian 3.1I didn't have a problem. > > > > Orlando > > > > On 4/23/07, Fargusson.Alan <[EMAIL PROTECTED]> wrote: > > > > > > It may be that the configure script depends on the default shell > > (/bin/sh) > > > being BASH. Does it work if you do "bash configure"? > > > > > > -Original Message- > > > From: Orlando Reis [mailto:[EMAIL PROTECTED] > > > Sent: Monday, April 23, 2007 4:25 AM > > > To: users@tomcat.apache.org > > > Subject: Problem with compiling tomcat native > > > > > > > > > Hi, I'm having some trouble compiling tomcat-native-1.1.10-src, I've > > done > > > this before on several different platforms, but for some reason the > > > lastest > > > debian (4.0 etch) is giving me problems. > > > > > > vserv-deb:/usr/local/build/tomcat- native-1.1.10-src/jni/native# sh > > > buildconf > > > --with-java-home=$JAVA_HOME --with-apr=/usr/local/build/httpd-2.2.4 > > > /srclib/apr > > > > > > Looking for apr source in /usr/local/build/httpd-2.2.4/srclib/apr > > > Creating configure ... > > > Generating 'make' outputs ... > > > rebuilding rpm spec file > > > vserv-deb:/usr/local/build/tomcat-native-1.1.10-src/jni/native# > > > ./configure > > > --with-java-home=$JAVA_HOME --with-apr=/usr/local/apr-httpd > > > --with-ssl=/usr/local/openssl > > > checking build system type... i686-pc-linux-gnu > > > checking host system type... i686-pc-linux-gnu > > > checking target system type... i686-pc-linux-gnu > > > checking for a BSD-compatible install... /usr/bin/install -c > > > checking for working mkdir -p... yes > > > Tomcat Native Version: 1.1.10 > > > checking for c
RE: Problem with compiling tomcat native
I just want to make one point clear: Even when you are using bash, if /bin/sh is linked to some other shell, or is a copy of some other shell, then shell scripts may be run by that other shell, and not bash. I have seen problems due to the order in which packages are installed. It seems that some packages link /bin/sh to the shell contained in that package, so even though bash was the default shell to start with, some other shell ends up replacing it, and fails to run configure scripts. -Original Message- From: Orlando Reis [mailto:[EMAIL PROTECTED] Sent: Monday, April 23, 2007 12:06 PM To: Tomcat Users List Subject: Re: Problem with compiling tomcat native Thanks for the reply Alan. I'm using bash, and have used bash in Solaris, Linux (Centos, RHE5, Fedora, Ubuntu). None of those platforms gave me a headache, only Debian 4.0, with Debian 3.1I didn't have a problem. Orlando On 4/23/07, Fargusson.Alan <[EMAIL PROTECTED]> wrote: > > It may be that the configure script depends on the default shell (/bin/sh) > being BASH. Does it work if you do "bash configure"? > > -Original Message- > From: Orlando Reis [mailto:[EMAIL PROTECTED] > Sent: Monday, April 23, 2007 4:25 AM > To: users@tomcat.apache.org > Subject: Problem with compiling tomcat native > > > Hi, I'm having some trouble compiling tomcat-native-1.1.10-src, I've done > this before on several different platforms, but for some reason the > lastest > debian (4.0 etch) is giving me problems. > > vserv-deb:/usr/local/build/tomcat-native-1.1.10-src/jni/native# sh > buildconf > --with-java-home=$JAVA_HOME --with-apr=/usr/local/build/httpd-2.2.4 > /srclib/apr > > Looking for apr source in /usr/local/build/httpd-2.2.4/srclib/apr > Creating configure ... > Generating 'make' outputs ... > rebuilding rpm spec file > vserv-deb:/usr/local/build/tomcat-native-1.1.10-src/jni/native# > ./configure > --with-java-home=$JAVA_HOME --with-apr=/usr/local/apr-httpd > --with-ssl=/usr/local/openssl > checking build system type... i686-pc-linux-gnu > checking host system type... i686-pc-linux-gnu > checking target system type... i686-pc-linux-gnu > checking for a BSD-compatible install... /usr/bin/install -c > checking for working mkdir -p... yes > Tomcat Native Version: 1.1.10 > checking for chosen layout... tcnative > checking for APR... yes > setting CC to "gcc" > setting CPP to "gcc -E" > checking for a BSD-compatible install... /usr/bin/install -c > checking for JDK location (please wait)... /usr/local/java.1.6 > checking Java platform... checking Java platform... > checking for sablevm... NONE > adding "-I/usr/local/java.1.6/include" to TCNATIVE_PRIV_INCLUDES > checking os_type directory... linux > adding "-I/usr/local/java.1.6/include/linux" to TCNATIVE_PRIV_INCLUDES > checking for gcc... gcc > checking for C compiler default output file name... a.out > checking whether the C compiler works... yes > checking whether we are cross compiling... no > checking for suffix of executables... > checking for suffix of object files... o > checking whether we are using the GNU C compiler... yes > checking whether gcc accepts -g... yes > checking for gcc option to accept ISO C89... none needed > checking for OpenSSL library... using openssl from /usr/local/openssl/lib > and /usr/local/openssl/include > checking OpenSSL library version... ok > checking for OpenSSL DSA support... yes > adding "-I/usr/local/openssl/include" to TCNATIVE_PRIV_INCLUDES > setting TCNATIVE_LDFLAGS to "-L/usr/local/openssl/lib -lssl -lcrypto" > adding "-DHAVE_OPENSSL" to CFLAGS > setting TCNATIVE_LIBS to "" > setting TCNATIVE_LIBS to " /usr/local/apr-httpd/lib/libapr-1.la -lrt > -lcrypt -lpthread -ldl" > ./configure: line 4280: APR_INCLUDES: command not found > ./configure: line 4281: APR_LIBS: command not found > ./configure: line 4282: APR_LIB_TARGET: command not found > ./configure: line 4283: APR_SO_EXT: command not found > ./configure: line 4284: BASH: command not found > ./configure: line 4285: BASH_ARGC: command not found > ./configure: line 4286: BASH_ARGV: command not found > ./configure: line 4287: BASH_LINENO: command not found > ./configure: line 4288: BASH_SOURCE: command not found > ./configure: line 4289: BASH_VERSINFO: command not found > ./configure: line 4290: BASH_VERSION: command not found > ./configure: line 4291: CC: command not found > ./configure: line 4292: CFLAGS: command not found > ./configure: line 4293: CPP: command not found > > > > > > Line 4288 > > _ACEOF > > > # The following way of writing the cache mishandles newlines in va
RE: Problem with compiling tomcat native
It may be that the configure script depends on the default shell (/bin/sh) being BASH. Does it work if you do "bash configure"? -Original Message- From: Orlando Reis [mailto:[EMAIL PROTECTED] Sent: Monday, April 23, 2007 4:25 AM To: users@tomcat.apache.org Subject: Problem with compiling tomcat native Hi, I'm having some trouble compiling tomcat-native-1.1.10-src, I've done this before on several different platforms, but for some reason the lastest debian (4.0 etch) is giving me problems. vserv-deb:/usr/local/build/tomcat-native-1.1.10-src/jni/native# sh buildconf --with-java-home=$JAVA_HOME --with-apr=/usr/local/build/httpd-2.2.4 /srclib/apr Looking for apr source in /usr/local/build/httpd-2.2.4/srclib/apr Creating configure ... Generating 'make' outputs ... rebuilding rpm spec file vserv-deb:/usr/local/build/tomcat-native-1.1.10-src/jni/native# ./configure --with-java-home=$JAVA_HOME --with-apr=/usr/local/apr-httpd --with-ssl=/usr/local/openssl checking build system type... i686-pc-linux-gnu checking host system type... i686-pc-linux-gnu checking target system type... i686-pc-linux-gnu checking for a BSD-compatible install... /usr/bin/install -c checking for working mkdir -p... yes Tomcat Native Version: 1.1.10 checking for chosen layout... tcnative checking for APR... yes setting CC to "gcc" setting CPP to "gcc -E" checking for a BSD-compatible install... /usr/bin/install -c checking for JDK location (please wait)... /usr/local/java.1.6 checking Java platform... checking Java platform... checking for sablevm... NONE adding "-I/usr/local/java.1.6/include" to TCNATIVE_PRIV_INCLUDES checking os_type directory... linux adding "-I/usr/local/java.1.6/include/linux" to TCNATIVE_PRIV_INCLUDES checking for gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking for OpenSSL library... using openssl from /usr/local/openssl/lib and /usr/local/openssl/include checking OpenSSL library version... ok checking for OpenSSL DSA support... yes adding "-I/usr/local/openssl/include" to TCNATIVE_PRIV_INCLUDES setting TCNATIVE_LDFLAGS to "-L/usr/local/openssl/lib -lssl -lcrypto" adding "-DHAVE_OPENSSL" to CFLAGS setting TCNATIVE_LIBS to "" setting TCNATIVE_LIBS to " /usr/local/apr-httpd/lib/libapr-1.la -lrt -lcrypt -lpthread -ldl" ./configure: line 4280: APR_INCLUDES: command not found ./configure: line 4281: APR_LIBS: command not found ./configure: line 4282: APR_LIB_TARGET: command not found ./configure: line 4283: APR_SO_EXT: command not found ./configure: line 4284: BASH: command not found ./configure: line 4285: BASH_ARGC: command not found ./configure: line 4286: BASH_ARGV: command not found ./configure: line 4287: BASH_LINENO: command not found ./configure: line 4288: BASH_SOURCE: command not found ./configure: line 4289: BASH_VERSINFO: command not found ./configure: line 4290: BASH_VERSION: command not found ./configure: line 4291: CC: command not found ./configure: line 4292: CFLAGS: command not found ./configure: line 4293: CPP: command not found Line 4288 _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;;#line 4288 esac ;; esac done Any ideas? Orlando - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Using a DataSource from Tomcat to DB2.
One more try at this. I have been working on getting a DataSource to work with DB2. At this point I am using a DataSource I configured with the admin web page. I have a new question. I found that I am getting an inconsistent result. I get one of two results, without changing anything. One result is a "No suitable driver", and the other is a "java.lang.NullPointerException". The null pointer exception happens in the DB2Driver, which looks like Tomcat found the driver. But the first case looks like Tomcat didn't find the driver. This leads me to believe that there is a bug in Tomcat. Does that seem like a logical conclusion? >From catalina.out: org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class ' ' for connect URL 'null' at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSou rce.java:780) at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource .java:540) at DSServlet.connect(DSServlet.java:108) at DSServlet.doGet(DSServlet.java:38) ... Then one of the following: Caused by: java.sql.SQLException: No suitable driver at java.sql.DriverManager.getDriver(DriverManager.java:243) at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSou rce.java:773) Caused by: java.lang.NullPointerException at java.util.StringTokenizer.(StringTokenizer.java:146) at com.ibm.db2.jcc.DB2Driver.acceptsURL(DB2Driver.java:248) at java.sql.DriverManager.getDriver(DriverManager.java:232) at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSou rce.java:773) - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Using a DataSource to access DB2.
I used the MySQL and Oracle examples to create a server.xml file. I don't actually have Oracle. I could probably try to get MySQL configured, but I don't know if it worth the effort. -Original Message- From: Rashmi Rubdi [mailto:[EMAIL PROTECTED] Sent: Monday, April 16, 2007 1:34 PM To: Tomcat Users List Subject: Re: Using a DataSource to access DB2. On 4/16/07, Fargusson.Alan <[EMAIL PROTECTED]> wrote: > I do not see any way to add the auth resource from the admin page, so I > edited the server.xml to add it. The only change was the message "Caused by: > java.sql.SQLException: No suitable driver" instead of the Null pointer > exception. I tried changing the server.xml back and I still get the No > suitable driver, so I suspect some timing issue here. > > There are two ResourceParams. Below the one for UserDatabase is one for > jdbc/TestDB. You are right, sorry I got corss-eyed looking at the XML and didn't notice the 2nd ReourceParams > > I am just about convinced that I will not be able to use a DataSource with > DB2. Can anyone convince me otherwise? > Unless it's documented somewhere that connection pooling is not possible with DB2 I think it should still work. In one of your earlier posts you had mentioned that you weren't able to connect to MySQL or Oracle either with Conneciton Pooling --- did you try those? I think once you have it working for one database it's simply a matter of switching the JDBC JAR file and the connection string. -Rashmi - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Using a DataSource to access DB2.
I do not see any way to add the auth resource from the admin page, so I edited the server.xml to add it. The only change was the message "Caused by: java.sql.SQLException: No suitable driver" instead of the Null pointer exception. I tried changing the server.xml back and I still get the No suitable driver, so I suspect some timing issue here. There are two ResourceParams. Below the one for UserDatabase is one for jdbc/TestDB. I am just about convinced that I will not be able to use a DataSource with DB2. Can anyone convince me otherwise? -Original Message- From: Rashmi Rubdi [mailto:[EMAIL PROTECTED] Sent: Monday, April 16, 2007 11:42 AM To: Tomcat Users List Subject: Re: Using a DataSource to access DB2. Thanks for providing adequate relevant details. I compare parts of your configuration to http://tomcat.apache.org/tomcat-5.0-doc/config/globalresources.html In the above link it says: element in the web application deployment descriptor, but is optional if the application uses a instead." Since you have defined in your web.xml the auth attribute is required, but you haven't specified it in this: tag. Also the ResourceParams tag looks incorrect, it should be: but you have it as: The above are some of the mis configurations I've identified so far, there could be more. -Rashmi - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Using a DataSource to access DB2.
I want to thank those who have been trying to help me get this working. I am still stuck on this. I am going to try and ask the same question again in a little different way and maybe someone can spot what I am doing wrong. Or perhaps tell me if DB2 will not work with a DataSource. I have tried several different ways of configuring this. Mostly I have edited the server.xml file myself. My latest attempt is to use the Tomcat management application. The generated XML from server.xml is: factory org.apache.catalina.users.MemoryUserDatabaseFactory pathname conf/tomcat-users.xml maxWait 5000 maxActive 4 password test url jdbc:db2://devhost1:446/FTBDB2D driverClassName com.ibm.db2.jcc.DB2Driver maxIdle 2 username f4185 In my web.xml: http://java.sun.com/dtd/web-app_2_3.dtd";> Data Source Test Servlet Data Source test servlet for Tomcat DSServlet DSServlet DSServlet /DSServlet Resource reference to DB2. jdbc/TestDB javax.sql.DataSource Container In catalina.out: org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class ' ' for connect URL 'null' at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSou rce.java:780) at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource .java:540) at DSServlet.connect(DSServlet.java:99) at DSServlet.doGet(DSServlet.java:38) ... Farther down: Caused by: java.lang.NullPointerException So I think the NullPointerException is in createDataSource. Could this mean that the DB2 driver is incompatible in some way? Other info: Tomcat 5.0.28, DB2 8.1 (actually 8.2 I think). I am able to access the database using DriverManager, so I am sure my URL is right. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: DB2 DataSource.
I tried the management console way because I was not sure I was getting the xml right. I will stick with that until I find something wrong with the generated xml. -Original Message- From: Rashmi Rubdi [mailto:[EMAIL PROTECTED] Sent: Friday, April 13, 2007 11:09 AM To: Tomcat Users List Subject: Re: DB2 DataSource. On 4/13/07, Fargusson.Alan <[EMAIL PROTECTED]> wrote: > I am putting my Resource inside the GlobalNamingResource. Do I need anything > in the Context node? > If you are using GlobalNamingResource you don't need the Context node because it is global to all contexts and not just one context. > I have been doing this two different ways. My latest attempts I have used > the management > console which generates the server.xml file. Focus on one way :-) and get it to work before attempting alternatives. > - To start a new topic, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: DB2 DataSource.
I am putting my Resource inside the GlobalNamingResource. Do I need anything in the Context node? I have been doing this two different ways. My latest attempts I have used the management console which generates the server.xml file. -Original Message- From: Rashmi Rubdi [mailto:[EMAIL PROTECTED] Sent: Friday, April 13, 2007 10:27 AM To: Tomcat Users List Subject: Re: DB2 DataSource. As Len Popp mentioned before, the syntax for Connection Pooling is different for certain versions of Tomcat. If you carefully follow the documentation of "JDBC DataSources" for *your* version of Tomcat http://tomcat.apache.org/ , and do some additional minor research on the pseudo-code presented in the How-To document, you should be able to connect with Connection Pooling. One common mistake I've seen is people forget to nest the Context node inside the Host node, or forget to associate an external Context file to a particular Host in server.xml If you think anything is misconfigured or too confusing, it helps to start with a fresh install of the version of Tomcat you intend to use. -Rashmi On 4/13/07, Fargusson.Alan <[EMAIL PROTECTED]> wrote: > Your right. My ResourceParam syntax is different. I didn't look closely at > that. My values are mostly the same. > - To start a new topic, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: DB2 DataSource.
Your right. My ResourceParam syntax is different. I didn't look closely at that. My values are mostly the same. -Original Message- From: Len Popp [mailto:[EMAIL PROTECTED] Sent: Friday, April 13, 2007 9:25 AM To: Tomcat Users List Subject: Re: DB2 DataSource. It should *not* look the same, because the syntax of the element changed after 5.0. Look for in the 5.0 documentation. -- Len On 4/13/07, Fargusson.Alan <[EMAIL PROTECTED]> wrote: > Thanks. I am using 5.0.28, but what I have looks like what you have. I will > take a closer look to make sure I didn't miss something. > > -Original Message- > From: Rashmi Rubdi [mailto:[EMAIL PROTECTED] > Sent: Thursday, April 12, 2007 5:59 PM > To: Tomcat Users List > Subject: Re: DB2 DataSource. > > > Your Tomcat version is not known, so I'm assuming the latest version 6.0.10. > > Here's what should go in: > -- > ./MyProject/WEB-INF/web.xml > -- > > http://java.sun.com/xml/ns/javaee"; > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; > xsi:schemaLocation="http://java.sun.com/xml/ns/javaee > web-app_2_5.xsd" > version="2.5"> > MySQL Test App > > DB Connection > jdbc/TestDB > javax.sql.DataSource > Container > > > > - > According to the HOW-TO document I gave earlier the JAR for the JDBC > driver must be placed in Tomcat's lib folder, so > ...\apache-tomcat-6.0.10_bak_20070410\lib\ > - > mysql-connector-java-5.0.5-bin.jar > > - > Add the connection pooling configuration to your application's Context > definition > - > reloadable="true" debug="true"> > type="javax.sql.DataSource" > maxActive="100" maxIdle="30" maxWait="1" > username="javauser" password="javadude" > driverClassName="com.mysql.jdbc.Driver" > > url="jdbc:mysql://localhost:3306/javatest?autoReconnect=true"/> > > > > - > And finally, here's the sample working code: > /WEB-INF/classes/com/connectionpooltest/ConnectionPoolTest.java > > package com.connectionpooltest; > > import java.sql.*; > import javax.naming.*; > import javax.sql.DataSource; > > public class ConnectionPoolTest { > > public void testConnection() throws SQLException, NamingException{ > Connection conn = null; > Statement stmt = null; > ResultSet rs = null; > > try{ > //conn = ... get connection from connection pool ... > Context initContext = new InitialContext(); > Context envContext = > (Context)initContext.lookup("java:/comp/env"); > DataSource ds = (DataSource)envContext.lookup("jdbc/TestDB"); > conn = ds.getConnection(); > > //stmt = conn.createStatement("select ..."); > stmt = conn.createStatement(); > > //rs = stmt.executeQuery(); > rs = stmt.executeQuery("SELECT 'Java Connection Pooling Test' as > a FROM dual"); > > //... iterate through the result set ... > while (rs.next()) { > String s = rs.getString("a"); > System.out.println(" s is : " + s); > } > > rs.close(); > rs = null; > stmt.close(); > stmt = null; > conn.close(); // Return to connection pool > conn = null; // Make sure we don't close it twice > > }catch(SQLException e){ > e.printStackTrace(); > }finally{ > // Always make sure result sets and statements are closed, > // and the connection is returned to the pool > if (rs != null) { > try { rs.close(); } catch (SQLException e) { > e.printStackTra
RE: DB2 DataSource.
Thanks. I am using 5.0.28, but what I have looks like what you have. I will take a closer look to make sure I didn't miss something. -Original Message- From: Rashmi Rubdi [mailto:[EMAIL PROTECTED] Sent: Thursday, April 12, 2007 5:59 PM To: Tomcat Users List Subject: Re: DB2 DataSource. Your Tomcat version is not known, so I'm assuming the latest version 6.0.10. Here's what should go in: -- ./MyProject/WEB-INF/web.xml -- http://java.sun.com/xml/ns/javaee"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://java.sun.com/xml/ns/javaee web-app_2_5.xsd" version="2.5"> MySQL Test App DB Connection jdbc/TestDB javax.sql.DataSource Container - According to the HOW-TO document I gave earlier the JAR for the JDBC driver must be placed in Tomcat's lib folder, so ...\apache-tomcat-6.0.10_bak_20070410\lib\ - mysql-connector-java-5.0.5-bin.jar - Add the connection pooling configuration to your application's Context definition - - And finally, here's the sample working code: /WEB-INF/classes/com/connectionpooltest/ConnectionPoolTest.java package com.connectionpooltest; import java.sql.*; import javax.naming.*; import javax.sql.DataSource; public class ConnectionPoolTest { public void testConnection() throws SQLException, NamingException{ Connection conn = null; Statement stmt = null; ResultSet rs = null; try{ //conn = ... get connection from connection pool ... Context initContext = new InitialContext(); Context envContext = (Context)initContext.lookup("java:/comp/env"); DataSource ds = (DataSource)envContext.lookup("jdbc/TestDB"); conn = ds.getConnection(); //stmt = conn.createStatement("select ..."); stmt = conn.createStatement(); //rs = stmt.executeQuery(); rs = stmt.executeQuery("SELECT 'Java Connection Pooling Test' as a FROM dual"); //... iterate through the result set ... while (rs.next()) { String s = rs.getString("a"); System.out.println(" s is : " + s); } rs.close(); rs = null; stmt.close(); stmt = null; conn.close(); // Return to connection pool conn = null; // Make sure we don't close it twice }catch(SQLException e){ e.printStackTrace(); }finally{ // Always make sure result sets and statements are closed, // and the connection is returned to the pool if (rs != null) { try { rs.close(); } catch (SQLException e) { e.printStackTrace(); } rs = null; } if (stmt != null) { try { stmt.close(); } catch (SQLException e) { e.printStackTrace(); } stmt = null; } if (conn != null) { try { conn.close(); } catch (SQLException e) { e.printStackTrace(); } conn = null; } } } } Since Connection Pooling is handled by the Container, the above code must be called from within the context of the Container --- so it must be called from either a Servlet or a JSP page --- it cannot be called from the command line alone using a main method. -Rashmi - To start a new topic, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: DB2 DataSource.
I think I have all the jar files in the right place. In fact I can access DB2 when I use DriverManager. -Original Message- From: Foo Shyn [mailto:[EMAIL PROTECTED] Sent: Thursday, April 12, 2007 11:14 PM To: Tomcat Users List Cc: Martin Gainty Subject: Re: DB2 DataSource. Hi, I'd been using connection pooling setting in Tomcat for MySQL, MSSQL and Derby(or Cloudscape) so i guess DB2 could be setup just as same. Make sure your driver jar file includes the Driver which is packaged as you had declared in the XML. And place it in the Tomcat common lib folder (In Tomcat 4.1's case, Tomcat 4.1\common\lib). Thanx. Regards, FooShyn - Original Message - From: "Pulkit Singhal" <[EMAIL PROTECTED]> To: "Tomcat Users List" <[EMAIL PROTECTED]> Cc: "Martin Gainty" <[EMAIL PROTECTED]> Sent: Friday, April 13, 2007 1:05 PM Subject: Re: DB2 DataSource. > The following is copy/pasted from > http://jtds.sourceforge.net/faq.html#noSuitableDriver > > Why do I get a java.sql.SQLException: "No suitable driver" when trying to > get a connection? > > The "No suitable driver" exception is thrown by the DriverManager when > none > of the registered Driver implementations recognizes the supplied URL. This > means that you either did not register jTDS with the DriverManager first > (by > calling Class.forName("net.sourceforge.jtds.jdbc.Driver")) or you mistyped > the URL (e.g. "jbdc:jtds:..." instead of "jdbc:jtds:..."). > > A common mistake is to append a semicolon (";") to the end of the URL > (e.g. > "jdbc:jtds:sqlserver://server/db;TDS=7.0;" is wrong!). > > For more information about URL format and the properties that may be > passed > to jTDS have a look at the jTDS URL > format<http://jtds.sourceforge.net/faq.html#urlFormat> > . > > > On 4/12/07, Fargusson.Alan <[EMAIL PROTECTED]> wrote: >> >> Thanks. Unfortunately I did try this example before. It doesn't work. >> I >> get an exception, and along with the stack dump I display I get "Caused >> by: >> java.sql.SQLException: No suitable driver". >> >> I am hoping that someone has a working example that they actually tested. >> >> -Original Message- >> From: Martin Gainty [mailto:[EMAIL PROTECTED] >> Sent: Thursday, April 12, 2007 3:19 PM >> To: Tomcat Users List >> Subject: Re: DB2 DataSource. >> >> >> Alan- >> >> http://www.itjungle.com/fhg/fhg051204-story01.html >> >> Viel Gluck/Buena Suerte >> >> Martin-- >> This email message and any files transmitted with it contain confidential >> information intended only for the person(s) to whom this email message is >> addressed. If you have received this email message in error, please >> notify >> the sender immediately by telephone or email and destroy the original >> message without making a copy. Thank you. >> >> - Original Message - >> From: "Fargusson.Alan" <[EMAIL PROTECTED]> >> To: <[EMAIL PROTECTED]> >> Sent: Thursday, April 12, 2007 6:01 PM >> Subject: DB2 DataSource. >> >> >> Can someone point me to documentation on setting up a DataSource to DB2? >> >> I tried to use the examples for Oracle and MySql, but I have not been >> able >> to get it to work. >> >> I am able to access DB2 using the DriverManager. >> >> - >> To start a new topic, e-mail: [EMAIL PROTECTED] >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> >> - >> To start a new topic, e-mail: [EMAIL PROTECTED] >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> - >> To start a new topic, e-mail: [EMAIL PROTECTED] >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.446 / Virus Database: 269.3.0/758 - Release Date: 4/12/2007 11:52 AM - To start a new topic, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: DB2 DataSource.
Actually my program works when I use DriverManager. It only failes when I use a DataSource. -Original Message- From: Pulkit Singhal [mailto:[EMAIL PROTECTED] Sent: Thursday, April 12, 2007 10:06 PM To: Tomcat Users List Cc: Martin Gainty Subject: Re: DB2 DataSource. The following is copy/pasted from http://jtds.sourceforge.net/faq.html#noSuitableDriver Why do I get a java.sql.SQLException: "No suitable driver" when trying to get a connection? The "No suitable driver" exception is thrown by the DriverManager when none of the registered Driver implementations recognizes the supplied URL. This means that you either did not register jTDS with the DriverManager first (by calling Class.forName("net.sourceforge.jtds.jdbc.Driver")) or you mistyped the URL (e.g. "jbdc:jtds:..." instead of "jdbc:jtds:..."). A common mistake is to append a semicolon (";") to the end of the URL (e.g. "jdbc:jtds:sqlserver://server/db;TDS=7.0;" is wrong!). For more information about URL format and the properties that may be passed to jTDS have a look at the jTDS URL format<http://jtds.sourceforge.net/faq.html#urlFormat> . On 4/12/07, Fargusson.Alan <[EMAIL PROTECTED]> wrote: > > Thanks. Unfortunately I did try this example before. It doesn't work. I > get an exception, and along with the stack dump I display I get "Caused by: > java.sql.SQLException: No suitable driver". > > I am hoping that someone has a working example that they actually tested. > > -Original Message- > From: Martin Gainty [mailto:[EMAIL PROTECTED] > Sent: Thursday, April 12, 2007 3:19 PM > To: Tomcat Users List > Subject: Re: DB2 DataSource. > > > Alan- > > http://www.itjungle.com/fhg/fhg051204-story01.html > > Viel Gluck/Buena Suerte > > Martin-- > This email message and any files transmitted with it contain confidential > information intended only for the person(s) to whom this email message is > addressed. If you have received this email message in error, please > notify > the sender immediately by telephone or email and destroy the original > message without making a copy. Thank you. > > - Original Message - > From: "Fargusson.Alan" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Thursday, April 12, 2007 6:01 PM > Subject: DB2 DataSource. > > > Can someone point me to documentation on setting up a DataSource to DB2? > > I tried to use the examples for Oracle and MySql, but I have not been able > to get it to work. > > I am able to access DB2 using the DriverManager. > > - > To start a new topic, e-mail: [EMAIL PROTECTED] > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > - > To start a new topic, e-mail: [EMAIL PROTECTED] > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > - > To start a new topic, e-mail: [EMAIL PROTECTED] > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To start a new topic, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: DB2 DataSource.
It might be helpful to look at your code. I suspect that getting DB2 to work involves more then just replacing the MySql driver with a DB2 equivalent. I have tried using the examples to get this to work. -Original Message- From: Rashmi Rubdi [mailto:[EMAIL PROTECTED] Sent: Thursday, April 12, 2007 4:56 PM To: Tomcat Users List Subject: Re: DB2 DataSource. I tried the example shown at the bottom of the page here: http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html with MySQL and I got it to work, but I don't have DB2. If you want the code with MySQL I can post it. -Rashmi On 4/12/07, Fargusson.Alan <[EMAIL PROTECTED]> wrote: > I am hoping that someone has a working example that they actually tested. - To start a new topic, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: DB2 DataSource.
Thanks. Unfortunately I did try this example before. It doesn't work. I get an exception, and along with the stack dump I display I get "Caused by: java.sql.SQLException: No suitable driver". I am hoping that someone has a working example that they actually tested. -Original Message- From: Martin Gainty [mailto:[EMAIL PROTECTED] Sent: Thursday, April 12, 2007 3:19 PM To: Tomcat Users List Subject: Re: DB2 DataSource. Alan- http://www.itjungle.com/fhg/fhg051204-story01.html Viel Gluck/Buena Suerte Martin-- This email message and any files transmitted with it contain confidential information intended only for the person(s) to whom this email message is addressed. If you have received this email message in error, please notify the sender immediately by telephone or email and destroy the original message without making a copy. Thank you. - Original Message - From: "Fargusson.Alan" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, April 12, 2007 6:01 PM Subject: DB2 DataSource. Can someone point me to documentation on setting up a DataSource to DB2? I tried to use the examples for Oracle and MySql, but I have not been able to get it to work. I am able to access DB2 using the DriverManager. - To start a new topic, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DB2 DataSource.
Can someone point me to documentation on setting up a DataSource to DB2? I tried to use the examples for Oracle and MySql, but I have not been able to get it to work. I am able to access DB2 using the DriverManager. - To start a new topic, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]