Re: Connecting Tomcat to a database
Hi. Am 10.07.2010 06:15, schrieb Caldarale, Charles R: From: Christian Bruckhoff [mailto:christian.bruckh...@gmx.de] Subject: Re: Connecting Tomcat to a database ERROR - GeronimoLog.error(108) | Failed to resolved external DataSource at java:comp/env/jdbc/TestDB. javax.naming.NameNotFoundException: Name jdbc is not bound in this Context Any idea, what's wrong? I downloaded and installed ODE on Tomcat 7, configured it for MySQL, and was able to reproduce the above error. (Contrary to popular belief, there is no space in the error message - that was just a figment of whatever transposition mechanism the OP used. The grammar in the message is flawed, though.) Luckily, there's an easy fix (or at least a workaround): get rid of the original .war file. Once Tomcat has expanded ode.war into the ode directory, the .war file is no longer needed, and in fact is somehow interfering with the use of the directory. Deleting the .war (or changing the extension) lets the META-INF/context.xml file get processed, thus defining the JNDI data source. The same effect can be achieved by placing theContext element in conf/Catalina/[host]/ode.xml, which will override any in META-INF/context.xml (in either the .war file or the directory). I have no idea if things are supposed to work this way, or if this is a bug in Tomcat 7 (haven't tried ODE on any other version). Perhaps the lack of a context.xml file inside META-INF of the .war causes Tomcat to ignore the one in the expanded directory. I tried it that way and at least it seems, as if tomcat recognizes the database. But now, I get another error (see end of message). Do I have to import the ODE schema even if I want to use the database for ODE external data? As a side note, I found two problems with the ODE 2.0 beta: 1) It doesn't shut down properly. You can't use Tomcat's shutdown.bat (or .sh) script to stop Tomcat, since ODE starts extra threads and fails to terminate them when the webapp is being stopped. You can use a signal (CTRL-c on Windows) to get the JVM to shutdown cleanly. Better then the bugs, happening with 1.x :-D 2) The ODE instructions specify the wrong name for the SQL script to initialize the database; it should be sql/mysql.sql, not ode_openjpa_mysql-1.3.2.sql (the latter appears to be some ancient name). Can't find this location. :-( Do I have to change something there? Greetings Christian --- C:\Eigene Dateien\Downloads\Diplomarbeit\Evtl. neue Entwicklungsumgebung\apache- tomcat-7.0.0-ode2DB\bincatalina run Using CATALINA_BASE: C:\Eigene Dateien\Downloads\Diplomarbeit\Evtl. neue Entw icklungsumgebung\apache-tomcat-7.0.0-ode2DB Using CATALINA_HOME: C:\Eigene Dateien\Downloads\Diplomarbeit\Evtl. neue Entw icklungsumgebung\apache-tomcat-7.0.0-ode2DB Using CATALINA_TMPDIR: C:\Eigene Dateien\Downloads\Diplomarbeit\Evtl. neue Entw icklungsumgebung\apache-tomcat-7.0.0-ode2DB\temp Using JRE_HOME:C:\Programme\Java\jdk1.6.0_20 Using CLASSPATH: C:\Eigene Dateien\Downloads\Diplomarbeit\Evtl. neue Entw icklungsumgebung\apache-tomcat-7.0.0-ode2DB\bin\bootstrap.jar;C:\Eigene Dateien\ Downloads\Diplomarbeit\Evtl. neue Entwicklungsumgebung\apache-tomcat-7.0.0-ode2D B\bin\tomcat-juli.jar 12.07.2010 10:55:50 org.apache.catalina.core.AprLifecycleListener init INFO: Loaded APR based Apache Tomcat Native library 1.1.20. 12.07.2010 10:55:50 org.apache.catalina.core.AprLifecycleListener init INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], ra ndom [true]. 12.07.2010 10:55:54 org.apache.catalina.startup.Catalina load INFO: Initialization processed in 5583 ms 12.07.2010 10:55:54 org.apache.catalina.core.StandardService startInternal INFO: Starting service Catalina 12.07.2010 10:55:54 org.apache.catalina.core.StandardEngine startInternal INFO: Starting Servlet Engine: Apache Tomcat/7.0.0 12.07.2010 10:55:55 org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory docs 12.07.2010 10:55:55 org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory examples 12.07.2010 10:55:56 org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory host-manager 12.07.2010 10:55:56 org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory manager 12.07.2010 10:55:56 org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory ode DEBUG - GeronimoLog.debug(66) | Loading properties DEBUG - GeronimoLog.debug(66) | Initializing transaction manager DEBUG - GeronimoLog.debug(66) | Initializing transaction manager using org.apach e.ode.il.EmbeddedGeronimoFactory DEBUG - GeronimoLog.debug(66) | Creating data source. DEBUG - GeronimoLog.debug(66) | Starting DAO. INFO - GeronimoLog.info(79) | Using DAO Connection Factory class org.apache.ode. dao.jpa.BPELDAOConnectionFactoryImpl. DEBUG
Re: Connecting Tomcat to a database
Hi. Am 08.07.2010 23:36, schrieb Caldarale, Charles R: From: Christian Bruckhoff [mailto:christian.bruckh...@gmx.de] Subject: Re: Connecting Tomcat to a database Sorry was in a haste, forgot much more than this. :-/ - Tomcat 7.0.0 - Java 1.6 Update 20 - Windows XP SP3 - Wanted to use DB for Apache ODE 2.0 Beta That's how it was shown here: http://ode.apache.org/war-deployment.html Most unfortunate that they're suggesting very, very out of date practices. Put the MySQL JDBC driver in Tomcat's lib directory, not common/lib (that was changed quite some time ago). Place the followingContext element in webapps/ode/META-INF/context.xml: Context reloadable=true crossContext=true Resource name=jdbc/ODEDB auth=Container type=javax.sql.DataSource maxActive=100 maxIdle=30 maxWait=1 username=root password= driverClassName=com.mysql.jdbc.Driver url=jdbc:mysql://localhost:3306/ode?autoReconnect=true/ /Context I did and modified it to my database: ?xml version=1.0 encoding=UTF-8? Context reloadable=true crossContext=true Resource name=jdbc/TestDB auth=Container type=javax.sql.DataSource maxActive=100 maxIdle=30 maxWait=1 username=test_dab password=moep driverClassName=com.mysql.jdbc.Driver url=jdbc:mysql://mysqlhost.uni-koblenz.de:3306/TestDB?autoReconnect=true/ /Context I also edited ode-axis2.properties to ode-axis2.db.mode=EXTERNAL ode-axis2.db.ext.dataSource=java:comp/env/jdbc/TestDB after this, I get the this error log: 09.07.2010 08:59:04 org.apache.catalina.core.AprLifecycleListener init INFO: Loaded APR based Apache Tomcat Native library 1.1.20. 09.07.2010 08:59:04 org.apache.catalina.core.AprLifecycleListener init INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], ra ndom [true]. 09.07.2010 08:59:05 org.apache.catalina.startup.Catalina load INFO: Initialization processed in 1235 ms 09.07.2010 08:59:05 org.apache.catalina.core.StandardService startInternal INFO: Starting service Catalina 09.07.2010 08:59:05 org.apache.catalina.core.StandardEngine startInternal INFO: Starting Servlet Engine: Apache Tomcat/7.0.0 09.07.2010 08:59:05 org.apache.catalina.startup.HostConfig deployWAR INFO: Deploying web application archive ode.war DEBUG - GeronimoLog.debug(66) | Loading properties DEBUG - GeronimoLog.debug(66) | Initializing transaction manager DEBUG - GeronimoLog.debug(66) | Initializing transaction manager using org.apach e.ode.il.EmbeddedGeronimoFactory DEBUG - GeronimoLog.debug(66) | Creating data source. ERROR - GeronimoLog.error(108) | Failed to resolved external DataSource at java :comp/env/jdbc/TestDB. javax.naming.NameNotFoundException: Name jdbc is not bound in this Context at org.apache.naming.NamingContext.lookup(NamingContext.java:774) at org.apache.naming.NamingContext.lookup(NamingContext.java:144) at org.apache.naming.NamingContext.lookup(NamingContext.java:785) at org.apache.naming.NamingContext.lookup(NamingContext.java:144) at org.apache.naming.NamingContext.lookup(NamingContext.java:785) at org.apache.naming.NamingContext.lookup(NamingContext.java:157) at org.apache.naming.SelectorContext.lookup(SelectorContext.java:156) at javax.naming.InitialContext.lookup(InitialContext.java:392) at org.apache.ode.il.dbutil.Database.lookupInJndi(Database.java:244) at org.apache.ode.il.dbutil.Database.initExternalDb(Database.java:159) at org.apache.ode.il.dbutil.Database.initDataSource(Database.java:144) at org.apache.ode.il.dbutil.Database.start(Database.java:99) at org.apache.ode.axis2.ODEServer.initDataSource(ODEServer.java:218) at org.apache.ode.axis2.ODEServer.init(ODEServer.java:157) at org.apache.ode.axis2.ODEServer.init(ODEServer.java:116) at org.apache.ode.axis2.hooks.ODEAxisServlet.init(ODEAxisServlet.java:53 ) at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper. java:1164) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper. java:1118) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:10 05) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContex t.java:4529) at org.apache.catalina.core.StandardContext.startInternal(StandardContex t.java:4800) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:138) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase .java:785) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:76 3) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:558
Connecting Tomcat to a database
Hi. I need t connect Tomcat to a database, I want to use with ODE. Therefor, I changed the configuration decribed in [1] to server.xml (inside the Host-Element): -- Context path=/TestDB docBase=TestDB debug=5 reloadable=true crossContext=true Resource name=jdbc/TestDB auth=Container type=javax.sql.DataSource7 maxActive=100 maxIdle=30 maxWait=1 username=test_dab password=moep driverClassName=com.mysql.jdbc.Driver url=jdbc:mysql://mysqlhost.uni-koblenz.de/TestDB/ /Context ode-axis2.properties: - ode-axis2.db.mode=EXTERNAL ode-axis2.db.ext.dataSource=java:comp/env/jdbc/TestDB After I did this, Tomcat didn't work anymore. I even can't debug it, because the Tomcat window dissapears to fast. Can you help me? Greetz Christian - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Connecting Tomcat to a database
Hi. Am 08.07.2010 20:50, schrieb Caldarale, Charles R: From: Christian Bruckhoff [mailto:christian.bruckh...@gmx.de] Subject: Connecting Tomcat to a database I need t connect Tomcat to a database What version of Tomcat? What JVM? What platform are you running Tomcat on? Sorry was in a haste, forgot much more than this. :-/ - Tomcat 7.0.0 - Java 1.6 Update 20 - Windows XP SP3 - Wanted to use DB for Apache ODE 2.0 Beta server.xml (inside theHost-Element): -- Context path=/TestDB docBase=TestDB debug=5 reloadable=true Extremely bad practice to putContext elements in server.xml. The proper location is in the webapp's META-INF/context.xml file. When you do so, remove the path and docBase attributes, since they're not allowed when you haveContext in a proper location. Also, the debug attribute hasn't been used in years, so get rid of that as well. That's how it was shown here: http://ode.apache.org/war-deployment.html (that was [1] btw). What's the best solution for this? Resource name=jdbc/TestDB auth=Container type=javax.sql.DataSource7 What's that 7 hanging on the end? May I typed it while pasting it into the message, but in the code there's no 7. After I did this, Tomcat didn't work anymore. I even can't debug it, because the Tomcat window dissapears to fast. Look in the Tomcat logs. Also start Tomcat with catalina.bat run (or catalina.sh run, depending on the platform - which you didn't tell us); this will run Tomcat in the current command window. Where can I find them? startup.bat run didn't work. Tomcat is still started in another window. Greeting Christian - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org