problem with executing a batch file in tomcat JAVA servlet
I'm trying to execute a batch file in my servlet in tomcat5. I'm using the Process class exec() and issuing a command of cmd.exe /C file.bat Then I do a p.waitFor(); after this. However, it appears that a few of the files copy, then the process hangs. If I stop the calling program, the batch file completes. Any Ideas of what's happening? Thanks, Dan Gross, ATLC - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tomcat can't see a new function
I have a strange problem. I am using Borland to compile my source files and create jar files. For some reason things are not working correctly. In one jar library, I can create new functions, rebuild the library, and when I put them up in Tomcat 5.5 WEB-INF, it recognizes them. However, I have another library jar file that use to work, but now I can't seem to add any functions to any of the files and have them seen by tomcat. They work fine in the Borland debugger, but I get this error in the log file from Tomcat. I tried creating a simple 10 line program and trying to call a new function in any of the files in the jar library file, and it doesn't see them. However, tomcat does recognize the original functions that each file originally had in them, and they work fine. It's only new fuctions that don't work. Any ideas? This one is a real bugger. I tried this on two different servers with tomcat 5.5 and got the same error shown below. I have to get this resolved because more jar files need to be modified for our servers. Thanks, Dan Gross, ATLC Aug 20, 2008 3:59:36 AM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet invoker threw exception java.lang.NoSuchMethodError: GIUtilities.GILog.testfunction()V at testservlet.doGet(testservlet.java:26) at javax.servlet.http.HttpServlet.service(HttpServlet.java:690) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:420) at org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:134) at javax.servlet.http.HttpServlet.service(HttpServlet.java:690) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685) at java.lang.Thread.run(Unknown Source) - 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: Mapped File Access Problems in Servlets
I am not running in a domain, my servers are running in a workgroup only, and the machine tomcat 5.5 is running on is logged into an administrator account. It appears that it sees the mapped drives because if I try to access a file that is not available, I get the proper JAVA message. When I try to access an existing file, I get a java.io.FileNotFoundException filename (Access is Denied). The same user and password exists on the other machine which is why I can map the drive. I tried a simple experiment and wrote a 5 line JAVA program and this accessed the drive just fine, but when I put those 5 lines in the servlet, I got the access denied. How do I change the configuration in the tomcat service to allow it to see other computers? Thanks, Dan Gross, ATLC Mark Thomas wrote: Daniel L. Gross wrote: I have a servlet that does a direct read from a mapped drive in Windows. It works fine in tomcat as long as I use a drive on the local machine. However, I need to access a mapped drive on a different machine. When I run the program, I get a FileNotFound error in JAVA and (access denied) next to it. Is there some permissions that need to be set so my servlet can access a file on another machine. And how do I set this in Tomcat/JAVA. Thanks, Dan Gross ATLC This comes down to the Windows user Tomcat is running as. You need to make sure that that user has the necessary access to the network drives. If you are running as a service, the default user for services has zero privs on other machines. Usually what is required is to configure the service to log on as a domain user that has the necessary access. HTH, Mark - 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: Mapped File Access Problems in Servlets
I just tried changing the login configuration to log onto the administrator account, and I still get access denied. Any thoughts??? Thanks, Dan Gross, ATLC Mark Thomas wrote: Daniel L. Gross wrote: I have a servlet that does a direct read from a mapped drive in Windows. It works fine in tomcat as long as I use a drive on the local machine. However, I need to access a mapped drive on a different machine. When I run the program, I get a FileNotFound error in JAVA and (access denied) next to it. Is there some permissions that need to be set so my servlet can access a file on another machine. And how do I set this in Tomcat/JAVA. Thanks, Dan Gross ATLC This comes down to the Windows user Tomcat is running as. You need to make sure that that user has the necessary access to the network drives. If you are running as a service, the default user for services has zero privs on other machines. Usually what is required is to configure the service to log on as a domain user that has the necessary access. HTH, Mark - 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: Mapped File Access Problems in Servlets
Thanks for all your help, I found out the problem. It was the service privilege running under the local machine. The default tomcat icon at the bottom of the screen that allows you to configure and start/stop tomcat would not let me change the user it ran under. However, I was able to change the user to Administrator under the windows services window and I can start and stop tomcat there as well. Again, thanks for your quick responses, got me out of a tight Jam. Dan Gross, ATLC Mark Thomas wrote: Daniel L. Gross wrote: I have a servlet that does a direct read from a mapped drive in Windows. It works fine in tomcat as long as I use a drive on the local machine. However, I need to access a mapped drive on a different machine. When I run the program, I get a FileNotFound error in JAVA and (access denied) next to it. Is there some permissions that need to be set so my servlet can access a file on another machine. And how do I set this in Tomcat/JAVA. Thanks, Dan Gross ATLC This comes down to the Windows user Tomcat is running as. You need to make sure that that user has the necessary access to the network drives. If you are running as a service, the default user for services has zero privs on other machines. Usually what is required is to configure the service to log on as a domain user that has the necessary access. HTH, Mark - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Mapped File Access Problems in Servlets
I have a servlet that does a direct read from a mapped drive in Windows. It works fine in tomcat as long as I use a drive on the local machine. However, I need to access a mapped drive on a different machine. When I run the program, I get a FileNotFound error in JAVA and (access denied) next to it. Is there some permissions that need to be set so my servlet can access a file on another machine. And how do I set this in Tomcat/JAVA. Thanks, Dan Gross ATLC - 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: Memory Usage
I looked at the profiler and it appears that there are many timer threads left hanging. I have not set up a data source for Tomcat or any connection pooling. I am opening a connection to the database directly with the following code. Could this be causing my problem? thanks again, Dan public M5Connection(String DBHost, String DBName, String DBUsername, String DBPassword) throws SQLException { //setup the DB connectivity paramters DATABASE_HOST = DBHost; DATABASE_NAME = DBName; DATABASE_USERNAME = DBUsername; DATABASE_PASSWORD = DBPassword; loadDBDriver(); //load the JDBC driver class into memory at runtime connect(); //connect to the database using the above driver } // constructor public Connection getConnection() { return conn; } //used to load the DB Driver into memory at runtime private void loadDBDriver() { // The newInstance() call is a work around for some // mm.MySQL implementations try { Class.forName(com.mysql.jdbc.Driver).newInstance(); System.out.println(Driver instantiated); //debug } catch (Exception E) { System.err.println(Unable to load driver.); E.printStackTrace(); } } //connects to a database private void connect() throws SQLException { conn = DriverManager.getConnection(jdbc:mysql:// + DATABASE_HOST + / + DATABASE_NAME + ?user= + DATABASE_USERNAME + password= + DATABASE_PASSWORD); System.out.println(Connection made); //debug } Caldarale, Charles R wrote: From: Daniel L. Gross [mailto:[EMAIL PROTECTED] Subject: Re: Memory Usage What appears to be happening is that every time I execute my app, when it closes, Tomcat leaves an inactive thread hanging. I seriously doubt that Tomcat is doing this - much more likely that your app is causing it, or possibly the DB driver. Does the app create any auxiliary threads and not have them terminate? If that's not the case, and threads from Tomcat's pool were not returning to it after processing a request for your app, you'd run out of threads pretty quickly. What does a thread dump show about where these hanging threads are hanging out? - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Memory Usage
As an additional note: I put up a simple test servlet that prints to the screen and it does not leave any threads hanging nor does it have a memory problem so it is definately something connected to how I use the J-Connector or open and close the database. The problem only occurs when I make a connection to the database. If this helps any. Thanks again. I really need to solve this problem because it's a show stopper for my application. -- Dan Daniel L. Gross wrote: I looked at the profiler and it appears that there are many timer threads left hanging. I have not set up a data source for Tomcat or any connection pooling. I am opening a connection to the database directly with the following code. Could this be causing my problem? thanks again, Dan public M5Connection(String DBHost, String DBName, String DBUsername, String DBPassword) throws SQLException { //setup the DB connectivity paramters DATABASE_HOST = DBHost; DATABASE_NAME = DBName; DATABASE_USERNAME = DBUsername; DATABASE_PASSWORD = DBPassword; loadDBDriver(); //load the JDBC driver class into memory at runtime connect(); //connect to the database using the above driver } // constructor public Connection getConnection() { return conn; } //used to load the DB Driver into memory at runtime private void loadDBDriver() { // The newInstance() call is a work around for some // mm.MySQL implementations try { Class.forName(com.mysql.jdbc.Driver).newInstance(); System.out.println(Driver instantiated); //debug } catch (Exception E) { System.err.println(Unable to load driver.); E.printStackTrace(); } } //connects to a database private void connect() throws SQLException { conn = DriverManager.getConnection(jdbc:mysql:// + DATABASE_HOST + / + DATABASE_NAME + ?user= + DATABASE_USERNAME + password= + DATABASE_PASSWORD); System.out.println(Connection made); //debug } Caldarale, Charles R wrote: From: Daniel L. Gross [mailto:[EMAIL PROTECTED] Subject: Re: Memory Usage What appears to be happening is that every time I execute my app, when it closes, Tomcat leaves an inactive thread hanging. I seriously doubt that Tomcat is doing this - much more likely that your app is causing it, or possibly the DB driver. Does the app create any auxiliary threads and not have them terminate? If that's not the case, and threads from Tomcat's pool were not returning to it after processing a request for your app, you'd run out of threads pretty quickly. What does a thread dump show about where these hanging threads are hanging out? - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To 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: Memory Usage
How to I dump the threads, there doesn't seem to be an option in the Profiler. The tomcat start/stop manager has a dump threads option, it doesn't seem to do anything when I click it. Here's some additional information from the profiler. It's a stack trace of the Timer-0 thread: java.sql.DriverManager.getConnection(java.lang.String) M5Classes.M5Connection.connect() M5Classes.M5Connection init(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) _jprofiler_annotation_class.URL:/Tracks/servlet/Router() org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run() I think we have found the problem. Every time I make a connection, it leaves one of these threads hanging. Now whats the solution? That's the $50. question. Thanks, Dan Caldarale, Charles R wrote: From: Daniel L. Gross [mailto:[EMAIL PROTECTED] Subject: Re: Memory Usage I looked at the profiler and it appears that there are many timer threads left hanging. What do you mean by timer threads? What does a thread dump show about them? - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Realm authentication - unconventional usage
I think that will be my next attempt. There are two reasons I haven't done that. 1. The original code for this application was written with a direct-connect to the database because it was set up to run on either Oracle or MySql, and it has been working fine up until we went to Tomcat 5.5. 2. I am not an XML wizard, and the documentation for tomcat XML configuration files leaves something to be desired. So I am not exactly sure how to do that. Thanks again much, Dan Caldarale, Charles R wrote: From: Santosh Puranshettiwar [mailto:[EMAIL PROTECTED] Subject: Re: Realm authentication - unconventional usage So seems like I *will* have to stick to application layer authentication, or is there a way out? Why can't you use one of the standard, spec-defined, container-managed mechanisms? - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Memory Usage
In MySql the timeout is 10 seconds. I have tried various times in the tomcat configuration file, but nothing seems to matter. -- Dan Caldarale, Charles R wrote: From: Daniel L. Gross [mailto:[EMAIL PROTECTED] Subject: Re: Memory Usage The tomcat start/stop manager has a dump threads option, it doesn't seem to do anything when I click it. Start Tomcat using catalina run, and then do whatever your OS needs to send an interrupt (ctrl-break on Windows). Here's some additional information from the profiler. It's a stack trace of the Timer-0 thread: java.sql.DriverManager.getConnection(java.lang.String) M5Classes.M5Connection.connect() This shows it's trying to connect to the server; what's the DB connection timeout value? Infinite, by any chance? - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Memory Usage
I really could use some help here. Has anyone used tomcat 5.5 with the J-Connector? I made a simple servlet that just opens a connection to my MYSQL database and then closes it and does nothing else. When I look at the windows task manager, the memory usage of Tomcat jumps each time I run the servlet. The memory is never recovered. Does anyone have a similar problem? And is there a solution? I am running some production stuff that uses similar code, and when the Tomcat memory usage gets to 1GB, Tomcat stops working and handling requests. Thanks so much, Dan - 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: Memory Usage
It appears to be running garbage collection, but it doesn't recover all the memory, so as we make and break connections to the database, the memory usage just keeps piling up. We never had this problem with the old connector running under Tomcat 4. Thanks, Dan Caldarale, Charles R wrote: From: Daniel L. Gross [mailto:[EMAIL PROTECTED] Subject: Re: Memory Usage I have run the lamda probe on the software, but it didn't show anything useful. It's not a profiler, and was never intended to be. Where do I turn on the -verbose:gc? In the tomcat start-up script? It's a standard java launcher option. If you're running from a script, try setting it in JAVA_OPTS before kicking off the script. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Memory Usage
I appreciate your help with this problem. I downloaded JProfiler and ran it on tomcat 5.5.20. The garbage collection is running fine. Memory keeps going up when I make and break connections to the database. What appears to be happening is that every time I execute my app, when it closes, Tomcat leaves an inactive thread hanging. I think if I could clear up the inactive threads, the garbage collection routine would get the memory back. Is there any way to release inactive threads in Tomcat 5.5? Thanks again so much, -- Dan. Caldarale, Charles R wrote: From: Daniel L. Gross [mailto:[EMAIL PROTECTED] Subject: Re: Memory Usage I have run the lamda probe on the software, but it didn't show anything useful. It's not a profiler, and was never intended to be. Where do I turn on the -verbose:gc? In the tomcat start-up script? It's a standard java launcher option. If you're running from a script, try setting it in JAVA_OPTS before kicking off the script. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Memory Usage
Is there a way to force Tomcat 5.5 to run a garbage collection? Thanks, Dan Caldarale, Charles R wrote: From: Daniel L. Gross [mailto:[EMAIL PROTECTED] Subject: Re: Memory Usage I have run the lamda probe on the software, but it didn't show anything useful. It's not a profiler, and was never intended to be. Where do I turn on the -verbose:gc? In the tomcat start-up script? It's a standard java launcher option. If you're running from a script, try setting it in JAVA_OPTS before kicking off the script. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Memory Leaks
I am running tomcat 5.5.17 with the newest J-Connector talking to MySql. I have many servlets which access the database, and with Tomcat 5.5.17, it seems that each time I access a servlet, it uses more memory, and doesn't release it when the servlet is done. Previously I was running tomcat 4 and never had a problem with memory usage. I still have one server running tomcat 4 with my servlet software and it's has been running for almost a year without ever re-booting. I have changed my servlet code to make sure all my database connections and JDBC calls are properly closed, but this had no effect. Does anyone know what has changed in Tomcat 5.5 the could be causing this. Thanks, Dan Gross - 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: Memory Leaks
Additional Information. I did some more testing and it appears that the memory only goes up in tomcat 5 when I open a connection to the mysql database using the J-Connector. If I run a simple servlet that does nothing but opens a connection to my database then closes it at the end, I still leave memory hanging in tomcat 5. Any ideas? Thanks again, Dan Daniel L. Gross wrote: I am running tomcat 5.5.17 with the newest J-Connector talking to MySql. I have many servlets which access the database, and with Tomcat 5.5.17, it seems that each time I access a servlet, it uses more memory, and doesn't release it when the servlet is done. Previously I was running tomcat 4 and never had a problem with memory usage. I still have one server running tomcat 4 with my servlet software and it's has been running for almost a year without ever re-booting. I have changed my servlet code to make sure all my database connections and JDBC calls are properly closed, but this had no effect. Does anyone know what has changed in Tomcat 5.5 the could be causing this. Thanks, Dan Gross - 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]
memory problems
I have some servlets that run without problem on tomcat 4, but when I upgraded to Tomcat 5.5.15, everytime a servlet is accessed, it uses a little more memory, and finally after many users, runs out of heap space. Any clues? Thanks Dan Gross - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]