Re: Multiple war files for a single webapp or context
Would the nested context approach allow access to session data from one war file to the other? Thanks On Mon, Oct 17, 2011 at 12:08 PM, Konstantin Kolinko knst.koli...@gmail.com wrote: 2011/10/17 Ziggy zigg...@gmail.com: I have an application that has the following structure $TOMCAT_HOME/webapps/myapp |-css |-myapp.css |-js |-myapp.js |-forum |-index.jsp |-list.jsp |-users.jsp |-Articles |-index.jsp |-ListArticles.jsp |-Guestbook |-viewGuestBook.jsp |-AddnewEntry.jsp |-WEB-INF |-classes com |-myapp |-forum |-DisplayForum.class |-ListUsers.class |-article |-ArticleList.class |-AddArticle.class |-guestbk |-LoadGuestBook.class |-ProcessGuestBook.class The application is delivered as a war file (i.e. myapp.war) and is deployed into the $TOMCAT_HOME/webapps folder. If any of the files change (either the jsp, css, js or java files) i have to always rebuild the whole war file. This means i deploy every single file on every release. I am wondering if there is a way to deploy specific areas of the application. I am particularly interested if it is possible to separate the application into multiple war files. i.e. myapp.war, articles.war and forum.war. I would like to still access the application via the same context i.e. http://0.0.0.0/myapp even though multiple war files are used. Using this approach, i will be able to deliver just the module that was affected by the change. Is this at all possible? I dont mind having to restart the container after each war file is deployed. You are not saying what Tomcat version you are using. It is possible to create wars for nested context. E.g. to separate scripts into myapp#js.war - the root of this web application will be /myapp/js/ Note that all web applications are independent of each other, so you need to have separate web.xml for each of them, and you cannot access to code that belongs to another web application. Best regards, Konstantin Kolinko - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Tomcat JMX connection - Authentication failed.
Tomcat JMX connection - Authentication failed. I am having some problems setting up Tomcat for JMX. I added the following properties to CATALINA_OPTS CATALINA_OPTS=-Dcom.sun.management.jmxremote.port=18070 -Dcom.sun.management.jmxremote.password.file=$CATALINA_BASE/conf/jmxremote.password -Dcom.sun .management.jmxremote.ssl=false And have added the jmxremote.password file in to the conf directory. I wrote a client tool that connects to the JMX server running on port 18070. When i run the client program i get the following error. Exception in thread main java.lang.SecurityException: Authentication failed! Credentials required at com.sun.jmx.remote.security.JMXPluggableAuthenticator.authenticationFailure(JMXPluggableAuthenticator.java:193) at com.sun.jmx.remote.security.JMXPluggableAuthenticator.authenticate(JMXPluggableAuthenticator.java:145) at sun.management.jmxremote.ConnectorBootstrap$AccessFileCheckerAuthenticator.authenticate(ConnectorBootstrap.java:185) at javax.management.remote.rmi.RMIServerImpl.doNewClient(RMIServerImpl.java:213) at javax.management.remote.rmi.RMIServerImpl.newClient(RMIServerImpl.java:180) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305) at sun.rmi.transport.Transport$1.run(Transport.java:159) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:155) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) at java.lang.Thread.run(Thread.java:619) at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255) at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233) at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142) at javax.management.remote.rmi.RMIServerImpl_Stub.newClient(Unknown Source) at javax.management.remote.rmi.RMIConnector.getConnection(RMIConnector.java:2312) at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:277) at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:248) at com.bt.c21sc.c21tkprobe.accessors.C21TkProbeJmxDAO.connect(Unknown Source) at com.bt.c21sc.c21tkprobe.service.C21TkProbeBD.execute(Unknown Source) at com.bt.c21sc.c21tkprobe.C21AppserverProbe.main(Unknown Source) If i change the CATALINA_OPTS properties to CATALINA_OPTS=-Dcom.sun.management.jmxremote.port=18070 -Dcom.sun.management.jmxremote.password.file=$CATALINA_BASE/conf/jmxremote.password -Dcom.sun .management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false Then it works fine. I think what i am confused of is what is classed as remote access. I am running the client program away from the Tomcat instance but both Tomcat and the client tool are on the same machine (i.e. different virtual machines but same environemnt). I thought i had to configure the remote authentication if i access the JMX server remotely from a different machine. By remote access do they mean accessing the JMX server from any VM either locally on the same machine or remotely from a different machine?
Re: Tomcat JMX connection - Authentication failed.
Ok i am stuck now - here is the full configuration $CATALINA_BASE/setenv.sh --- CATALINA_OPTS=-Dcom.sun.management.jmxremote.port=18070 -Dcom.sun.management.jmxremote.password.file=$CATALINA_BASE/conf/jmxremote.password -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=true -Dcom.sun.management.jmxremote.access.file=$CATALINA_BASE/conf/jmxremote.access export CATALINA_OPTS $CATALINA_BASE/conf/jmxremote.password --- monitorRole monitorpass controlRole controlpass $CATALINA_BASE/conf/jmxremote.access --- monitorRole readonly controlRole readwrite The client tool i am using to access the Tomcat JMX server is running on the same machine as the Tomcat instance. when i start tomcat i can see that there is something listening at port 18070 but when i try to connect i get the following error Exception in thread main java.lang.SecurityException: Authentication failed! Credentials required at com.sun.jmx.remote.security.JMXPluggableAuthenticator.authenticationFailure(JMXPluggableAuthenticator.java:193) at com.sun.jmx.remote.security.JMXPluggableAuthenticator.authenticate(JMXPluggableAuthenticator.java:145) at sun.management.jmxremote.ConnectorBootstrap$AccessFileCheckerAuthenticator.authenticate(ConnectorBootstrap.java:185) at javax.management.remote.rmi.RMIServerImpl.doNewClient(RMIServerImpl.java:213) I connect using the following bit of code try { url = new JMXServiceURL(service:jmx:rmi:///jndi/rmi://localhost:18070/jmxrmi); jmxc = JMXConnectorFactory.connect(url,null); mbsc = jmxc.getMBeanServerConnection(); } catch (MalformedURLException e) { throw new Exception(methodName + : + e); } catch (IOException e) { throw new Exception(methodName + : + Failed to connect to the Tomcat Server + e); } It works fine if i set com.sun.management.jmxremote.authenticate=true to false. Other than that it just fails. The client tool is running on the same machine as the tomcat instance so there should not be any issues with the firewall. Any clues On Thu, Jan 13, 2011 at 1:20 PM, André Warnier a...@ice-sa.com wrote: Ziggy wrote: Tomcat JMX connection - Authentication failed. I am having some problems setting up Tomcat for JMX. I added the following properties to CATALINA_OPTS CATALINA_OPTS=-Dcom.sun.management.jmxremote.port=18070 -Dcom.sun.management.jmxremote.password.file=$CATALINA_BASE/conf/jmxremote.password -Dcom.sun .management.jmxremote.ssl=false And have added the jmxremote.password file in to the conf directory. I wrote a client tool that connects to the JMX server running on port 18070. When i run the client program i get the following error. Exception in thread main java.lang.SecurityException: Authentication failed! Credentials required at ... Ok, so how does your client provide a username and password to the server's JMX interface, when it connects ? If i change the CATALINA_OPTS properties to CATALINA_OPTS=-Dcom.sun.management.jmxremote.port=18070 -Dcom.sun.management.jmxremote.password.file=$CATALINA_BASE/conf/jmxremote.password -Dcom.sun .management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false Then it works fine. Of course, since then there is no authentication required. I think what i am confused of is what is classed as remote access. I am running the client program away from the Tomcat instance but both Tomcat and the client tool are on the same machine (i.e. different virtual machines but same environemnt). I thought i had to configure the remote authentication if i access the JMX server remotely from a different machine. By remote access do they mean accessing the JMX server from any VM either locally on the same machine or remotely from a different machine? I believe that in this context, remote just means via a TCP/IP connection. It does not matter if your client is on the same host or not. If it accesses the server via TCP/IP, then it counts as remote. There is another way to connect, limited to local processes running on the same host, but I forget how it is called or how it works. You can see the distinction pretty clearly by using the jconsole application, which is included in the JDK. Note : for the remote kind of access, there is another (second) TCP connection used, separate from the port which you indicate with the jmxremote.port parameter. If you are on the same host, it does not matter, but if you really need to connect from another host through a firewall or so, it may. You may want to have a look here for more info : http://download.oracle.com/javase/6/docs
Re: Tomcat JMX connection - Authentication failed.
Aha... i didnt realise that i needed to supply the credentials from the client. I thought Tomcat would get those from the password files. Ok im off to the documentation now. :) On Thu, Jan 13, 2011 at 1:31 PM, André Warnier a...@ice-sa.com wrote: Ok, what I was trying to say is this : By using the jmxremote.password.file etc.. on the JVM which runs Tomcat, you let this JVM know which remote user-id's can connect, and what password they should use. Now, from the client side, when you connect, you have to provide such a valid user-id and password, to login to the server. If you try the jconsole utility as a client, you will see this on the connection box. I have no idea how you supply these credentials programmatically from /your/ client, but that is what you have to find out. Ziggy wrote: Ok i am stuck now - here is the full configuration $CATALINA_BASE/setenv.sh --- CATALINA_OPTS=-Dcom.sun.management.jmxremote.port=18070 -Dcom.sun.management.jmxremote.password.file=$CATALINA_BASE/conf/jmxremote.password -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=true -Dcom.sun.management.jmxremote.access.file=$CATALINA_BASE/conf/jmxremote.access export CATALINA_OPTS $CATALINA_BASE/conf/jmxremote.password --- monitorRole monitorpass controlRole controlpass $CATALINA_BASE/conf/jmxremote.access --- monitorRole readonly controlRole readwrite The client tool i am using to access the Tomcat JMX server is running on the same machine as the Tomcat instance. when i start tomcat i can see that there is something listening at port 18070 but when i try to connect i get the following error Exception in thread main java.lang.SecurityException: Authentication failed! Credentials required at com.sun.jmx.remote.security.JMXPluggableAuthenticator.authenticationFailure(JMXPluggableAuthenticator.java:193) at com.sun.jmx.remote.security.JMXPluggableAuthenticator.authenticate(JMXPluggableAuthenticator.java:145) at sun.management.jmxremote.ConnectorBootstrap$AccessFileCheckerAuthenticator.authenticate(ConnectorBootstrap.java:185) at javax.management.remote.rmi.RMIServerImpl.doNewClient(RMIServerImpl.java:213) I connect using the following bit of code try { url = new JMXServiceURL(service:jmx:rmi:///jndi/rmi://localhost:18070/jmxrmi); jmxc = JMXConnectorFactory.connect(url,null); mbsc = jmxc.getMBeanServerConnection(); } catch (MalformedURLException e) { throw new Exception(methodName + : + e); } catch (IOException e) { throw new Exception(methodName + : + Failed to connect to the Tomcat Server + e); } It works fine if i set com.sun.management.jmxremote.authenticate=true to false. Other than that it just fails. The client tool is running on the same machine as the tomcat instance so there should not be any issues with the firewall. Any clues On Thu, Jan 13, 2011 at 1:20 PM, André Warnier a...@ice-sa.com wrote: Ziggy wrote: Tomcat JMX connection - Authentication failed. I am having some problems setting up Tomcat for JMX. I added the following properties to CATALINA_OPTS CATALINA_OPTS=-Dcom.sun.management.jmxremote.port=18070 -Dcom.sun.management.jmxremote.password.file=$CATALINA_BASE/conf/jmxremote.password -Dcom.sun .management.jmxremote.ssl=false And have added the jmxremote.password file in to the conf directory. I wrote a client tool that connects to the JMX server running on port 18070. When i run the client program i get the following error. Exception in thread main java.lang.SecurityException: Authentication failed! Credentials required at ... Ok, so how does your client provide a username and password to the server's JMX interface, when it connects ? If i change the CATALINA_OPTS properties to CATALINA_OPTS=-Dcom.sun.management.jmxremote.port=18070 -Dcom.sun.management.jmxremote.password.file=$CATALINA_BASE/conf/jmxremote.password -Dcom.sun .management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false Then it works fine. Of course, since then there is no authentication required. I think what i am confused of is what is classed as remote access. I am running the client program away from the Tomcat instance but both Tomcat and the client tool are on the same machine (i.e. different virtual machines but same environemnt). I thought i had to configure the remote authentication if i access the JMX server remotely from a different machine. By remote access do they mean accessing the JMX server from any VM either locally on the same machine or remotely from
Re: Tomcat JMX connection - Authentication failed.
Given that Jconsole can connect to the Tomcat JMX without any user credentials (locally), i am guessing that i dont need to supply these credentials but how do i connect to the JMX server without supplying the port number? (by specifying the port number it means i am allowing remote authentication meaning i have to provide the login credentials). On Thu, Jan 13, 2011 at 4:06 PM, Pid p...@pidster.com wrote: On 1/13/11 3:15 PM, Ziggy wrote: Aha... i didnt realise that i needed to supply the credentials from the client. I thought Tomcat would get those from the password files. Ok im off to the documentation now. :) It could do, but you'd have to point the client at those files and read their contents too. try { url = new JMXServiceURL(service:jmx:rmi:///jndi/rmi://localhost:18070/jmxrmi); jmxc = JMXConnectorFactory.connect(url,null); MapString, Object environment = new HashMapString, Object(); String[] pair = new String[] { username, password }; environment.put(JMXConnector.CREDENTIALS, pair); jmxc = JMXConnectorFactory.connect(url, environment); From my own efforts: https://github.com/pidster/Tomcat-CLI p mbsc = jmxc.getMBeanServerConnection(); } catch (MalformedURLException e) { throw new Exception(methodName + : + e); } catch (IOException e) { throw new Exception(methodName + : + Failed to connect to the Tomcat Server + e); }
Re: Accessing context information remotely - Context.getAvailable() etc.
Thanks for that - The client tool i am writing is running on the same machine as the application which is firewalled. There is no direct access to the webapp except via an AJP port which is only accessible via Apache Webserver. Thanks On Sat, Jan 8, 2011 at 4:07 PM, Konstantin Kolinko knst.koli...@gmail.comwrote: 2011/1/8 zigg...@gmail.com zigg...@gmail.com: Yes I guess you are right that launching the jmx every minute could be expensive resourcewise... i am wondering whether it will be less expensive if I just start a thread and same it up every minute... this way the jmx engine will only be started once... One more word of caution: JMX is effectively a low-level administrative interface. We compare it to the root access sometimes. There are little (or no) barriers from abusing it. Thus, if you allow external access through JMX, this access should be controlled and secured. (I am sure that that is written somewhere on how to do that. It is not a Tomcat-specific issue. Though I do not have a link ready.) Best regards, Konstantin Kolinko - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Accessing context information remotely - Context.getAvailable() etc.
Thanks. I think the Webmodule has something i could use. There is an Mbean in WebModule/Attributes/State. The value of the state attribute is 1. Presumabely this is the state of the context deployed? Where can i find the documentation of the different states the web module can be? Thanks On Fri, Jan 7, 2011 at 12:43 AM, Pid p...@pidster.com wrote: On 1/6/11 7:33 PM, Ziggy wrote: I have gone through all the mbeans by using Jconsole but i cant find the one i need that tells me that the application is active and running. You want Catalina:type=WebModule or Catalina:type=Manager depending on what your requirements are. I'm pretty sure I've posted this once already today, you might consider reading the other JMX thread. p
Re: Accessing context information remotely - Context.getAvailable() etc.
Yes i saw this earlier and would have been very usefull if i could have used it. Unfortunately we dont deploy the manager or admin apps on the production environments. These are only available on development and Test servers. Thanks On Fri, Jan 7, 2011 at 11:42 AM, Rainer Jung rainer.j...@kippdata.dewrote: On 06.01.2011 21:22, Ziggy wrote: Please see my previous response re: open source tools. :) As i mentioned earlier, the project that i need to deploy this tool will not allow any open source tool without it being approved which involves a long security vetting process. I appreciate that there are hundreds of tools out there that can do exactly what i am trying to do but sometimes there are reasons that those tools cannot be used due to the nature of some projects. Using JMX as a protocol to remotely collect the info comes with the downside of starting a full JMX each time your cron job fires. There is a feature builtin into the Tomcat manager called jmxproxy. Via the jmxproxy you can query MBeans by HTTP and get back an easy to parse textual represenation of the attributes. That way you only need an HTTP client and parse a bit of text. It allows you to choose whatever client technology you like best. You can even configure a separate HTTP connector for administration and monitoring purposes, so that it will always be available independent of the load of the normal production connector. See: http://tomcat.apache.org/tomcat-6.0-doc/manager-howto.html#Using_the_JMX_Proxy_Servlet Regards, Rainer - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Accessing context information remotely - Context.getAvailable() etc.
Hi, Will a full JMX be started on the Tomcat JVM or on the JVM in which i am running the process to connect to the Tomcat instance? presumably if it is the latter then it will shutdown once the client tool completes? The tool should only take a few seconds to run on each iteration. Thanks On Fri, Jan 7, 2011 at 11:50 AM, Ziggy zigg...@gmail.com wrote: Yes i saw this earlier and would have been very usefull if i could have used it. Unfortunately we dont deploy the manager or admin apps on the production environments. These are only available on development and Test servers. Thanks On Fri, Jan 7, 2011 at 11:42 AM, Rainer Jung rainer.j...@kippdata.dewrote: On 06.01.2011 21:22, Ziggy wrote: Please see my previous response re: open source tools. :) As i mentioned earlier, the project that i need to deploy this tool will not allow any open source tool without it being approved which involves a long security vetting process. I appreciate that there are hundreds of tools out there that can do exactly what i am trying to do but sometimes there are reasons that those tools cannot be used due to the nature of some projects. Using JMX as a protocol to remotely collect the info comes with the downside of starting a full JMX each time your cron job fires. There is a feature builtin into the Tomcat manager called jmxproxy. Via the jmxproxy you can query MBeans by HTTP and get back an easy to parse textual represenation of the attributes. That way you only need an HTTP client and parse a bit of text. It allows you to choose whatever client technology you like best. You can even configure a separate HTTP connector for administration and monitoring purposes, so that it will always be available independent of the load of the normal production connector. See: http://tomcat.apache.org/tomcat-6.0-doc/manager-howto.html#Using_the_JMX_Proxy_Servlet Regards, Rainer - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Tomcat monitoring using JMX
Hi, I am using JMX to connect to a Tomcat instance and looking at attributes for a jdbc datasource as shown below. MBeanServerConnection conn = jmxc.getMBeanServerConnection(); ObjectName on = new ObjectName(Catalina:type=DataSource,path=/appdb,host=localhost,class=javax.sql.DataSource,name=\jdbc/appdb\); mbsc.getAttribute(on, numIdle) Is there an Mbean provided by Tomcat that can provide me the following information - Whether Tomcat is running - Whether a specific web app running under a specific context is runnin - The health of the environment in general (tomcat, OS etc) - Whether a JNDI datasource is available and if possible how many active database connections there are and how many free. I have been google'ing around but the majority of the examples talk about writing your own Mbean and including it as part of the application. I am trying to write an external client utility that will monitor the application away from Tomcat. Thanks
Accessing context information remotely - Context.getAvailable() etc.
I was looking at the code for the Tomcat Manager application to try and find out how it is determining whether a webapp/context is running and how many sesions are active. Looking at the code i think it uses these two methods Context.getAvailalbe() //check if available Context.getManager().findSessions().length // Number of sessions. Here is the relevant function protected void list(PrintWriter writer) { if (debug = 1) log(list: Listing contexts for virtual host ' + host.getName() + '); writer.println(sm.getString(managerServlet.listed, host.getName())); Container[] contexts = host.findChildren(); for (int i = 0; i contexts.length; i++) { Context context = (Context) contexts[i]; String displayPath = context.getPath(); if( displayPath.equals() ) displayPath = /; if (context != null ) { if (context.getAvailable()) { writer.println(sm.getString(managerServlet.listitem, displayPath, running, + context.getManager().findSessions().length, context.getDocBase())); } else { writer.println(sm.getString(managerServlet.listitem, displayPath, stopped, 0, context.getDocBase())); } } } } I was looking at the above for the above information as i am working on a client tool that tries to find out this exact information. The tool i am using connects to Tomcat via JMX but i am not sure if i can get the same information via JMX. Can i access the Context class? or is there any other way (Mbeans?) i can check if a context is running via JMX?
Re: Accessing context information remotely - Context.getAvailable() etc.
Hi, Thanks for your response. I am aware of the activeSessions attribute under Catalina:type=Manager,path=/testapp,host=localhost. I am actually doing this programmatically and would like to know of an Mbean that would tell me if the application is available. The activeSessions attribute can sometimes report 0 even when the application is available so it is not reliable. Thanks On Thu, Jan 6, 2011 at 6:29 PM, Pid p...@pidster.com wrote: On 1/6/11 6:07 PM, Ziggy wrote: I was looking at the code for the Tomcat Manager application to try and find out how it is determining whether a webapp/context is running and how many sesions are active. Looking at the code i think it uses these two methods Context.getAvailalbe() //check if available Context.getManager().findSessions().length // Number of sessions. Here is the relevant function protected void list(PrintWriter writer) { if (debug = 1) log(list: Listing contexts for virtual host ' + host.getName() + '); writer.println(sm.getString(managerServlet.listed, host.getName())); Container[] contexts = host.findChildren(); for (int i = 0; i contexts.length; i++) { Context context = (Context) contexts[i]; String displayPath = context.getPath(); if( displayPath.equals() ) displayPath = /; if (context != null ) { if (context.getAvailable()) { writer.println(sm.getString(managerServlet.listitem, displayPath, running, + context.getManager().findSessions().length, context.getDocBase())); } else { writer.println(sm.getString(managerServlet.listitem, displayPath, stopped, 0, context.getDocBase())); } } } } I was looking at the above for the above information as i am working on a client tool that tries to find out this exact information. The tool i am using connects to Tomcat via JMX but i am not sure if i can get the same information via JMX. Can i access the Context class? or is there any other way (Mbeans?) i can check if a context is running via JMX? Connect to a Tomcat instance using JConsole and look for the 'Manager' objects. Catalina:type=Manager,path=/app01,host=localhost There's an attribute 'activeSessions'. p
Re: Accessing context information remotely - Context.getAvailable() etc.
Well it is a little complicated but the main reasons are - The majority of the tools i have looked at require that the tool run inside Tomcat which is where my application will also be running. This is a problem because if Tomcat itself is not available then i cant monitor anything - It will be quicker for me to produce something quicker myself than it will be to convince my boss to authorise an open source tool for a project that is not supposed to be accessed by external users. Thanks On Thu, Jan 6, 2011 at 6:58 PM, Kees Jan Koster kjkos...@gmail.com wrote: Dear Ziggy, I was looking at the above for the above information as i am working on a client tool that tries to find out this exact information. The tool i am using connects to Tomcat via JMX but i am not sure if i can get the same information via JMX. Can i access the Context class? or is there any other way (Mbeans?) i can check if a context is running via JMX? You can get the same information using JMX. That's how Java-monitor.com does it. :) Why are you making a tool to get this information? There are loads of tools out there. -- Kees Jan http://java-monitor.com/ kjkos...@kjkoster.org 06-51838192 Change is good. Granted, it is good in retrospect, but change is good. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Accessing context information remotely - Context.getAvailable() etc.
Thanks for the response. I am writing an external java application that reads this values periodically. This will be launched from a unix cron job. Its just a simple tools that periodically checks that the application is available. I have gone through all the mbeans by using Jconsole but i cant find the one i need that tells me that the application is active and running. I do use Jconsole and jVisualvm and also LamdaProbe but all these require someone to physically log on to look at anything. The tool i am writing will do this automatically and generate an alert if necessary. I just need to know which Mbean to look at. I have found the Datasource ones but not the ones related to the webapplication itsself. Thanks On Thu, Jan 6, 2011 at 7:28 PM, Mark Eggers its_toas...@yahoo.com wrote: - Original Message (edited) From: Ziggy zigg...@gmail.com To: Tomcat Users List users@tomcat.apache.org Sent: Thu, January 6, 2011 10:48:32 AM Subject: Re: Accessing context information remotely - Context.getAvailable() etc. Hi, Thanks for your response. I am aware of the activeSessions attribute under Catalina:type=Manager,path=/testapp,host=localhost. I am actually doing this programmatically and would like to know of an Mbean that would tell me if the application is available. The activeSessions attribute can sometimes report 0 even when the application is available so it is not reliable. Thanks On Thu, Jan 6, 2011 at 6:29 PM, Pid p...@pidster.com wrote: On 1/6/11 6:07 PM, Ziggy wrote: I was looking at the code for the Tomcat Manager application to try and find out how it is determining whether a webapp/context is running and how many sesions are active. Looking at the code i think it uses these two methods Connect to a Tomcat instance using JConsole and look for the 'Manager' objects. Catalina:type=Manager,path=/app01,host=localhost There's an attribute 'activeSessions'. p - Original Message (edited) Check the attribute stateName. It's STOPPED for an application stopped by the manager program, and STARTED for an application started by the manager program. VisualVM, JConsole, and MC4J don't require separate Tomcat instrumentation. . . . just my two cents. /mde/ - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Accessing context information remotely - Context.getAvailable() etc.
Please see my previous response re: open source tools. :) As i mentioned earlier, the project that i need to deploy this tool will not allow any open source tool without it being approved which involves a long security vetting process. I appreciate that there are hundreds of tools out there that can do exactly what i am trying to do but sometimes there are reasons that those tools cannot be used due to the nature of some projects. On Thu, Jan 6, 2011 at 8:03 PM, Mark Eggers its_toas...@yahoo.com wrote: - Original Message (edited) From: Ziggy zigg...@gmail.com To: Tomcat Users List users@tomcat.apache.org Sent: Thu, January 6, 2011 11:33:07 AM Subject: Re: Accessing context information remotely - Context.getAvailable() etc. Thanks for the response. I am writing an external java application that reads this values periodically. This will be launched from a unix cron job. Its just a simple tools that periodically checks that the application is available. I have gone through all the mbeans by using Jconsole but i cant find the one i need that tells me that the application is active and running. I do use Jconsole and jVisualvm and also LamdaProbe but all these require someone to physically log on to look at anything. The tool i am writing will do this automatically and generate an alert if necessary. I just need to know which Mbean to look at. I have found the Datasource ones but not the ones related to the webapplication itsself. Thanks - Original Message (edited) A quick google turns up at least two command line JMX clients: http://www.cyclopsgroup.org/projects/jmxterm/ http://www.jmanage.org/ However the jManage tool requires that you have jManage running on the target server. I've not used either, so your mileage may vary. . . . . just my two cents. /mde/ - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
setenv.sh in an individual tomcat catalina base
Hi guys, At the moment i have several catalina bases configured with the following directories, conf logs server webapps work The bin, lib and common directories are all still in $CATALINA_HOME. I now need to add a setenv.sh file in the bin directory but i dont want it to be used by all the catalina bases. I only want 2 out of the 4 catalina bases to use the setenv.sh file. To do this i am thinking of adding a bin directory on the catalina_base/bin that i want to pick up the setenv.sh file. The bin directory will only contain the setenv.sh file and nothing else. Everything else will still be in $CATALINA_HOME/bin/ (ie. startup.sh catalina.sh shutdown.sh etc). This means that some catalina bases will have /bin directories and some wont. Are there any side effects to doing this? Can tomcat use both $CATALINA_BASE/bin/ and $CATALINA_HOME/bin during startup?
Re: setenv.sh in an individual tomcat catalina base
I am using Tomcat v5.5 Do you mean that for newer versions of Tomcat, if i want to move some of the scripts from $CATALINA_HOME/bin to $CATALINA_BASE/bin i will not be able to? Thanks On Tue, Nov 9, 2010 at 1:38 PM, Konstantin Kolinko knst.koli...@gmail.comwrote: 2010/11/9 Ziggy zigg...@gmail.com: Are there any side effects to doing this? Can tomcat use both $CATALINA_BASE/bin/ and $CATALINA_HOME/bin during startup? From catalina.sh: if [ -r $CATALINA_BASE/bin/setenv.sh ]; then . $CATALINA_BASE/bin/setenv.sh elif [ -r $CATALINA_HOME/bin/setenv.sh ]; then . $CATALINA_HOME/bin/setenv.sh fi i.e. it takes setenv.sh from $CATALINA_BASE if it exists, otherwise from $CATALINA_HOME. All the other script files are supposed to remain in $CATALINA_HOME/bin. I am talking about the latest version of those scripts. I do not know how old your Tomcat version is. You may look at your catalina.sh for yourself. Best regards, Konstantin Kolinko - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Shutting down one instance of tomcat 6 from a listener
Hi Patrick, When you say multiple instances it could mean one of two things - Running multiple instances of Tomcat using multiple CATALINA_BASES - Running the same instance of Tomcat but with multiple virtual hosts Do you mean that you are deploying different applications (i.e different war files) on the same tomcat installation? On Tue, Nov 9, 2010 at 4:36 PM, Patrick Sauts patrick.via...@gmail.comwrote: I'm sorry I'm French. Multiple cores, maybe? As when you use the manager to deploy different web applications, several war. -Original Message- From: Caldarale, Charles R [mailto:chuck.caldar...@unisys.com] Sent: mardi 9 novembre 2010 14:44 To: Tomcat Users List Subject: RE: Shutting down one instance of tomcat 6 from a listener From: Patrick Sauts [mailto:patrick.via...@gmail.com] Subject: Shutting down one instance of tomcat 6 from a listener I'm working with tomcat 6 and multiples instances; The question André was trying to get you to answer is: what do you mean by instance? Multiple instances of what? That's a rather ambiguous term you used. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Shutting down one instance of tomcat 6 from a listener
If you are refering to wanting to undeploy a specific application from the same instance (installation) of tomcat then there are several ways - Using Tomcat Manager - You can write an Ant script to undeploy the application On Tue, Nov 9, 2010 at 5:22 PM, Ziggy zigg...@gmail.com wrote: Hi Patrick, When you say multiple instances it could mean one of two things - Running multiple instances of Tomcat using multiple CATALINA_BASES - Running the same instance of Tomcat but with multiple virtual hosts Do you mean that you are deploying different applications (i.e different war files) on the same tomcat installation? On Tue, Nov 9, 2010 at 4:36 PM, Patrick Sauts patrick.via...@gmail.comwrote: I'm sorry I'm French. Multiple cores, maybe? As when you use the manager to deploy different web applications, several war. -Original Message- From: Caldarale, Charles R [mailto:chuck.caldar...@unisys.com] Sent: mardi 9 novembre 2010 14:44 To: Tomcat Users List Subject: RE: Shutting down one instance of tomcat 6 from a listener From: Patrick Sauts [mailto:patrick.via...@gmail.com] Subject: Shutting down one instance of tomcat 6 from a listener I'm working with tomcat 6 and multiples instances; The question André was trying to get you to answer is: what do you mean by instance? Multiple instances of what? That's a rather ambiguous term you used. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: setenv.sh in an individual tomcat catalina base
Hi Andre, I am using a standard Tomcat installation downloaded from tomcat.apache.org. I am confused as to how you determined that am using a packaged version of Tomcat :) -- D On Tue, Nov 9, 2010 at 3:55 PM, André Warnier a...@ice-sa.com wrote: Hi. As I recall, you are using a packaged version of Tomcat (meaning not the original one from the tomcat website download, but one already packaged by the people who do such things for your OS version). You should then look carefully at what scripts are used to start/stop Tomcat on your particular system (starting with /etc/init.d/tomcat e.g.), what they invoke and when, to determine what you can put into CATALINA_HOME/x and CATALINA_BASE/y. For example, these packages often use a file /etc/default/tomcat that sets some environment values, which are later used to determine what other scripts do. What Konstantin indicates below is based on the standard catalina.sh as provided in the standard Tomcat download, but there is no guarantee that this script has not been modified (or is even used) in your particular package. Ziggy wrote: I am using Tomcat v5.5 Do you mean that for newer versions of Tomcat, if i want to move some of the scripts from $CATALINA_HOME/bin to $CATALINA_BASE/bin i will not be able to? Thanks On Tue, Nov 9, 2010 at 1:38 PM, Konstantin Kolinko knst.koli...@gmail.comwrote: 2010/11/9 Ziggy zigg...@gmail.com: Are there any side effects to doing this? Can tomcat use both $CATALINA_BASE/bin/ and $CATALINA_HOME/bin during startup? From catalina.sh: if [ -r $CATALINA_BASE/bin/setenv.sh ]; then . $CATALINA_BASE/bin/setenv.sh elif [ -r $CATALINA_HOME/bin/setenv.sh ]; then . $CATALINA_HOME/bin/setenv.sh fi i.e. it takes setenv.sh from $CATALINA_BASE if it exists, otherwise from $CATALINA_HOME. All the other script files are supposed to remain in $CATALINA_HOME/bin. I am talking about the latest version of those scripts. I do not know how old your Tomcat version is. You may look at your catalina.sh for yourself. Best regards, Konstantin Kolinko - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Malicious host is crashing my server
That number is not necessarily the IP address used to connect to your server. On Sun, Nov 7, 2010 at 6:28 PM, Assaf ass...@yahoo.com wrote: A filter to block is good. But then I would not be able to see him doing it again and then find out the issue. Assaf - Original Message From: Caldarale, Charles R chuck.caldar...@unisys.com To: Tomcat Users List users@tomcat.apache.org Sent: Sun, November 7, 2010 6:48:20 PM Subject: RE: Malicious host is crashing my server From: Assaf [mailto:ass...@yahoo.com] Subject: Malicious host is crashing my server what can I do to better protect? As a temporary preventive measure, you can disable access from this particular IP address by configuring the RemoteAddrValve in server.xml: Valve className=org.apache.catalina.valves.RemoteAddrValve deny=79\.177\.23\.102/ That should give you some time to work out the real fix. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Connection Leak
Hi All, Resource name=myConn auth=Container type=javax.sql.DataSource driverClassName=oracle.jdbc.driver.OracleDriver url=jdbc:oracle:thin:@10.10.10.10.:1521:mydb username=username password=password maxActive=500 maxIdle=50 maxWait=-1 removeAbandoned=true removeAbandonedTimeout=60 logAbandoned=true accessToUnderlyingConnectionAllowed=true / I am trying to find out areas of the application where connections are NOT being closed. I added the removeAbandoned and logAbandoned clauses in my context file but if i check v$session on oracle it is still showing the same number of connections active even after 60 seconds. Is there something wrong in the configuration above? How exactly does it abandone the connections? what triggers it?
Re: Connection Leak
Does that show cached queries? On Wed, Nov 3, 2010 at 4:02 PM, Propes, Barry L barry.l.pro...@citi.comwrote: Maybe try adding this, too as an attribute in the Resource tag. timeBetweenEvictionRunsMillis=-1 -Original Message- From: Jason Britton [mailto:jbritto...@gmail.com] Sent: Wednesday, November 03, 2010 9:05 AM To: Tomcat Users List Subject: Re: Connection Leak Since you're using an Oracle database - another way to identify areas in your code that aren't closing connections. In the sql below substitute YOURDBUSER with the name of the database user your connections connect to your database with and YOURWEBSERVER with the name of your webserver. The results of the sql query will give you the last executed sql for each of the open connections. Then search your code for where this sql is being executed and double check you are closing the connection appropriately. SELECT username, machine, oc.sql_text, COUNT(*) open_statements FROM v$session vs, v$open_cursor oc WHERE username = 'YOURDBUSER' AND machine = 'YOURWEBSERVER' AND oc.sid = vs.sid GROUP BY username, machine, oc.sql_text ORDER BY open_statements DESC On Wed, Nov 3, 2010 at 6:44 AM, Ziggy zigg...@gmail.com wrote: Hi All, Resource name=myConn auth=Container type=javax.sql.DataSource driverClassName=oracle.jdbc.driver.OracleDriver url=jdbc:oracle:thin:@10.10.10.10.:1521:mydb username=username password=password maxActive=500 maxIdle=50 maxWait=-1 removeAbandoned=true removeAbandonedTimeout=60 logAbandoned=true accessToUnderlyingConnectionAllowed=true / I am trying to find out areas of the application where connections are NOT being closed. I added the removeAbandoned and logAbandoned clauses in my context file but if i check v$session on oracle it is still showing the same number of connections active even after 60 seconds. Is there something wrong in the configuration above? How exactly does it abandone the connections? what triggers it? - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: tomcat 6.0 404 error only on firefox due to backslashes?
For security purposes, Mozilla applications block links to local files (and directories) from remote files. This includes linking to files on your hard drive, on mapped network drives, and accessible via Uniform Naming Conventionhttp://en.wikipedia.org/wiki/Path_%28computing%29#Uniform_Naming_Convention(UNC) paths. This *prevents* a number of unpleasant possibilities, including: - Allowing sites to detect your operating system by checking default installation paths - Allowing sites to exploit system vulnerabilities (e.g., C:\con\con in Windows 95/98) - Allowing sites to detect browser preferences or read sensitive data See here for more info http://kb.mozillazine.org/Links_to_local_pages_don%27t_work -- Dini On Thu, Jun 10, 2010 at 5:18 PM, André Warnier a...@ice-sa.com wrote: mamalacation wrote: Pid * wrote: Why not just fix the URLs? p I am not sure what you mean by saying fix the URLs, but in the meantime I found out how to set the option org.apache.catalina.connector. CoyoteAdapter.ALLOW_BACKSLASH=true in conf/catalina.properties, so now it almost works! It starts downloading the file, but the filename to be saved is path\to\file.ext instead of file.ext. Does anybody know how this can be fixed? No. But before you find a solution and create a big security issue, I suggest that from now on you check this with different browsers, and particularly different IE versions. I think that the fix you found is really a kludge, in that it kind of works by making some pieces of software believe that this is an acceptable file name, while other pieces may see this as a file path. But it seems *really* dangerous to me. As pid indicated, you should fix the problem, not the symptom. Or you will end up sorry, I am quite certain. Fixing the URLs in this case means to replace the %5C's (escaped \) by escaped / characters, before you send the links to the browser. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Multiple catalina bases and monitoring each instance
Hi guys, Is there a way to monitor multiple tomcat instances? I have managed to configure multiple tomcat instances using $CATALINA_BASE but i cant seem to be able to find a way to monitor the instances. I know about the tomcat manager, admin and the Tomcat Probe/lambda applications. These will all only monitor a single instance of a running tomcat. Is there a way i can monitor all running instances from one tomcat instance? Thanks
Re: Multiple catalina bases and monitoring each instance
Hi, I was refering to monitoring things like database connections, active threads or sessions etc. Thanks On Fri, Apr 23, 2010 at 11:50 AM, Harry Metske harry.met...@gmail.comwrote: It depends on what you mean with monitor. We use nagios (http://www.nagios.org) to monitor multiple Tomcat instances. You can do a plain check for an open socket, or call Tomcat's jmx proxy over http(s) to query Tomcat's mbeans. regards, Harry 2010/4/23 Ziggy zigg...@gmail.com Hi guys, Is there a way to monitor multiple tomcat instances? I have managed to configure multiple tomcat instances using $CATALINA_BASE but i cant seem to be able to find a way to monitor the instances. I know about the tomcat manager, admin and the Tomcat Probe/lambda applications. These will all only monitor a single instance of a running tomcat. Is there a way i can monitor all running instances from one tomcat instance? Thanks
Re: Recommendations for Automating Deployments and then dev, qa, uat, prod testing
Continous Integration sounds like a better solution for you. Your apps will be built and tested as soon as the developer checks in their code in SVN. Have a look at http://cruisecontrol.sourceforge.net Using CruiseControl will ensure that the developers wont check-in anything with errors on it. -- D On Sun, Jan 24, 2010 at 5:22 PM, Fletcher Cocquyt fcocq...@stanford.eduwrote: Fletcher Cocquyt fcocquyt at stanford.edu writes: Hi, this question is coming from the operations team perspective. Currently our (small 3 member) ops team is responsible for deploying java apps weekly from a set of dozens in a less than great 4am-6am window on Wednesdays. ..snip.. So questions about the things maven seems to address: testing: unit, integration testing - article mentions selenium? sensitive data: database passwords (can these be securely handled in maven?) Additional, medium-long term goals: Standardize the development environment and processes. Leverage the virtual infrastructure we have built with vmware: have the developers use standard VM images from templates (ensure consistent JDK, libs etc), integrate with lab manager/vApp/VMware Studio concepts. thanks for the feedback recommendations In fact we already have one keen developer using Maven, and another using CI (hudson) - On the medium/long term goal I would like to see us one day deploying to private cloud via VMWare's vCloud API http://communities.vmware.com/community/developer/forums/vcloudapi or the like. Some interesting activity in this area: http://code.google.com/p/jclouds/wiki/QuickStartTerremark Looks like a fun integration project to marry all these together! thanks, Fletch. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Getting 403 (Access Denied) when running Tomcat under Eclipse
Doesnt eclipse use use a $CATALINA_BASE to run tomcat? I think the tomcat instance on eclipse is not the same as the one on $CATALINA_HOME. Look at the server project files under eclipse they will have their own configuration files. On Mon, Jan 18, 2010 at 10:43 PM, oh...@cox.net wrote: Hi, I have a web application that works when run directly under Tomcat. This web app has the following in web.xml: security-constraint web-resource-collection web-resource-nametestweb/web-resource-name description accessible by authenticated users of the tomcat role/description url-pattern/*/url-pattern http-methodGET/http-method http-methodPOST/http-method http-methodPUT/http-method http-methodDELETE/http-method /web-resource-collection auth-constraint descriptionThese roles are allowed access/description role-nameluceneuser/role-name /auth-constraint /security-constraint login-config auth-methodBASIC/auth-method realm-nameSearch/realm-name /login-config security-role descriptionOnly 'tomcat' role is allowed to access this web application/description role-nametestuser/role-name /security-role However, when I run the webapp under Eclipse (i.e., do a Run on server), and attempt to login as the same user, with the same password, I get a 403 (Access denied) error. If I remove the constraint, it then works under Tomcat and Eclipse I've checked the Tomcat logs, and I don't see any info there. Can anyone tell me why this is happening?? Thanks, Jim P.S. Tomcat version is 5.5.2.8, under Windows. Eclipse is latest Galileo. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Can't log in to Tomcat
It is possible to run multiple instances of Tomcat. When you run it within Netbeans, the instance you are running is not the instance in your $CATALINA_HOME. This is why when you made changes to the $CATALINA_HOME/conf/tomcat-users.xml file nothing happened. It just means that netbeans runs its own instance which will include its own configuration files. On Sun, Jan 17, 2010 at 10:48 AM, Pid p...@pidster.com wrote: On 16/01/2010 18:05, DarkMatter2009 wrote: I forgot to mention that it was installed with netbeans 6.8. I've just now used the password and username found in the netbeans ide under the servers section. Could someone possibly explain why tomcat isn't using the settings in conf so that I can understand in the future? :) You'd have to see how NetBeans is starting it to work that out. p DarkMatter2009 wrote: Hello all, I'm running apache tomcat 6.0.20 on my ubuntu computer. I've changed the entire contents of the tomcat-users.xml found in conf to:- tomcat-users role rolename=manager/ user username=tomcat password=s3cret roles=manager/ /tomcat-users Tried restarting tomcat and even restarting the machine, how ever I still cannot log in. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat access is very slow
Is it slow when you try to access it directly using the IP address? On Fri, Jan 15, 2010 at 7:54 PM, Christopher Schultz ch...@christopherschultz.net wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Yu, On 1/15/2010 11:28 AM, Yu Chao wrote: I’m not a very new to Tomcat \with a few projects experience. I got a new note book, everything is very fast except tomcat access. Where is Tomcat running? On your notebook, or on another server? I run a new project in my new tomcat(5.5.28 with no other project in webapp), I need about 2-5 minutes to open a page. Perhaps a DNS lookup is stalling? Details about your setup would be very helpful. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAktQx+EACgkQ9CaO5/Lv0PCh9wCgpahPcEWTdmJrFGQME+iwLfb3 YysAniZoma4EdKR/TkIc3+4EGNj9+LCd =2Ntb -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: java shutdown hook and classpath
Usually when i get these kind of problems i try and put the jar files in the tomcat common/lib folder to rule out class loader issues. Try and put the libraries there as all jar files in that folder will be picked up. On Thu, Jan 7, 2010 at 1:16 PM, David Wood daw...@us.ibm.com wrote: Hi and Happy New Year! I have a library that uses JDBC and is being used within a my web app. The library and JDBC driver jars are in the web app's WEB-INF/lib directory. The library installs a Java shutdown hook, which ultimately uses the JDBC driver to do some clean ups in the database. I'm getting a class not found error when trying to load the JDBC driver (in this case derby) in the hook. I suspect this is because the shutdown hook has been called with a class loader that does not have access to WEB-INF/lib. Any thoughts or solutions? Thanks. David Wood Policy Technologies Group IBM TJ Watson Research Center daw...@us.ibm.com 914-784-5123 (office), 914-396-6515 (mobile)
Re: How to change effective user id on Windows
Look at http://tomcat.apache.org/tomcat-5.5-doc/windows-service-howto.htmland see the --user parameter under command line parameters. -- D On Thu, Jan 7, 2010 at 2:07 PM, Amit Agarwal ami@gmail.com wrote: Tomat on Linux starts as root to bind to port 80, and then switches effective user id to nobody. Windows does not appear to have concept of changing effective user. Tomcat service runs as a local system on Windows. Need to change the user for Tomcat after binding to port 80. How can this be achieved? -- Sent from Karnataka, India
Re: Location of properties file for web app in Tomcat
I had the same problem before. I didnt want to configure the location of the properties file at the tomcat instance level since i had more than one war file. What i ended up doing is add the properties file configuration on the application's context file. This meant each war file can point to its own properties file. Here is what i do. I add the following line in my META-INF/context.xml file. (The path can be anywhere on the system) Environment name=APP_PROPERTIES description=The APP Properties File override=false type=java.lang.String value=/u/misc/web/conf/app.properties / Then in my code i just access the path using the following code System.getenv(APP_PROPERTIES); Note: On a windows environment just change the path to the windows equivalent Thanks HTH On Wed, Nov 18, 2009 at 2:20 PM, hbhartee himanshubhar...@yahoo.co.ukwrote: Hi, There is a simple way of using properties file across different web applications in Tomcat. Jar the properties file (included in package folders) and drop it in jakarta-tomcat/common/lib directory If you do not want to jar, just drop the properties file (included in relevant package structure folders) to jakarta-tomcat/common/classes The properties file would be available to all web applications after Tomcat is restarted. R, -- View this message in context: http://old.nabble.com/Location-of-properties-file-for-web-app-in-Tomcat-tp21767095p26408179.html Sent from the Tomcat - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Multiple war files for the same application context.
Lol that was just an example. There are thousands of jsps and servlets. With regards to the path, i am using struts and tiles so the directories are not really part of the path to the resource via the browser. That path will be configured in the tiles and struts configuration. I am trying this foo#bar.war approach and see how it will work. Thanks On Tue, Nov 17, 2009 at 3:47 PM, Caldarale, Charles R chuck.caldar...@unisys.com wrote: From: Ziggy [mailto:zigg...@gmail.com] Subject: Re: Multiple war files for the same application context. That is interesting. Is the # supposed to be part of the filename? Read the doc: http://tomcat.apache.org/tomcat-6.0-doc/config/host.html#Automatic%20Application%20Deployment - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Deployment specific configuration - best practice
Why do you need to provide a sample webapp? Usually if you post your database configuration, the exception that you are getting and the code where the exception is raised people should be able to figure out why there is a problem. :) On Mon, Nov 16, 2009 at 11:28 AM, Leon Rosenberg rosenberg.l...@googlemail.com wrote: On Mon, Nov 16, 2009 at 9:26 AM, Rainer Frey rainer.f...@inxmail.de wrote: Hi, I'm preparing a sample webapp for this list to illustrate a problem that I have with JDBC driver loading in a servlet. Anyone who'd try this would need to edit the jdbc connection data to test with a local DB. What is the easiest method for you to configure a webapp that I'll provide? * settings as init params in web.xml * settings in /META-INF/context.xml (both ways you'd need to upack, edit, repack and deploy) * a separate context file along with the war file * any other idea? It may be an overkill for this concrete scenario, but take a look at ConfigureMe configuration framework: https://configureme.dev.java.net in particular: http://infra.anotheria.net/confluence/display/CONFIGUREME/GettingStarted regards Leon Rainer - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Multiple war files for the same application context.
Hi guys, Is it possible to deploy multiple war files for the same application? for example if i have an application that is accessed via http:/// www.test.com/myapp, i would usually have a single war file called myapp.war and deploy everthing in that one file. is it possible to deploy myapp1ArticleManager.war, myapp1Forum.war etc and have them all be as part of the one myapp application? Any links or tutorials on how to do this would be very helpfull. And what is the term used for this kind of deployment? Thanks
Re: Multiple war files for the same application context.
Hi Hassan, I was recently looking at a CMS portal and found that the portal allowed plugins/application to be deployed as war files. The plugins themselves are portlets so not quite the type of application i am using. Is it the case that maybe it is possible with portlets but not standard servlet based webapps? Thanks On Mon, Nov 16, 2009 at 6:39 PM, Hassan Schroeder hassan.schroe...@gmail.com wrote: On Mon, Nov 16, 2009 at 10:34 AM, Ziggy zigg...@gmail.com wrote: is it possible to deploy myapp1ArticleManager.war, myapp1Forum.war etc and have them all be as part of the one myapp application? ... And what is the term used for this kind of deployment? impossible HTH! -- Hassan Schroeder hassan.schroe...@gmail.com twitter: @hassan - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Multiple war files for the same application context.
Are you trying to deploy elements of a larger applications separately? Yes that is exactly what i am trying to do. I did consider the separate jar file option but i couldnt figure out a way of including the jsp files in a jar file. I basically have a large struts/Tiles based application and would like to separate the deployment of each individual module of the application. I want to try and avoid having to redeploy the whole application everytime there is a change. On Mon, Nov 16, 2009 at 7:10 PM, Joseph Morgan joseph.mor...@ignitesales.com wrote: Are you trying to deploy elements of a larger applications separately? It seems you just need different JAR files for the application, and, though those can be deployed to the same web app separately, you're not really gaining anything, since the app will have to be restarted anyway, and you might as well stick with the WAR file. Joe -Original Message- From: Ziggy [mailto:zigg...@gmail.com] Sent: Monday, November 16, 2009 12:35 PM To: Tomcat Users List Subject: Multiple war files for the same application context. Hi guys, Is it possible to deploy multiple war files for the same application? for example if i have an application that is accessed via http:/// www.test.com/myapp, i would usually have a single war file called myapp.war and deploy everthing in that one file. is it possible to deploy myapp1ArticleManager.war, myapp1Forum.war etc and have them all be as part of the one myapp application? Any links or tutorials on how to do this would be very helpfull. And what is the term used for this kind of deployment? Thanks - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Multiple war files for the same application context.
I see what you mean Hassan. I had a look at how the core portal engine accesses the portlets and it looks like it uses the plugins context to access it and this is just hidden from the user. thanks On Mon, Nov 16, 2009 at 7:11 PM, Hassan Schroeder hassan.schroe...@gmail.com wrote: On Mon, Nov 16, 2009 at 10:51 AM, Ziggy zigg...@gmail.com wrote: I was recently looking at a CMS portal and found that the portal allowed plugins/application to be deployed as war files. The plugins themselves are portlets so not quite the type of application i am using. Is it the case that maybe it is possible with portlets but not standard servlet based webapps? Sure, the whole point of a portal is to integrate non-related apps and data sources. So you access the portal context which basically proxies in the output of those plugins. You could certainly integrate the output of other contexts into your primary one, using iframes, AJAX widgets, backend web services, etc. but ultimately they're still separate contexts. -- Hassan Schroeder hassan.schroe...@gmail.com twitter: @hassan - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Deployment of war file into a common locatiion
What exactly is the reason your team cannot access the application? It doesnt sound like its a Tomcat issue but probably something related to your network settings. Maybe the firewall? How are they accessing your system? On Mon, Nov 16, 2009 at 3:40 PM, Neil Aggarwal n...@jammconsulting.comwrote: Ajay: I don't think that would be a solution because that application is fetching some values from database also and through the google app engine I may not be able to get those values from the database. You will need to put both your database and tomcat app on a server that supports servlets. Neil -- Neil Aggarwal, (281)846-8957, http://UnmeteredVPS.net Host your tomcat app on a CentOS VPS for only $25/month! Unmetered bandwidth, 7 day no risk trial, Google Checkout - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Deployment specific configuration - best practice
Right this thread has totally confused me now.. On Tue, Nov 17, 2009 at 12:15 AM, Mark Thomas ma...@apache.org wrote: Rainer Frey wrote: * settings in /META-INF/context.xml This one please. Tomcat will extract it on first deployment. OK that will fail but we can then edit the extracted version and Tomcat will use that from then on. Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Multiple war files for the same application context.
Hi Pid, That is interesting. Is the # supposed to be part of the filename? Thanks On Mon, Nov 16, 2009 at 8:38 PM, Pid p...@pidster.com wrote: On 16/11/2009 19:25, Ziggy wrote: Are you trying to deploy elements of a larger applications separately? Yes that is exactly what i am trying to do. You can deploy so-called 'multilevel' apps, if you want to separate out (somewhat) independant components - which may make build deploy cycles easier, for example, as you don't have to replace and test the whole app. The '#' hash character is used like so: myapp.war myapp#news.war myapp#admin.war /myapp/ /myapp/news/ /myapp/admin/ p I did consider the separate jar file option but i couldnt figure out a way of including the jsp files in a jar file. I basically have a large struts/Tiles based application and would like to separate the deployment of each individual module of the application. I want to try and avoid having to redeploy the whole application everytime there is a change. On Mon, Nov 16, 2009 at 7:10 PM, Joseph Morgan joseph.mor...@ignitesales.com wrote: Are you trying to deploy elements of a larger applications separately? It seems you just need different JAR files for the application, and, though those can be deployed to the same web app separately, you're not really gaining anything, since the app will have to be restarted anyway, and you might as well stick with the WAR file. Joe -Original Message- From: Ziggy [mailto:zigg...@gmail.com] Sent: Monday, November 16, 2009 12:35 PM To: Tomcat Users List Subject: Multiple war files for the same application context. Hi guys, Is it possible to deploy multiple war files for the same application? for example if i have an application that is accessed via http:/// www.test.com/myapp, i would usually have a single war file called myapp.war and deploy everthing in that one file. is it possible to deploy myapp1ArticleManager.war, myapp1Forum.war etc and have them all be as part of the one myapp application? Any links or tutorials on how to do this would be very helpfull. And what is the term used for this kind of deployment? Thanks - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Regarding 1 Webserver Multiple Web App project
What is wrong with two domains? i.e. www.domain1.com points to webapp1 www.domain2.com points to webapp2 Both domains need to be pointing at the same IP address i.e. the IP address of where the webapps are hosted. Then just use virtual hosting using Apache or Tomcat to redirect. If you are using tomcat on its own then i think you will need to configure virtual hosting. If you are using tomcat with apache then you will need apache virtual hosting with the AJP connector. On Sat, Nov 14, 2009 at 3:37 PM, Hassan Schroeder hassan.schroe...@gmail.com wrote: On Sat, Nov 14, 2009 at 7:29 AM, Henry Loke fsl...@yahoo.com wrote: Which method is good to support 1 WebServer with Multiple Web App project? Method 1: domain Changes Method 2 : using same domain but append different file structure May I know what the keyword/term used in Apache Tomcat to decribe method 1 and Method 2? #1 is virtual hosts, #2 is just the standard deployment for a single host. No need to google, both are covered by the Tomcat docs. -- Hassan Schroeder hassan.schroe...@gmail.com twitter: @hassan - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: What different between Apache and Apache Tomcat?
On Sat, Nov 14, 2009 at 2:21 PM, Peter Crowther peter.crowt...@melandra.com wrote: Many Internet sites still tell you that Tomcat is slow at serving static content such as html files, and you should put httpd in front for serving those files. This is not true for Tomcat 5.5.x and Tomcat 6.0.x. You will reach the limits of your network connection a long time before you reach the limits of Tomcat's ability to serve static files. Has this actually been proven now? Are there any benchmark tests i can refer to?
Re: Tomcat really need Shutdown port
If you dont configure the shutdown port how will tomcat know which instance to shutdown if you have configured mulitple tomcat instances using multiple catalina_bases?? On Sat, Nov 14, 2009 at 3:15 PM, Caldarale, Charles R chuck.caldar...@unisys.com wrote: From: SRama [mailto:su...@techie.com] Subject: RE: Tomcat really need Shutdown port As of my knowledge and other tomcat related document and experts response it’s states we need tomcat port need to shuts down for windows. Read all the responses; you do *not* need the shutdown port in Windows. If running Tomcat as a service, the shutdown works with the port set to -1 by generating a shutdown signal to the Tomcat process. If running Tomcat from a command prompt, use CTRL-C to terminate Tomcat cleanly. I am giving link to the each application on destop and start of menu once user click the link it point static page and it will call startup.bat file so each application same line I am giving link and it will point same startup.bat file. That's bad; each time the user clicks the link a new instance of Tomcat will start, all but the first of which will die due to port conflicts. Sloppy, at best. You should have the links target your own script that determines whether or not Tomcat is running and starts it only when needed. Next import point we are not shutdown server because user don’t want to see the tomcat console so we are just leaving server when user will restart machine then will system will remove instance from memory. That would be a guaranteed reason for me *not* to buy your application. My question is there any way to set up time to stop the server like after two or 3 hours? Configure a lifecycle listener for each webapp; if there's no activity for any of them over the desired time period, send the shutdown signal. It's probably easiest for you to leave the shutdown port configured, but use a different password. Since the user has complete control of the machine, the user can kill the Tomcat process any time he or she chooses, so the presence of the shutdown port listener is not really a concern. - 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.
Re: Tomcat common/lib
The problem i had with the Oracle specific functions is that they only work if the connection object is of a oracle.jdbc.driver.OracleConnection type. I am using Oracle Specific Types which i found are just a pain to use with Java because they cause lots of issues one of them being interfacing with Java programs. This is an issue because when i get the connection object from a DataSource object that I lookup via JNDI, the connection is not a real OracleConnection object, but an object that wraps the real OracleConnection. The object that you get is an instance of class org.apache.commons.dbcp.BasicDataSource. When you call getConnection on this object, you get an instance of class org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper (which obviously implements java.sql.Connection, and wraps the OracleConnection object). Because of this i couldnt really use the connection object provided via JNDI. I did initially just bypass jndi and created a new conneciton via java.sql.Connection. This worked fine for a couple of months but then i decided to change it as it became a pain to have to maintain the database properties in two places. I.e. on the jndi properties and the properties file for the direct connection. The other problem i had is that when i had two connection types, i was getting lots of problems with the way the driver was being loaded. I think this was because Tomcat was already loading the jdbc driver via common/lib and i had the driver in WEB-INF/lib it was not happy about it. Anyway now i only have the driver in common/lib and use just jndi using the underlying connection delegate. I had a look around and found that i could get the underlying connection from the org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper object which is what i did. Now i dont have to maintain the database properties in two places. How about java.sql.Array instead? I guess it depends on what you're doing with it... Does this map to an Oracle Type? I will play around with it to try some of your suggestions and see what happens. Thanks for the help. Thanks On Fri, Nov 13, 2009 at 2:22 PM, Christopher Schultz ch...@christopherschultz.net wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ziggy, On 11/13/2009 8:15 AM, Ziggy wrote: yes i think you are right. The compiler errors are not on the Connection, PreparedStatement objects references but rather on some specific references. Here are a couple of examples Yes, you are using implementation-specific classes: [javac] /u/build/ConsignmentDAO.java:84: package org.apache.tomcat.dbcp.dbcp does not exist [javac] import org.apache.tomcat.dbcp.dbcp.DelegatingConnection; Do you need to reference the oat.DelegatingConnection, or would java.sql.Connection work just fine? [javac] /u/build/ConsignmentDAO.java:86: cannot find symbol [javac] symbol : class ARRAY [javac] location: package oracle.sql [javac] import oracle.sql.ARRAY; How about java.sql.Array instead? I guess it depends on what you're doing with it... [javac] /u/build/gui2/ConsignmentDAO.java:381: cannot find symbol [javac] symbol : class DelegatingConnection [javac] location: class com.bt.ccs21.data.accessors.ConsignmentDAO [javac] if (conn instanceof DelegatingConnection){ [javac] ^ [javac] /u/build/gui2/ConsignmentDAO.java:382: cannot find symbol [javac] symbol : class DelegatingConnection [javac] location: class com.bt.ccs21.data.accessors.ConsignmentDAO [javac] underlyingConnection = ((DelegatingConnection)conn).getDelegate(); Aah, if you need to get the underlying connection, then you'll need to cast to Tomcat's implementation. Note that you can use reflection to avoid static typecasting and maybe free yourself from needing to have the Tomcat classes around for compilation. Why do you need to access the underlying connection? Probably do to some Oracle-specific stuff: [javac] /u/build/gui2/ConsignmentDAO.java:395: cannot find symbol [javac] symbol : class ArrayDescriptor [javac] location: class data.accessors.ConsignmentDAO [javac] ArrayDescriptor rectabDescriptor = ArrayDescriptor.createDescriptor(LIST_TYPE,underlyingConnection); I believe you can use native Java arrays for some if this stuff, as long as you have properly configured your driver. You may have to toy with the type mapper on the Connection object, though. I know that dealing with SQL ARRAY types is usually pretty hacky. Have you tried simple things like just doing: int[] ints = ...; callableStatement.setObject(n, ints); ... and see what happens? [javac] /u/build/common/java/com/rms_lib_ora.java:350: cannot find symbol [javac] symbol : class OracleConnection [javac] location: class
Re: Tomcat really need Shutdown port
You can use netstat -a to see if the Tomcat port number is listening. On Sat, Nov 14, 2009 at 4:09 PM, SRamasamy su...@techie.com wrote: That's bad; each time the user clicks the link a new instance of Tomcat will start, all but the first of which will die due to port conflicts. Sloppy, at best. You should have the links target your own script that determines whether or not Tomcat is running and starts it only when needed. -- Each time user click the link it will try to start tomcat it will show tomcat the following exception SEVERE: Error initializing endpoint java.net.BindException: Address already in use: JVM_Bind:5050 but application running, tomcat contain more than one application and also corresponding link on desktop if user click the 2nd application on the same tomcat it will show exception on console but application running. When I trying to click 3rd application same exception is coming but application is running. And also we are hiding tomcat console user not able to find exception. Please let me know can I able to check through bat file whether server is stated or not? Our product beauty is no need admin rights to run the application so we are not prepare tomcat installer version. So please let me know if I use tomcat binary version is any other way to find tomcat instance on machine? -- View this message in context: http://old.nabble.com/Tomcat-really-need-Shutdown-port-tp26343993p26351308.html Sent from the Tomcat - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Tomcat common/lib
Hi, When i deploy an application on Tomcat, i have to place the jdbc driver in the $CATALINA_HOME/common/lib folder to be able to use the JNDI facilities. This is fine but when i build the war file using ANT, it refuses to build the war file unless i have the jdbc driver in the application's WEB-INF/lib folder. I dont want to do this because i will then end up with two jar files of the same. i.e. one in Tomcat's common lib and the other in WEB-INF/lib. How can i build the war file without putting the library in WEB-INF/lib? Thanks
Re: Tomcat common/lib
Excellent thanks. Im only beginning to use ANT so im learning it. Thanks On Fri, Nov 13, 2009 at 8:08 AM, Mikolaj Rydzewski m...@ceti.pl wrote: Ziggy wrote: When i deploy an application on Tomcat, i have to place the jdbc driver in the $CATALINA_HOME/common/lib folder to be able to use the JNDI facilities. This is fine but when i build the war file using ANT, it refuses to build the war file unless i have the jdbc driver in the application's WEB-INF/lib folder. I dont want to do this because i will then end up with two jar files of the same. i.e. one in Tomcat's common lib and the other in WEB-INF/lib. How can i build the war file without putting the library in WEB-INF/lib? http://tinyurl.com/y8dtu7s Look for definition of path element. You can specify many directories with jar files for use at compile stage. -- Mikolaj Rydzewski m...@ceti.pl - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Multiple tomcat instances
Hi, I have set up multiple Tomcat instances using the multiple CATALINA_BASE approach. Everything works fine but i have two issues that i need clarification on. I am currently using Tomcat 5.5 1. When i have created the new folders that $CATALINA_BASE will point to, which files do i need to copy to the 'conf' folder. I have tested this and found that it works fine if i just move the web.xml and server.xml file. My question is do i need to copy the other files as well (i.e. catalina.policy, catalina.properties, context.xml, logging.properties, server-minimal.xml). What is the best thing to do, should i copy all the files from $TOMCAT_HOME/conf to CATALINA_BASE/conf?. I guess it would be usefull if i can find out exactly what each of these files are for. is there a file that i definately need to copy other than the web.xml and server.xml? 2. I had a second question but my mind just went completely blind! Ill update the email when i remember it. Madness i know :)
Re: Tomcat common/lib
No i dont have driver specific code. But something like this raises compilation errors as the jar file that includes the Connection, PreparedStatement and ResultSet objects is not accessible from the WEB-INF/lib folder. Context envCtx = (Context) initCtx.lookup(java:comp/env); DataSource ds = (DataSource) envCtx.lookup(jdbc/EmployeeDB); Connection conn = ds.getConnection(); PreparedStatement lv_pstmt = null; ResultSet lv_rs = null; To be able to compile the above, the jdbc driver in Tomcat/common/lib has to be in the classpath i guess. Thanks On Fri, Nov 13, 2009 at 8:56 AM, Mikolaj Rydzewski m...@ceti.pl wrote: Ziggy wrote: when i build the war file using ANT, it refuses to build the war file unless i have the jdbc driver in the application's WEB-INF/lib folder Do you use any driver specific calls in your code? Since you use JNDI, you should rely only on DataSource provided by container. Hence, no piece of your code should have references to classes from JDBC driver. -- Mikolaj Rydzewski m...@ceti.pl - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat common/lib
Thats interesting.. let me try it again and see the exact compile error that is raised. On Fri, Nov 13, 2009 at 9:18 AM, Mikolaj Rydzewski m...@ceti.pl wrote: Ziggy wrote: No i dont have driver specific code. But something like this raises compilation errors as the jar file that includes the Connection, PreparedStatement and ResultSet objects is not accessible from the WEB-INF/lib folder. Context envCtx = (Context) initCtx.lookup(java:comp/env); DataSource ds = (DataSource) envCtx.lookup(jdbc/EmployeeDB); Connection conn = ds.getConnection(); PreparedStatement lv_pstmt = null; ResultSet lv_rs = null; To be able to compile the above, the jdbc driver in Tomcat/common/lib has to be in the classpath i guess. These are standard J2SE interfaces from java.sql package. There's no need to include any additional jars to compile such code. -- Mikolaj Rydzewski m...@ceti.pl - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat common/lib
Hi, yes i think you are right. The compiler errors are not on the Connection, PreparedStatement objects references but rather on some specific references. Here are a couple of examples compile: [echo] Compiling java sources: [javac] Compiling 146 source files to /u/build/gui2/distribution/classes [javac] /u/build/ConsignmentDAO.java:84: package org.apache.tomcat.dbcp.dbcp does not exist [javac] import org.apache.tomcat.dbcp.dbcp.DelegatingConnection; [javac] ^ [javac] /u/build/ConsignmentDAO.java:86: cannot find symbol [javac] symbol : class ARRAY [javac] location: package oracle.sql [javac] import oracle.sql.ARRAY; [javac] ^ [javac] /u/build/gui2/ConsignmentDAO.java:87: cannot find symbol [javac] symbol : class ArrayDescriptor [javac] location: package oracle.sql [javac] import oracle.sql.ArrayDescriptor; [javac] ^ [javac] /u/build/gui2/SubmitDeclaration.java:43: cannot find symbol [javac] symbol : class StructDescriptor [javac] location: package oracle.sql [javac] import oracle.sql.StructDescriptor; [javac] ^ [javac] /u/build/lib_ora.java:125: package oracle.jdbc does not exist [javac] import oracle.jdbc.*; [javac] ^ [javac] /u/build/gui2/ConsignmentDAO.java:381: cannot find symbol [javac] symbol : class DelegatingConnection [javac] location: class com.bt.ccs21.data.accessors.ConsignmentDAO [javac] if (conn instanceof DelegatingConnection){ [javac] ^ [javac] /u/build/gui2/ConsignmentDAO.java:382: cannot find symbol [javac] symbol : class DelegatingConnection [javac] location: class com.bt.ccs21.data.accessors.ConsignmentDAO [javac] underlyingConnection = ((DelegatingConnection)conn).getDelegate(); [javac] ^ [javac] /u/build/gui2/ConsignmentDAO.java:383: cannot find symbol [javac] symbol : class DelegatingConnection [javac] location: class com.bt.ccs21.data.accessors.ConsignmentDAO [javac] underlyingConnection = ((DelegatingConnection)underlyingConnection).getDelegate(); [javac] ^ [javac] /u/build/gui2/ConsignmentDAO.java:395: cannot find symbol [javac] symbol : class ArrayDescriptor [javac] location: class data.accessors.ConsignmentDAO [javac] ArrayDescriptor rectabDescriptor = ArrayDescriptor.createDescriptor(LIST_TYPE,underlyingConnection); [javac] /u/build/gui2/data/accessors/ConsignmentDAO.java:396: cannot find symbol [javac] symbol : class ARRAY [javac] location: class data.accessors.ConsignmentDAO [javac] ARRAY awbNoHwbs = new ARRAY(rectabDescriptor,underlyingConnection,childLessAwbs); [javac] ^ [javac] ^ [javac] /u/build/common/java/com/rms_lib_ora.java:350: cannot find symbol [javac] symbol : class OracleConnection [javac] location: class com.bt.ccs21.common_java.rms_lib_ora [javac] if( !((OracleConnection) mainConnection).getImplicitCachingEnabled()) [javac]^ [javac] if( !((OracleConnection) mainConnection).getImplicitCachingEnabled()) [javac]^ [javac] ((OraclePreparedStatement)pStatement).close(); [javac] ^ [javac] ((OracleConnection) mainConnection).setStatementCacheSize( gJDBC_StatementCacheSize ); [javac] ^ [javac] + ((OracleConnection) mainConnection).getStatementCacheSize() ); [javac] ^ [javac] ^ [javac] Note: Some input files use or override a deprecated API. [javac] Note: Recompile with -Xlint:deprecation for details. [javac] Note: Some input files use unchecked or unsafe operations. [javac] Note: Recompile with -Xlint:unchecked for details. On Fri, Nov 13, 2009 at 12:28 PM, Ziggy zigg...@gmail.com wrote: Thats interesting.. let me try it again and see the exact compile error that is raised. On Fri, Nov 13, 2009 at 9:18 AM, Mikolaj Rydzewski m...@ceti.pl wrote: Ziggy wrote: No i dont have driver specific code. But something like this raises compilation errors as the jar file that includes the Connection, PreparedStatement and ResultSet objects is not accessible from the WEB-INF/lib folder. Context envCtx = (Context) initCtx.lookup(java:comp/env); DataSource ds = (DataSource) envCtx.lookup(jdbc/EmployeeDB); Connection conn = ds.getConnection
Deploying and building a war file
Hi all, I've got a query on the way web applications are deployed. I have an application that has several jsp files and serlvets that are in WEB-INF/classes. When i deploy the application all i do is do a checkout on CVS, make the changes, rebuild the war using ANT and redeploy manually. This works fine but now i am having some doubts on this approach. Basicaly if i even change one file i have to rebuild the war file meaning i have to recompile everything. I think this is unecessary. i would like to be able to just recompile the one file and redeploy the one file without having to rebuild the whole war file. 1. How do you deploy your application? If you deploy as a war file, do you recompile everything even if the change is to a single file or a configuration file. 2. Could you provide an example on the approach you use from the point a source file comes out from CVS to the point it get to the production environment. (An example with a single file change would be usefull) 2. Do you use any tool to manage this? I am thinking that if i change one file i should be able to just compile that one file and move it to the WEB-INF/classes folder into the relevant folder. This might work but is there a better way of doing this instead of moving it manually? Thanks
Re: Deploying and building a war file
Hi Ken, I do use eclipse but only for development. I cant really deploy from eclipse for several reasons. One of them being that the deployment server is a different machine from where i do the development. Thanks On Mon, Nov 9, 2009 at 7:12 PM, Ken Bowen kbo...@als.com wrote: If you use Eclipse (www.eclipse.org/ free; runs on Wins/Mac/Linux) with the web plugins, it records your deploy target, and allows you to deploy with either a war file, or in exploded form. In the latter case, you can usually leave your web server running, make a code change, save the file, and it is automatically re-compiled re-deployed to the running server. At worst, you only need to hit a refresh button. It makes life much simpler, and the syntax-directed editor saves me from many stupidities. --Ken On Nov 9, 2009, at 7:04 AM, Ziggy wrote: Hi all, I've got a query on the way web applications are deployed. I have an application that has several jsp files and serlvets that are in WEB-INF/classes. When i deploy the application all i do is do a checkout on CVS, make the changes, rebuild the war using ANT and redeploy manually. This works fine but now i am having some doubts on this approach. Basicaly if i even change one file i have to rebuild the war file meaning i have to recompile everything. I think this is unecessary. i would like to be able to just recompile the one file and redeploy the one file without having to rebuild the whole war file. 1. How do you deploy your application? If you deploy as a war file, do you recompile everything even if the change is to a single file or a configuration file. 2. Could you provide an example on the approach you use from the point a source file comes out from CVS to the point it get to the production environment. (An example with a single file change would be usefull) 2. Do you use any tool to manage this? I am thinking that if i change one file i should be able to just compile that one file and move it to the WEB-INF/classes folder into the relevant folder. This might work but is there a better way of doing this instead of moving it manually? Thanks - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Trying to set up tomcat
What exactly is the problem? On 11/7/09, paul8 pau...@hotmail.co.uk wrote: Hi I am trying to set up Tomcat on ubuntu, I have unziped and changed the classpath(i think) i go in to the bin folder of tomcat and run catalina.sh using terminal and get the following p...@paul-laptop:~/apache-tomcat-6.0.20/bin$ ./startup.sh run Using CATALINA_BASE: /home/paul/apache-tomcat-6.0.20 Using CATALINA_HOME: /home/paul/apache-tomcat-6.0.20 Using CATALINA_TMPDIR: /home/paul/apache-tomcat-6.0.20/temp Using JRE_HOME: /usr/lib/java/ -- View this message in context: http://old.nabble.com/Trying-to-set-up-tomcat-tp26235460p26235460.html Sent from the Tomcat - User mailing list archive at Nabble.com. -- Sent from my mobile device - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Adding a new webapps directory
Can't this not be achieved by using a different CATALINA_BASE? On 10/17/09, Caldarale, Charles R chuck.caldar...@unisys.com wrote: From: Marco Rocco [mailto:mr8...@gmail.com] Subject: Re: Adding a new webapps directory at http://127.0.0.1:8080/ServletExample i get blank page. Any way this is server.xml if this can help you: http://pastebin.com/f5fecfa93 That looks ok. Is there anything in the logs? Try configuring an AccessLogValve for this Host to see what's coming in and going out: Host name=myservlets appBase=/home/marco/myservlets Valve className=org.apache.catalina.valves.AccessLogValve directory=logs prefix=myservlets_access_log. suffix=.txt pattern=common resolveHosts=false/ /Host - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org -- Sent from my mobile device - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Can a JNDI resource be in a webapp's lib folder
I am trying to set up a JNDI resource of an Oracle database connection. I have set the connection details in my application's context file in $CATALINA_BASE/webapps/myapp/META-INF/context.xml I put the jdbc driver in $CATALINA_BASE/common/lib and everything works fine. The problem is i dont want to put the jdbc driver in that directory. I would like to put it in $CATALINA_BASE/webapps/myapp/WEB-INF/lib I have read about this a bit and i think that all JNDI resources must be in $CATALINA_HOME/common/lib which explains why If i put the driver in the application's lib folder it cant access it because the common class loader wouldnt konw of the libraries in the applicatoins lib folders.. The tomcat installation only runs this one application. I would like to be able to move the application's war file (which will include all libraries in the WEB-INF/lib folder) around to other tomcat instances if i need to without having to worry about moving libraries as well. Its a bit weird that i configure the JNDI resource in the application's context file but the library that the context file is refering to is to be kept outside of the application. is there a way i can use the JNDI resource but have the jdbc driver in the application's WEB-INF/lib directory? Thanks in advance.
Re: Re Directing tomcat console out put to log files
Hi vijay Your comments are not really helpfull and are rude. Just because something has been updated it does not mean that you have to use the latest version.. There could be a million reasons why someone decides to stick with an older version of an application. Upgrading just for the sake of it does not make sense business sense at all and it costs a lot of money too. If it aint broke don't fix it! On 10/9/09, André Warnier a...@ice-sa.com wrote: VijayKS wrote: VijayKS wrote: Hi I m using Tomcat 4.1. I try to redirect System.out to log files, but unable to do it. Help me to resolve this issue I installed the exe version of tomcat 4.1 . There is no catalina.log files present. localhost_log.2009-10-09.txt This is the file name is in C:\tomcat4.1\logs\ folder. But the System.out. messages not written in this file and it is written in console window Vijay, by now Tomcat 4.1 must be about 10 years old. It is no longer developed nor maintained. The current version is Tomcat 6.20.x. In-between, there have been Tomcat 5.0 and Tomcat 5.5. So why do you install Tomcat 4.1 ? It is not any cheaper than the latest one. Most people here are probably too young even to remember how to configure that version. And even if they are not, not many people here will be willing to go back digging into that old documentation and find answers for you. (Something by the way which you could do yourself.) I would recommend that you de-install Tomcat 4.1, install the latest version, and then if you have a problem come back and ask. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org -- Sent from my mobile device - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Re Directing tomcat console out put to log files
Sorry vijay my comments were directed at Andre On 10/10/09, Ziggy zigg...@gmail.com wrote: Hi vijay Your comments are not really helpfull and are rude. Just because something has been updated it does not mean that you have to use the latest version.. There could be a million reasons why someone decides to stick with an older version of an application. Upgrading just for the sake of it does not make sense business sense at all and it costs a lot of money too. If it aint broke don't fix it! On 10/9/09, André Warnier a...@ice-sa.com wrote: VijayKS wrote: VijayKS wrote: Hi I m using Tomcat 4.1. I try to redirect System.out to log files, but unable to do it. Help me to resolve this issue I installed the exe version of tomcat 4.1 . There is no catalina.log files present. localhost_log.2009-10-09.txt This is the file name is in C:\tomcat4.1\logs\ folder. But the System.out. messages not written in this file and it is written in console window Vijay, by now Tomcat 4.1 must be about 10 years old. It is no longer developed nor maintained. The current version is Tomcat 6.20.x. In-between, there have been Tomcat 5.0 and Tomcat 5.5. So why do you install Tomcat 4.1 ? It is not any cheaper than the latest one. Most people here are probably too young even to remember how to configure that version. And even if they are not, not many people here will be willing to go back digging into that old documentation and find answers for you. (Something by the way which you could do yourself.) I would recommend that you de-install Tomcat 4.1, install the latest version, and then if you have a problem come back and ask. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org -- Sent from my mobile device -- Sent from my mobile device - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Re Directing tomcat console out put to log files
Have a look at this page http://tomcat.apache.org/tomcat-4.1-doc/config/logger.html On Sat, Oct 10, 2009 at 11:12 AM, Ziggy zigg...@gmail.com wrote: Sorry vijay my comments were directed at Andre On 10/10/09, Ziggy zigg...@gmail.com wrote: Hi vijay Your comments are not really helpfull and are rude. Just because something has been updated it does not mean that you have to use the latest version.. There could be a million reasons why someone decides to stick with an older version of an application. Upgrading just for the sake of it does not make sense business sense at all and it costs a lot of money too. If it aint broke don't fix it! On 10/9/09, André Warnier a...@ice-sa.com wrote: VijayKS wrote: VijayKS wrote: Hi I m using Tomcat 4.1. I try to redirect System.out to log files, but unable to do it. Help me to resolve this issue I installed the exe version of tomcat 4.1 . There is no catalina.log files present. localhost_log.2009-10-09.txt This is the file name is in C:\tomcat4.1\logs\ folder. But the System.out. messages not written in this file and it is written in console window Vijay, by now Tomcat 4.1 must be about 10 years old. It is no longer developed nor maintained. The current version is Tomcat 6.20.x. In-between, there have been Tomcat 5.0 and Tomcat 5.5. So why do you install Tomcat 4.1 ? It is not any cheaper than the latest one. Most people here are probably too young even to remember how to configure that version. And even if they are not, not many people here will be willing to go back digging into that old documentation and find answers for you. (Something by the way which you could do yourself.) I would recommend that you de-install Tomcat 4.1, install the latest version, and then if you have a problem come back and ask. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org -- Sent from my mobile device -- Sent from my mobile device
jar file loading priority
Hi all, Could someone please clarify this for me as i have always wondered about it but couldnt find any usefull information. Given the following directories $JAVA_HOME/jdk/lib/ $JAVA_HOME/jdk/jre/lib/ $JAVA_HOME/jdk/jre/lib/ext $TOMCAT_HOME/common/lib $CATALINA_BASE/common/lib $CATALINA_BASE/myapp/WEB-INF/lib I know that even though it is not recommended i can practically place my jar files in any of the above directories and my application which is in $CATALINA_BASE/myapp should pick it up. The reason i am curios about this is i had the activation.jar in $CATALINA_BASE/myapp/WEB-INF/lib and recently found out that JDK1.6 also comes with activation.jar which it places in /usr/share/lib under Solaris. Now what i am wondering is what is the order in which the jar files will be loaded? For example, what will happen if i have ojdbc14.jar in all the above directories? Which one will be picked up first? And also is there a way to find out if there are duplicate jar files which one was used? Please note that i do know that it is not recommended to place jar files in non app lib folders. I just want to know the order in which the jar files will be loaded to satisfy my curiosity :). Thanks
Re: Re Directing tomcat console out put to log files
all output for System.out statements should by default go to the tomcat log file which is in $CATALINA_HOME/logs/catalina.out Is anything getting written to that file? On 10/9/09, VijayKS ksvijay...@gmail.com wrote: Hi I m using Tomcat 4.1. I try to redirect System.out to log files, but unable to do it. Help me to resolve this issue -- View this message in context: http://www.nabble.com/Re-Directing-tomcat-console-out-put-to-log-files-tp25818644p25818644.html Sent from the Tomcat - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org -- Sent from my mobile device - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Help management access
I can't access the tomcat Management system That can mean a million things. What exactly happens when you try to access the manager? On Sun, Oct 4, 2009 at 4:57 PM, Jared Southern jaredsouth...@hotmail.comwrote: Hi all, I installed Apache Tomcat Version 6.0.20 I can't access the tomcat Management system, I changed the tomcat-users.xml file, but I doen't make any difference. tomcat-users!-- role rolename=admin/ role rolename=tomcat/ role rolename=role1/ role relename=manager/ user username=jared password=secret roles=manager,admin,tomcat/ user username=both password=tomcat roles=tomcat,role1/ user username=role1 password=tomcat roles=role1/--/tomcat-users please help Regards Jared _ Use Hotmail to send and receive mail from your different email accounts. http://clk.atdmt.com/UKM/go/167688463/direct/01/
Re: php 5 and tomcat 6
Have a look at liferay portlets... They allow you to run php portlets from inside a j2ee container like tomcat.. www.liferay.com On 9/24/09, Tommy Pham tommy...@yahoo.com wrote: - Original Message From: Hassan Schroeder hassan.schroe...@gmail.com To: Tomcat Users List users@tomcat.apache.org Sent: Thursday, September 24, 2009 10:36:19 AM Subject: Re: php 5 and tomcat 6 On Thu, Sep 24, 2009 at 8:40 AM, Tommy Pham wrote: Only way to get PHP running in Tomcat is through CGI. Not true: http://quercus.caucho.com/ -- Hassan Schroeder hassan.schroe...@gmail.com twitter: @hassan - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org I think it maybe a problem with supporting full extensions from pecl/pear. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org -- Sent from my mobile device - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Can't access Tomcat from outside the LAN
If you have more than one pc on ur network then you have to configure your gateway(I.e router) so that all requests that use port 8080 should be forwarded to the pc that has tomcat installed. On 9/15/09, Jonathan Soons jso...@juilliard.edu wrote: Tom, Do you have a default gateway? If you can access anything outside your LAN then you must have one. It seems your tomcat box does not know about it. Jonathan Soons - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org -- Sent from my mobile device - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Database Connection Pooling initialization with dbcp
Im not an expert on this but i thought that the pool will cache connections that you have created. Maybe someone can clarify this. Have a look at this http://onjava.com/pub/a/onjava/2006/04/19/database-connection-pooling-with-tomcat.html?page=2 On Wed, Sep 9, 2009 at 9:01 AM, Chris Wiley cwile...@comcast.net wrote: Hello, I have a web app I have developed under Tomcat 6.0.18 and have added in the dbcp system. As it stands now, It wants to make connections only after the first request to the app. I want the dbcp system to initialize x number of connections on app/server startup. I know if I want to initialize things on startup I include the load-on-startup1/load-on-startup in the web.xml for the app; which will load the servlet and execute what's in the init method. My question is this: Am I to assume that I need to OPEN and CLOSE x number of connections in the init section of the servlet to load the pool with live connections? Otherwise, I don't see how it will create those connections and load the pool on startup. I seem to be missing or overlooking a method call in the api that will actually load the pool with live connections. Not sure if it makes a difference, but I also have the dbcp being set up in a ServletContextListener. Any Help is greatly appreciated, have spent to much time on this trying to get it to work like I want or as it's supposed to. Thanks! Chris - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: How to install an updated third party SSL certificate for B2B transactions
On 9/8/09, Peter Crowther peter.crowt...@melandra.com wrote: 2009/9/8 David Uctaa duc...@gmail.com I have inherited a Tomcat 5.5 installation running on Windows XP. There are processes on this box which do server-to-server connections with a third party via HTTPS over SSL. We have installed the third party's SSL certificate on our server, and they have done likewise with ours. We use their certificate for recognizing messages that they have signed and encrypted, etc. OK. So the first step is to work out what piece of code uses their certificate. It's unlikely to be Tomcat, which probably uses your certificate to identify itself to them - but it's possible. It's more likely to be one or more B2B web applications (webapps) running inside Tomcat, which probably check returns from them to make sure the correct cert has been seen from their server. They have now updated their certificate and sent it to us. But I do not know how or where to update this on our system. Do I need to do something with the keystore? Are there resources online which will give me the how-tos on this? I've googled around and only managed to confuse myself further. I think it'll stay confusing until you answer the above question. You'll have to find / create / mind-read the documentation about which part of the system needs to know about which certificates. I suspect finding that out, or simply finding the architecture diagram that shows what apps are hosted in what containers and how they communicate, would be very useful to you! Once you've got more information, you can then ask far more targeted questions. They might be of the Tomcat users if that's relevant, or they might be of some other group that knows about the technology in your B2B webapps. Hope that helps. I'm not trying to fob you off; I just think we all need some more information about what's on the box! - Peter -- Sent from my mobile device - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: 100% usage and hanging on startup of Spring/Hibernate app in Tomcat 5.5 on Ubuntu 7
I noticed that you mention that you are using the community version of the Java runtime environment which i think is what you get when you do an apt-get. I have never honestly been able to use this version of the JVM successfully. I had a similar problem recently where i was running an application (That uses Hibernate) using this version of the JDK and was always getting memory exceptions. What i did was to download sun's version of the JDK and that seem to have solved the problem. Did you try to use the SUN's version of the JDK from the SUN website? It might be usefull to try the SUN's version just to rule out that the JDK version/release is not the problem. On Wed, Sep 2, 2009 at 11:26 PM, Mark Thomas ma...@apache.org wrote: Bradley Wagner wrote: Any thoughts on which GC parameters I should change. See what the default collector is for your platform and switch to s different one. Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: 100% usage and hanging on startup of Spring/Hibernate app in Tomcat 5.5 on Ubuntu 7
Ok my mistake. Thats the official SUN version. The linux distribution i use downloads the openjdk version and i had to manually download the official one to stop the memory errors. On Thu, Sep 3, 2009 at 3:29 PM, ramzi khlil ramzi.atv...@gmail.com wrote: It provides you the version of installed java. On Thu, Sep 3, 2009 at 10:19 AM, Ziggy zigg...@gmail.com wrote: What do you get when you run java -version? I think the linux distributions include the open jdk version see http://openjdk.java.net/ On Thu, Sep 3, 2009 at 3:13 PM, Caldarale, Charles R chuck.caldar...@unisys.com wrote: From: Bradley Wagner [mailto:bradley.wag...@hannonhill.com] Subject: Re: 100% usage and hanging on startup of Spring/Hibernate app in Tomcat 5.5 on Ubuntu 7 are you saying that the JRE I'm getting when doing apt-get install sun-java6-jdk is not actually a Sun certified version and that I should be downloading it directly from their website instead? It's certainly something to try. You can find out exactly what you have installed by doing java -version (without the quotes). - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: 100% usage and hanging on startup of Spring/Hibernate app in Tomcat 5.5 on Ubuntu 7
What do you get when you run java -version? I think the linux distributions include the open jdk version see http://openjdk.java.net/ On Thu, Sep 3, 2009 at 3:13 PM, Caldarale, Charles R chuck.caldar...@unisys.com wrote: From: Bradley Wagner [mailto:bradley.wag...@hannonhill.com] Subject: Re: 100% usage and hanging on startup of Spring/Hibernate app in Tomcat 5.5 on Ubuntu 7 are you saying that the JRE I'm getting when doing apt-get install sun-java6-jdk is not actually a Sun certified version and that I should be downloading it directly from their website instead? It's certainly something to try. You can find out exactly what you have installed by doing java -version (without the quotes). - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: dbcp error with java.lang.ClassCastException: org.apache.tomcat.dbcp.dbcp.PoolingDataSource
Hi, I had a look at the tomcat dbcp documentation and found that it is possible to retrieve the underlying connection. As described here http://commons.apache.org/dbcp/configuration.html The problem i am getting now is that i still cannot cast the class properly to get the underlying connection. As described in the docs i added the following property in the datasource definition [code] accessToUnderlyingConnectionAllowed=true [/code] My datasource definition now looks like this [code] Resource name=jdbc/testdb auth=Container type=javax.sql.DataSource driverClassName=oracle.jdbc.driver.OracleDriver url=jdbc:oracle:thin:@10.10.10.10:1521:testdb username=testuser password=testuser maxActive=20 maxIdle=10 maxWait=-1 accessToUnderlyingConnectionAllowed=true/ [/code] And change my code slightly to be [code] Connection conn = ds.getConnection() Connection dconn = ((DelegatingConnection) conn).getInnermostDelegate(); [/code] The problem i have now is i am getting a class cast execption on the second line (where i am trying to getInnermostDelegate(). Here is the error i am getting [code] java.lang.ClassCastException: org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper at com.bt.ccs21.data.accessors.ConsignmentDAO.submitDeclaration(ConsignmentDAO.java:250) at com.bt.ccs21.presentation.events.consignment.search.SubmitDeclaration.midAction(SubmitDeclaration.java:105) at com.bt.ccs21.presentation.events.CCS21EventAction.execute(CCS21EventAction.java:67) at org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58) at org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67) at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51) at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190) at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304) at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190) at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462) at javax.servlet.http.HttpServlet.service(HttpServlet.java:647) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) 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:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172) 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:174) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:875) 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:689) at java.lang.Thread.run(Thread.java:595) [/code] Thanks On Thu, Oct 9, 2008 at 5:53 PM, Ziggy [EMAIL PROTECTED] wrote: Hi, I originally only had it on $TOMCAT_HOME/common/lib but it didnt work. I only put it on both locations to test it out. I have now removed the copy from $APPLICATION_ROOT_DIR/WEB-INF/ lib/ and i still have the same problem described below. Thanks On Thu, Oct 9, 2008 at 5:35 PM, Caldarale, Charles R [EMAIL PROTECTED] wrote: From: Ziggy [mailto:[EMAIL PROTECTED] Sent: 2008 October 09, Thursday 11:12 org.apache.tomcat.dbcp.dbcp.PoolingDataSource I have placed the jdbc driver on both the following directories [code] $TOMCAT_HOME/common/lib/ $APPLICATION_ROOT_DIR/WEB-INF/lib/ [/code] Never, never, never put the same class(es) in more than one location in a given branch of the classloader tree. Since you're using Tomcat to manage the DB connection pool, the .jar file containing the JDBC driver classes must be placed in common/lib. - 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
Re: dbcp error with java.lang.ClassCastException: org.apache.tomcat.dbcp.dbcp.PoolingDataSource
Hi, I am really stuck with the tomcat connection pool as its the application server that i am using. How does the oracle connection pool work? Could you point me to some info somewhere so that i can read about it. Thanks On Fri, Oct 10, 2008 at 2:51 PM, Christopher Schultz [EMAIL PROTECTED] wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ziggy, Ziggy wrote: The problem i am getting now is that i still cannot cast the class properly to get the underlying connection. Your best bet is to use standard JDBC API calls instead of trying to use Oracle's proprietary APIs. You may have to use Oracle's connection pooling instead of Tomcat's. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkjvXeIACgkQ9CaO5/Lv0PB2vQCfb8amv7/X/UPq6VBllTKh/awT CUIAnRTeS2VG3c6ExUUvagIn67tZPJLi =yyGE -END PGP SIGNATURE- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
dbcp error with java.lang.ClassCastException: org.apache.tomcat.dbcp.dbcp.PoolingDataSource
Hi All, I am using jdbc to connect to an oracle database but having a bit of a problem. Here is some details Jdbc driver - Type 4 App server - Tomcat 5.5 Oracle Version - 10g I have placed the jdbc driver on both the following directories [code] $TOMCAT_HOME/common/lib/ $APPLICATION_ROOT_DIR/WEB-INF/lib/ [/code] Here is the stack trace of the error i am getting. [code] 09/10/2008 16:38:30 ERR http-8080-Processor23 com.bt.ccs21.presentation.events.CCS21EventAction: Throwable:org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper java.lang.ClassCastException: org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper at oracle.sql.ArrayDescriptor.createDescriptor(ArrayDescriptor.java:149) at oracle.sql.ArrayDescriptor.createDescriptor(ArrayDescriptor.java:115) at com.bt.ccs21.data.accessors.ConsignmentDAO.submitDeclaration(ConsignmentDAO.java:251) at com.bt.ccs21.presentation.events.consignment.search.SubmitDeclaration.midAction(SubmitDeclaration.java:107) at com.bt.ccs21.presentation.events.CCS21EventAction.execute(CCS21EventAction.java:67) at org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58) at org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67) at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51) at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190) at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304) at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190) at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462) at javax.servlet.http.HttpServlet.service(HttpServlet.java:647) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) 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:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172) 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:174) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:875) 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:689) at java.lang.Thread.run(Thread.java:595) [/code] Here is the java code to get my connection [code] // JNDI Context ctx = null; DataSource ds = null; Connection conn = null; ctx = new InitialContext(); Context envContext = (Context)ctx.lookup(java:/comp/env); if (ctx != null) { ds = (DataSource)envContext.lookup(fullname); if (ds != null) { // Enable tracing on this connection... if (jdbcTraceFile != null ds.getLogWriter() == null) { try { Log.threadLog(Log.DEBUG, CLASSNAME, METHOD + : setting JDBC trace file on DataSource); jdbcTraceFile.println(Tracing on JDBC DataSource + ds.toString()); ds.setLogWriter(jdbcTraceFile); } catch (SQLException sqle) { Log.threadLog(Log.ERROR, CLASSNAME, METHOD + : Exception while setting JDBC trace file); Log.threadLog(Log.ERROR, CLASSNAME, sqle); } } conn = ds.getConnection(); } } [/code] And here is the datasource configuration. This is configured in the following file $TOMCAT_HOME/catalina/localhost/context.xml [code] Resource name=jdbc/testdb auth=Container type=javax.sql.DataSource driverClassName=oracle.jdbc.driver.OracleDriver
Re: dbcp error with java.lang.ClassCastException: org.apache.tomcat.dbcp.dbcp.PoolingDataSource
Hi, I originally only had it on $TOMCAT_HOME/common/lib but it didnt work. I only put it on both locations to test it out. I have now removed the copy from $APPLICATION_ROOT_DIR/WEB-INF/lib/ and i still have the same problem described below. Thanks On Thu, Oct 9, 2008 at 5:35 PM, Caldarale, Charles R [EMAIL PROTECTED] wrote: From: Ziggy [mailto:[EMAIL PROTECTED] Sent: 2008 October 09, Thursday 11:12 org.apache.tomcat.dbcp.dbcp.PoolingDataSource I have placed the jdbc driver on both the following directories [code] $TOMCAT_HOME/common/lib/ $APPLICATION_ROOT_DIR/WEB-INF/lib/ [/code] Never, never, never put the same class(es) in more than one location in a given branch of the classloader tree. Since you're using Tomcat to manage the DB connection pool, the .jar file containing the JDBC driver classes must be placed in common/lib. - 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: context.xml in META-INF
Please ingnore this. There was a typo in the filename thats why it wasnt working. Thanks On Thu, Oct 9, 2008 at 5:17 PM, Ziggy [EMAIL PROTECTED] wrote: Hi all, I have the following datasource definition in my /META-INF/context.xml Resource name=jdbc/testdb auth=Container type=javax.sql.DataSource driverClassName=oracle.jdbc.driver.OracleDriver url=jdbc:oracle:thin:@10.10.10.10:1521:testdb username=testuser password=testuser maxActive=20 maxIdle=10 maxWait=-1/ For some reason the above does not work when i deploy the .war file. It does however work if i rename the context.xml file into [applicationname].xml and put it into $TOMCAT_HOME/catalina/localhost/ Does anyone know why it doesnt work if in app/META-INF/context.xml? I am using tomcat 5.5 Thanks
Re: javax.naming.NamingException: Cannot create resource instance
No mate that was the full stack trace. Thanks On Wed, Oct 1, 2008 at 7:02 PM, David Smith [EMAIL PROTECTED] wrote: Seems like such a generic error would have a root cause. Was there anything more to the stack trace? --David Ziggy O wrote: Hi, I am trying to connect to an oracle database but cant seem to get the jdbc connection to work. I am developing the application on a Windows desktop and transferring it onto a Unix box. When i test it on the Windows environmnet it does manage to connect but if i test it on unix then i get an error. My gut feeling is that the installation on the unix environment is missing a library but i cant figure out what it is. Here is how i am trying to get the jndi connection. [code] String fullname; if (jndiPrefix != null jndiPrefix.length() 0) fullname = jndiPrefix + datasource; else fullname = datasource; // JNDI Context ctx = null; DataSource ds = null; Connection conn = null; try { ctx = new InitialContext(); Context envContext = (Context)ctx.lookup(java:/comp/env); if (ctx != null) { ds = (DataSource)envContext.lookup(fullname); if (ds != null) { conn = ds.getConnection(); } } } [/code] And here is the Configuration. Context.xml (User and password modified) [code] Resource name=jdbc/theDb auth=Container type=javax.sql.DataSource driverClassName=oracle.jdbc.driver.OracleDriver url=jdbc:oracle:thin:@localhost:1521:webdev username=webuser password=webuser maxActive=20 maxIdle=10 maxWait=-1/ [/code] web.xml [code] resource-ref descriptionOracle Datasource/description res-ref-namejdbc/theDb/res-ref-name res-typeoracle.jdbc.pool.OracleDataSource/res-type res-authContainer/res-auth /resource-ref [/code] And here is the stack trace of the error [code] javax.naming.NamingException: Cannot create resource instance at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:143) at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source) at org.apache.naming.NamingContext.lookup(NamingContext.java:793) at org.apache.naming.NamingContext.lookup(NamingContext.java:140) at org.apache.naming.NamingContext.lookup(NamingContext.java:781) at org.apache.naming.NamingContext.lookup(NamingContext.java:153) at com.bt.ccs21.util.DbConnection.getJNDIConnection(DbConnection.java:334) at com.bt.ccs21.util.DbConnection.getJNDIConnection(DbConnection.java:256) at com.bt.ccs21.util.DbConnection.getJRunConnection(DbConnection.java:286) at com.bt.ccs21.presentation.events.admin.LogonActionPost.preAction(LogonActionPost.java:118) at com.bt.ccs21.presentation.events.CCS21EventAction.execute(CCS21EventAction.java:29) at org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58) at org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67) at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51) at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190) at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304) at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190) at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462) at javax.servlet.http.HttpServlet.service(HttpServlet.java:710) 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
Re: javax.naming.NamingException: Cannot create resource instance
Hi, The tomcat version on my Desktop is 5.5.27 and the Tomcat version on the Unix environment is 5.5.23. Could the above minor version difference cause it? One thing i have noticed is that if i take the /META-INF/Context.xml file and copy it into $CATALINA_HOME/conf/Catalina/localhost/testapp.xml it does work. i.e. why does it require the context file in that directory and why does it have to be renamed to my applications context. On the Windows environment i dont have to rename and copy the context file to $CATALINA_HOME/conf/Catalina/localhost Thanks On Thu, Oct 2, 2008 at 12:55 PM, David Smith [EMAIL PROTECTED] wrote: Ok... 1) I don't see a tomcat version, could you post that? 2) Are you sure the tomcat version on the production environment the same as your dev system? 3) This is probably not causing the immediate problem, but res-type ... /res-type in your web.xml should be javax.sql.Datasource, not oracle.jdbc.pool.OracleDataSource. --David Ziggy O wrote: No mate that was the full stack trace. Thanks On Wed, Oct 1, 2008 at 7:02 PM, David Smith [EMAIL PROTECTED] wrote: Seems like such a generic error would have a root cause. Was there anything more to the stack trace? --David Ziggy O wrote: Hi, I am trying to connect to an oracle database but cant seem to get the jdbc connection to work. I am developing the application on a Windows desktop and transferring it onto a Unix box. When i test it on the Windows environmnet it does manage to connect but if i test it on unix then i get an error. My gut feeling is that the installation on the unix environment is missing a library but i cant figure out what it is. Here is how i am trying to get the jndi connection. [code] String fullname; if (jndiPrefix != null jndiPrefix.length() 0) fullname = jndiPrefix + datasource; else fullname = datasource; // JNDI Context ctx = null; DataSource ds = null; Connection conn = null; try { ctx = new InitialContext(); Context envContext = (Context)ctx.lookup(java:/comp/env); if (ctx != null) { ds = (DataSource)envContext.lookup(fullname); if (ds != null) { conn = ds.getConnection(); } } } [/code] And here is the Configuration. Context.xml (User and password modified) [code] Resource name=jdbc/theDb auth=Container type=javax.sql.DataSource driverClassName=oracle.jdbc.driver.OracleDriver url=jdbc:oracle:thin:@localhost:1521:webdev username=webuser password=webuser maxActive=20 maxIdle=10 maxWait=-1/ [/code] web.xml [code] resource-ref descriptionOracle Datasource/description res-ref-namejdbc/theDb/res-ref-name res-typeoracle.jdbc.pool.OracleDataSource/res-type res-authContainer/res-auth /resource-ref [/code] And here is the stack trace of the error [code] javax.naming.NamingException: Cannot create resource instance at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:143) at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source) at org.apache.naming.NamingContext.lookup(NamingContext.java:793) at org.apache.naming.NamingContext.lookup(NamingContext.java:140) at org.apache.naming.NamingContext.lookup(NamingContext.java:781) at org.apache.naming.NamingContext.lookup(NamingContext.java:153) at com.bt.ccs21.util.DbConnection.getJNDIConnection(DbConnection.java:334) at com.bt.ccs21.util.DbConnection.getJNDIConnection(DbConnection.java:256) at com.bt.ccs21.util.DbConnection.getJRunConnection(DbConnection.java:286) at com.bt.ccs21.presentation.events.admin.LogonActionPost.preAction(LogonActionPost.java:118) at com.bt.ccs21.presentation.events.CCS21EventAction.execute(CCS21EventAction.java:29) at org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58) at org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67) at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51) at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190) at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304) at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190) at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462) at javax.servlet.http.HttpServlet.service(HttpServlet.java:710
Re: javax.naming.NamingException: Cannot create resource instance
A bit more info which i think might be relevant. When i run it on my desktop i ran it directly from within Netbeans but when i run it on the Unix server i export the project as a war file (within netbeans) and copy it into the webapps directory on the Unix environment. Is it possible that netbeans is including some libraries that are not available on the Unix environment when i run it on the desktop? On Thu, Oct 2, 2008 at 1:48 PM, Ziggy O [EMAIL PROTECTED] wrote: Hi, The tomcat version on my Desktop is 5.5.27 and the Tomcat version on the Unix environment is 5.5.23. Could the above minor version difference cause it? One thing i have noticed is that if i take the /META-INF/Context.xml file and copy it into $CATALINA_HOME/conf/Catalina/localhost/testapp.xml it does work. i.e. why does it require the context file in that directory and why does it have to be renamed to my applications context. On the Windows environment i dont have to rename and copy the context file to $CATALINA_HOME/conf/Catalina/localhost Thanks On Thu, Oct 2, 2008 at 12:55 PM, David Smith [EMAIL PROTECTED] wrote: Ok... 1) I don't see a tomcat version, could you post that? 2) Are you sure the tomcat version on the production environment the same as your dev system? 3) This is probably not causing the immediate problem, but res-type ... /res-type in your web.xml should be javax.sql.Datasource, not oracle.jdbc.pool.OracleDataSource. --David Ziggy O wrote: No mate that was the full stack trace. Thanks On Wed, Oct 1, 2008 at 7:02 PM, David Smith [EMAIL PROTECTED] wrote: Seems like such a generic error would have a root cause. Was there anything more to the stack trace? --David Ziggy O wrote: Hi, I am trying to connect to an oracle database but cant seem to get the jdbc connection to work. I am developing the application on a Windows desktop and transferring it onto a Unix box. When i test it on the Windows environmnet it does manage to connect but if i test it on unix then i get an error. My gut feeling is that the installation on the unix environment is missing a library but i cant figure out what it is. Here is how i am trying to get the jndi connection. [code] String fullname; if (jndiPrefix != null jndiPrefix.length() 0) fullname = jndiPrefix + datasource; else fullname = datasource; // JNDI Context ctx = null; DataSource ds = null; Connection conn = null; try { ctx = new InitialContext(); Context envContext = (Context)ctx.lookup(java:/comp/env); if (ctx != null) { ds = (DataSource)envContext.lookup(fullname); if (ds != null) { conn = ds.getConnection(); } } } [/code] And here is the Configuration. Context.xml (User and password modified) [code] Resource name=jdbc/theDb auth=Container type=javax.sql.DataSource driverClassName=oracle.jdbc.driver.OracleDriver url=jdbc:oracle:thin:@localhost:1521:webdev username=webuser password=webuser maxActive=20 maxIdle=10 maxWait=-1/ [/code] web.xml [code] resource-ref descriptionOracle Datasource/description res-ref-namejdbc/theDb/res-ref-name res-typeoracle.jdbc.pool.OracleDataSource/res-type res-authContainer/res-auth /resource-ref [/code] And here is the stack trace of the error [code] javax.naming.NamingException: Cannot create resource instance at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:143) at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source) at org.apache.naming.NamingContext.lookup(NamingContext.java:793) at org.apache.naming.NamingContext.lookup(NamingContext.java:140) at org.apache.naming.NamingContext.lookup(NamingContext.java:781) at org.apache.naming.NamingContext.lookup(NamingContext.java:153) at com.bt.ccs21.util.DbConnection.getJNDIConnection(DbConnection.java:334) at com.bt.ccs21.util.DbConnection.getJNDIConnection(DbConnection.java:256) at com.bt.ccs21.util.DbConnection.getJRunConnection(DbConnection.java:286) at com.bt.ccs21.presentation.events.admin.LogonActionPost.preAction(LogonActionPost.java:118) at com.bt.ccs21.presentation.events.CCS21EventAction.execute(CCS21EventAction.java:29) at org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58) at org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67) at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51) at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190
Re: javax.naming.NamingException: Cannot create resource instance
Yes it looks like that fact it is named with uppercase C was the problem. I renamed it to context.xml and it finally worked. Thank you all for your help. On Thu, Oct 2, 2008 at 5:59 PM, David Smith [EMAIL PROTECTED] wrote: We have a winner! The Windows file system is one of the few (the only one I can think of) that's not case sensitive. Unix, linux, bsd, macos, etc. , ... are all case sensitive. You should change the file name 'Context.xml' to 'context.xml' and check to be sure it stays that way as you build your .war file. After that you won't need to have testapp.xml in conf/Catalina/localhost. Also you might want to check all the places in your webapp that references a file and be sure the names match in case to what's on disk. --David Ziggy O wrote: Hi, The tomcat version on my Desktop is 5.5.27 and the Tomcat version on the Unix environment is 5.5.23. Could the above minor version difference cause it? One thing i have noticed is that if i take the /META-INF/Context.xml file and copy it into $CATALINA_HOME/conf/Catalina/localhost/testapp.xml it does work. i.e. why does it require the context file in that directory and why does it have to be renamed to my applications context. On the Windows environment i dont have to rename and copy the context file to $CATALINA_HOME/conf/Catalina/localhost Thanks On Thu, Oct 2, 2008 at 12:55 PM, David Smith [EMAIL PROTECTED] wrote: Ok... 1) I don't see a tomcat version, could you post that? 2) Are you sure the tomcat version on the production environment the same as your dev system? 3) This is probably not causing the immediate problem, but res-type ... /res-type in your web.xml should be javax.sql.Datasource, not oracle.jdbc.pool.OracleDataSource. --David Ziggy O wrote: No mate that was the full stack trace. Thanks On Wed, Oct 1, 2008 at 7:02 PM, David Smith [EMAIL PROTECTED] wrote: Seems like such a generic error would have a root cause. Was there anything more to the stack trace? --David Ziggy O wrote: Hi, I am trying to connect to an oracle database but cant seem to get the jdbc connection to work. I am developing the application on a Windows desktop and transferring it onto a Unix box. When i test it on the Windows environmnet it does manage to connect but if i test it on unix then i get an error. My gut feeling is that the installation on the unix environment is missing a library but i cant figure out what it is. Here is how i am trying to get the jndi connection. [code] String fullname; if (jndiPrefix != null jndiPrefix.length() 0) fullname = jndiPrefix + datasource; else fullname = datasource; // JNDI Context ctx = null; DataSource ds = null; Connection conn = null; try { ctx = new InitialContext(); Context envContext = (Context)ctx.lookup(java:/comp/env); if (ctx != null) { ds = (DataSource)envContext.lookup(fullname); if (ds != null) { conn = ds.getConnection(); } } } [/code] And here is the Configuration. Context.xml (User and password modified) [code] Resource name=jdbc/theDb auth=Container type=javax.sql.DataSource driverClassName=oracle.jdbc.driver.OracleDriver url=jdbc:oracle:thin:@localhost:1521:webdev username=webuser password=webuser maxActive=20 maxIdle=10 maxWait=-1/ [/code] web.xml [code] resource-ref descriptionOracle Datasource/description res-ref-namejdbc/theDb/res-ref-name res-typeoracle.jdbc.pool.OracleDataSource/res-type res-authContainer/res-auth /resource-ref [/code] And here is the stack trace of the error [code] javax.naming.NamingException: Cannot create resource instance at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:143) at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source) at org.apache.naming.NamingContext.lookup(NamingContext.java:793) at org.apache.naming.NamingContext.lookup(NamingContext.java:140) at org.apache.naming.NamingContext.lookup(NamingContext.java:781) at org.apache.naming.NamingContext.lookup(NamingContext.java:153) at com.bt.ccs21.util.DbConnection.getJNDIConnection(DbConnection.java:334) at com.bt.ccs21.util.DbConnection.getJNDIConnection(DbConnection.java:256) at com.bt.ccs21.util.DbConnection.getJRunConnection(DbConnection.java:286) at com.bt.ccs21.presentation.events.admin.LogonActionPost.preAction(LogonActionPost.java:118) at com.bt.ccs21.presentation.events.CCS21EventAction.execute(CCS21EventAction.java:29) at org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58
javax.naming.NamingException: Cannot create resource instance
) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685) at java.lang.Thread.run(Unknown Source) /tmp/crmsauth.log.20081001 561 lines, 48080 characters 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) [/code] What i dont understand is why it works on the installation on the windows environment but not in the Unix environment. I check all the libraries and everything under common/lib is the same for both environments. Thanks Edited by: ziggy on Oct 1, 2008 3:48 PM Edited by: ziggy on Oct 1, 2008 3:50 PM
Re: javax.naming.NamingException: Cannot create resource instance
I forgot to mention that i am using Tomcat 5.5 on both the windows and unix environment. Thanks. On Wed, Oct 1, 2008 at 5:54 PM, Ziggy O [EMAIL PROTECTED] wrote: Hi, I am trying to connect to an oracle database but cant seem to get the jdbc connection to work. I am developing the application on a Windows desktop and transferring it onto a Unix box. When i test it on the Windows environmnet it does manage to connect but if i test it on unix then i get an error. My gut feeling is that the installation on the unix environment is missing a library but i cant figure out what it is. Here is how i am trying to get the jndi connection. [code] String fullname; if (jndiPrefix != null jndiPrefix.length() 0) fullname = jndiPrefix + datasource; else fullname = datasource; // JNDI Context ctx = null; DataSource ds = null; Connection conn = null; try { ctx = new InitialContext(); Context envContext = (Context)ctx.lookup(java:/comp/env); if (ctx != null) { ds = (DataSource)envContext.lookup(fullname); if (ds != null) { conn = ds.getConnection(); } } } [/code] And here is the Configuration. Context.xml (User and password modified) [code] Resource name=jdbc/theDb auth=Container type=javax.sql.DataSource driverClassName=oracle.jdbc.driver.OracleDriver url=jdbc:oracle:thin:@localhost:1521:webdev username=webuser password=webuser maxActive=20 maxIdle=10 maxWait=-1/ [/code] web.xml [code] resource-ref descriptionOracle Datasource/description res-ref-namejdbc/theDb/res-ref-name res-typeoracle.jdbc.pool.OracleDataSource/res-type res-authContainer/res-auth /resource-ref [/code] And here is the stack trace of the error [code] javax.naming.NamingException: Cannot create resource instance at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:143) at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source) at org.apache.naming.NamingContext.lookup(NamingContext.java:793) at org.apache.naming.NamingContext.lookup(NamingContext.java:140) at org.apache.naming.NamingContext.lookup(NamingContext.java:781) at org.apache.naming.NamingContext.lookup(NamingContext.java:153) at com.bt.ccs21.util.DbConnection.getJNDIConnection(DbConnection.java:334) at com.bt.ccs21.util.DbConnection.getJNDIConnection(DbConnection.java:256) at com.bt.ccs21.util.DbConnection.getJRunConnection(DbConnection.java:286) at com.bt.ccs21.presentation.events.admin.LogonActionPost.preAction(LogonActionPost.java:118) at com.bt.ccs21.presentation.events.CCS21EventAction.execute(CCS21EventAction.java:29) at org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58) at org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67) at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51) at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190) at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304) at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190) at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462) at javax.servlet.http.HttpServlet.service(HttpServlet.java:710) 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
Re: jdbc driver fails with tomcat
Hi, When i debug the code, it doesnt get to the point where i am initialising the OracleCallableStatement object. It failed just after the initialisation of the ArrayDescriptor object. I have tried to change it to use CallableStatement and im now getting another error. Here is how i've changed it to. CallableStatement cst = conn.prepareCall(stp.SUBMIT_CONSIGNMENT_STORED_PROC); ArrayDescriptor rectabDescriptor = ArrayDescriptor.createDescriptor(CCS21_CONSIGNMENTLIST_TYPE,conn); ARRAY awbNoHwbs = new ARRAY(rectabDescriptor,conn,childLessAwbs); ARRAY hwbs = new ARRAY(rectabDescriptor,conn,hwbList); context.xml Resource name=jdbc/ccs21db auth=Container type=javax.sql.DataSource driverClassName=oracle.jdbc.driver.OracleDriver url=jdbc:oracle:thin:@xxx.xxx.xxx:1525:dbsid username=xxx password=xxx maxActive=20 maxIdle=10 maxWait=-1/ web.xml resource-ref descriptionOracle Datasource/description res-ref-namejdbc/ccs21db/res-ref-name res-typeoracle.jdbc.pool.OracleDataSource/res-type res-authContainer/res-auth /resource-ref And here is the stack trace java.lang.ClassCastException: org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper at oracle.sql.ArrayDescriptor.createDescriptor(ArrayDescriptor.java:149) at oracle.sql.ArrayDescriptor.createDescriptor(ArrayDescriptor.java:115) at com.abbt.ccs21.data.accessors.ConsignmentDAO.submitDeclaration(ConsignmentDAO.java:301) at com.bt.abccs21.presentation.events.consignments.select.SubmitDeclaration.midAction(SubmitDeclaration.java:68) at com.bt.abccs21.presentation.events.CCS21EventAction.execute(CCS21EventAction.java:36) at org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58) at org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67) at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51) at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190) at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304) at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190) at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462) at javax.servlet.http.HttpServlet.service(HttpServlet.java:647) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) 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:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172) 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:174) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:875) 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:689) at java.lang.Thread.run(Thread.java:595) On Fri, Sep 26, 2008 at 5:57 PM, Christopher Schultz [EMAIL PROTECTED] wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Dini, Dini Omar wrote: I am trying to send an array to a pl/sql module but for some reason i am unable to get the connection object. Here is the line of code that fails [code] Connection conn = null; ArrayDescriptor rectabDescriptor = ArrayDescriptor.createDescriptor(CCS21_CONSIGNMENTLIST_TYPE,conn); It's odd that your exception says DelegatingCallableStatement (which is the actual type of the object being casted) when the line indicated neither performs a cast, nor does anything with a statement. Are you sure this is the right line number? FAILS HERE ARRAY awbNoHwbs = new ARRAY(rectabDescriptor,conn,childLessAwbs); ARRAY hwbs = new ARRAY(rectabDescriptor,conn,hwbList); OracleCallableStatement cst = (OracleCallableStatement)conn.prepareCall(stp.SUBMIT_CONSIGNMENT_STORED_PROC); I'm guessing that the above line is the one where the problem is really