tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Neven Cvetkovic <neven.cvetko...@gmail.com>
Subject Re: Trouble loading MS SQl Server database driver in Tomcat 7.0.37
Date Mon, 01 Apr 2013 22:28:31 GMT
Hey David,

I would suggest you create a sample application that will test the drivers,
and if the connection is OK, with no application deployed. If you are not a
developer, ask your developers on team to help you write a sample
application. It can be as simple as a single JSP page.

After you get through the database connection test, you will probably
notice that your transaction manager doesn't seem to work - you are using
JBossTransactionManagerLookup in your hibernate.cfg.xml file, e.g.

<property
name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>

Also, don't forget to remove the passwords (when posting to the list) in
the server.xml or context.xml file ... whichever you use :))

Let us know how that works!

Cheers!






On Mon, Apr 1, 2013 at 6:15 PM, <dvosbury1@aol.com> wrote:

>
> Hello,
>
> I have been tasked with moving an application from a JBoss application
> server to Tomcat 7. The application is using hibernate to establish a
> connection pool as I understand it. I've got Tomcat running under the
> standard ports and have deployed the application. The SQL Server .jar file
> is placed in the catalina_home/lib directory. The problem with getting the
> app to run correctly from the logs that I'm reading appears to be that the
> database driver isn't loading. I'm new to Tomcat so I might be
> misinterpreting this. I'm including a copy of Catalina.out and also my
> context.xml, and hibernate.cfg.xml files. Any help would be greatly
> appreciated.
>
> David Vosbury
>
> Apr 01, 2013 5:10:02 PM org.apache.catalina.core.AprLifecycleListener init
> INFO: The APR based Apache Tomcat Native library which allows optimal
> performance in production environments was not found on the
> java.library.path:
> /usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
> Apr 01, 2013 5:10:03 PM org.apache.coyote.AbstractProtocol init
> INFO: Initializing ProtocolHandler ["http-bio-8080"]
> Apr 01, 2013 5:10:03 PM org.apache.coyote.AbstractProtocol init
> INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
> Apr 01, 2013 5:10:03 PM org.apache.catalina.startup.Catalina load
> INFO: Initialization processed in 3249 ms
> Apr 01, 2013 5:10:03 PM org.apache.catalina.core.StandardService
> startInternal
> INFO: Starting service Catalina
> Apr 01, 2013 5:10:03 PM org.apache.catalina.core.StandardEngine
> startInternal
> INFO: Starting Servlet Engine: Apache Tomcat/7.0.37
> Apr 01, 2013 5:10:03 PM org.apache.catalina.startup.HostConfig
> deployDirectory
> INFO: Deploying web application directory
> /tomcat/tomcat1/apache-tomcat-7.0.37/webapps/host-manager
> Apr 01, 2013 5:10:05 PM org.apache.catalina.startup.HostConfig
> deployDirectory
> INFO: Deploying web application directory
> /tomcat/tomcat1/apache-tomcat-7.0.37/webapps/SystemsMadeSimple
> Apr 01, 2013 5:10:14 PM org.apache.catalina.startup.TaglibUriRule body
> INFO: TLD skipped. URI: http://struts.apache.org/tags-bean is already
> defined
> Apr 01, 2013 5:10:14 PM org.apache.catalina.startup.TaglibUriRule body
> INFO: TLD skipped. URI: http://struts.apache.org/tags-html is already
> defined
> Apr 01, 2013 5:10:15 PM org.apache.catalina.startup.TaglibUriRule body
> INFO: TLD skipped. URI: http://struts.apache.org/tags-logic is already
> defined
> Apr 01, 2013 5:10:15 PM org.apache.catalina.startup.TaglibUriRule body
> INFO: TLD skipped. URI: http://struts.apache.org/tags-nested is already
> defined
> Apr 01, 2013 5:10:15 PM org.apache.catalina.startup.TaglibUriRule body
> INFO: TLD skipped. URI: http://struts.apache.org/tags-tiles is already
> defined
> WebConfig Initialization Started
> @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
> Apr 01, 2013 5:10:17 PM org.hibernate.cfg.Environment <clinit>
> INFO: Hibernate 3.0.5
> Apr 01, 2013 5:10:17 PM org.hibernate.cfg.Environment <clinit>
> INFO: hibernate.properties not found
> Apr 01, 2013 5:10:17 PM org.hibernate.cfg.Environment <clinit>
> INFO: using CGLIB reflection optimizer
> Apr 01, 2013 5:10:17 PM org.hibernate.cfg.Environment <clinit>
> INFO: using JDK 1.4 java.sql.Timestamp handling
> Apr 01, 2013 5:10:17 PM org.hibernate.cfg.Configuration configure
> INFO: configuring from resource: /hibernate.cfg.xml
> Apr 01, 2013 5:10:17 PM org.hibernate.cfg.Configuration
> getConfigurationInputStream
> INFO: Configuration resource: /hibernate.cfg.xml
> Apr 01, 2013 5:10:17 PM org.hibernate.cfg.Configuration addResource
> INFO: Mapping resource: com/systemsmadesimple/hibernate/SMSuser.hbm.xml
> Apr 01, 2013 5:10:18 PM org.hibernate.cfg.HbmBinder
> bindRootPersistentClassCommonValues
> INFO: Mapping class: com.systemsmadesimple.hibernate.SMSuser -> SMSuser
> Apr 01, 2013 5:10:18 PM org.hibernate.cfg.Configuration addResource
> INFO: Mapping resource: com/systemsmadesimple/hibernate/News.hbm.xml
> Apr 01, 2013 5:10:18 PM org.hibernate.cfg.HbmBinder
> bindRootPersistentClassCommonValues
> INFO: Mapping class: com.systemsmadesimple.hibernate.News -> news
> Apr 01, 2013 5:10:18 PM org.hibernate.cfg.Configuration addResource
> INFO: Mapping resource: com/systemsmadesimple/hibernate/Staff.hbm.xml
> Apr 01, 2013 5:10:18 PM org.hibernate.cfg.HbmBinder
> bindRootPersistentClassCommonValues
> INFO: Mapping class: com.systemsmadesimple.hibernate.Staff -> staff
> Apr 01, 2013 5:10:18 PM org.hibernate.cfg.Configuration addResource
> INFO: Mapping resource: com/systemsmadesimple/hibernate/Contract.hbm.xml
> Apr 01, 2013 5:10:18 PM org.hibernate.cfg.HbmBinder
> bindRootPersistentClassCommonValues
> INFO: Mapping class: com.systemsmadesimple.hibernate.Contract -> contract
> Apr 01, 2013 5:10:18 PM org.hibernate.cfg.Configuration addResource
> INFO: Mapping resource:
> com/systemsmadesimple/hibernate/Philanthropy.hbm.xml
> Apr 01, 2013 5:10:18 PM org.hibernate.cfg.HbmBinder
> bindRootPersistentClassCommonValues
> INFO: Mapping class: com.systemsmadesimple.hibernate.Philanthropy ->
> philanthropy
> Apr 01, 2013 5:10:18 PM org.hibernate.cfg.Configuration addResource
> INFO: Mapping resource: com/systemsmadesimple/hibernate/Customer.hbm.xml
> Apr 01, 2013 5:10:18 PM org.hibernate.cfg.HbmBinder
> bindRootPersistentClassCommonValues
> INFO: Mapping class: com.systemsmadesimple.hibernate.Customer -> customer
> Apr 01, 2013 5:10:18 PM org.hibernate.cfg.Configuration addResource
> INFO: Mapping resource: com/systemsmadesimple/hibernate/Service.hbm.xml
> Apr 01, 2013 5:10:19 PM org.hibernate.cfg.HbmBinder
> bindRootPersistentClassCommonValues
> INFO: Mapping class: com.systemsmadesimple.hibernate.Service -> service
> Apr 01, 2013 5:10:19 PM org.hibernate.cfg.Configuration doConfigure
> INFO: Configured SessionFactory: null
> Apr 01, 2013 5:10:19 PM org.hibernate.cfg.Configuration secondPassCompile
> INFO: processing extends queue
> Apr 01, 2013 5:10:19 PM org.hibernate.cfg.Configuration secondPassCompile
> INFO: processing collection mappings
> Apr 01, 2013 5:10:19 PM org.hibernate.cfg.Configuration secondPassCompile
> INFO: processing association property references
> Apr 01, 2013 5:10:19 PM org.hibernate.cfg.Configuration secondPassCompile
> INFO: processing foreign key constraints
> Apr 01, 2013 5:10:19 PM org.hibernate.util.NamingHelper getInitialContext
> INFO: JNDI InitialContext properties:{}
> Apr 01, 2013 5:10:19 PM
> org.hibernate.connection.DatasourceConnectionProvider configure
> INFO: Using datasource: java:comp/env/jdbc/smswebdb
> Apr 01, 2013 5:10:19 PM org.hibernate.cfg.SettingsFactory buildSettings
> WARNING: Could not obtain connection metadata
> org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver
> of class '' for connect URL 'jdbc:sqlserver://10.2.152.11:1433
> ;databaseName=SMSwebDB;SelectMethod=Cursor;'
>         at
> org.apache.tomcat.dbcp.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1452)
>         at
> org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371)
>         at
> org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
>         at
> org.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:59)
>         at
> org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:72)
>         at
> org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1463)
>         at
> org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1004)
>         at
> com.systemsmadesimple.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:43)
>         at
> com.systemsmadesimple.hibernate.DatabaseManager.getDbInfo(DatabaseManager.java:23)
>         at
> com.systemsmadesimple.struts.WebConfig.initialize(WebConfig.java:40)
>         at
> com.systemsmadesimple.ServletInitializer.init(ServletInitializer.java:92)
>         at javax.servlet.GenericServlet.init(GenericServlet.java:160)
>         at
> org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1280)
>         at
> org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1193)
>         at
> org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1088)
>         at
> org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5033)
>         at
> org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5317)
>         at
> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
>         at
> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
>         at
> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
>         at
> org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
>         at
> org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1114)
>         at
> org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1673)
>         at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
>         at
> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
>         at java.util.concurrent.FutureTask.run(FutureTask.java:166)
>         at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>         at java.lang.Thread.run(Thread.java:722)
> Caused by: java.sql.SQLException: No suitable driver
>         at java.sql.DriverManager.getDriver(DriverManager.java:289)
>         at
> org.apache.tomcat.dbcp.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1437)
>         ... 28 more
>
> Apr 01, 2013 5:10:19 PM org.hibernate.dialect.Dialect <init>
> INFO: Using dialect: org.hibernate.dialect.SQLServerDialect
> Apr 01, 2013 5:10:19 PM
> org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
> INFO: Transaction strategy: org.hibernate.transaction.JTATransactionFactory
> Apr 01, 2013 5:10:19 PM org.hibernate.util.NamingHelper getInitialContext
> INFO: JNDI InitialContext properties:{}
> Apr 01, 2013 5:10:19 PM
> org.hibernate.transaction.TransactionManagerLookupFactory
> getTransactionManagerLookup
> INFO: instantiating TransactionManagerLookup:
> org.hibernate.transaction.JBossTransactionManagerLookup
> Apr 01, 2013 5:10:19 PM
> org.hibernate.transaction.TransactionManagerLookupFactory
> getTransactionManagerLookup
> INFO: instantiated TransactionManagerLookup
> Apr 01, 2013 5:10:19 PM
> org.hibernate.transaction.TransactionManagerLookupFactory
> getTransactionManagerLookup
> INFO: instantiating TransactionManagerLookup:
> org.hibernate.transaction.JBossTransactionManagerLookup
> Apr 01, 2013 5:10:19 PM
> org.hibernate.transaction.TransactionManagerLookupFactory
> getTransactionManagerLookup
> INFO: instantiated TransactionManagerLookup
> Apr 01, 2013 5:10:19 PM org.hibernate.cfg.SettingsFactory buildSettings
> INFO: Automatic flush during beforeCompletion(): disabled
> Apr 01, 2013 5:10:19 PM org.hibernate.cfg.SettingsFactory buildSettings
> INFO: Automatic session close at end of transaction: disabled
> Apr 01, 2013 5:10:19 PM org.hibernate.cfg.SettingsFactory buildSettings
> INFO: Scrollable result sets: disabled
> Apr 01, 2013 5:10:19 PM org.hibernate.cfg.SettingsFactory buildSettings
> INFO: JDBC3 getGeneratedKeys(): disabled
> Apr 01, 2013 5:10:19 PM org.hibernate.cfg.SettingsFactory buildSettings
> INFO: Connection release mode: null
> Apr 01, 2013 5:10:19 PM org.hibernate.cfg.SettingsFactory buildSettings
> INFO: Default schema: SMSWebDB
> Apr 01, 2013 5:10:19 PM org.hibernate.cfg.SettingsFactory buildSettings
> INFO: Default batch fetch size: 1
> Apr 01, 2013 5:10:19 PM org.hibernate.cfg.SettingsFactory buildSettings
> INFO: Generate SQL with comments: disabled
> Apr 01, 2013 5:10:19 PM org.hibernate.cfg.SettingsFactory buildSettings
> INFO: Order SQL updates by primary key: disabled
> Apr 01, 2013 5:10:19 PM org.hibernate.cfg.SettingsFactory
> createQueryTranslatorFactory
> INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
> Apr 01, 2013 5:10:19 PM org.hibernate.hql.ast.ASTQueryTranslatorFactory
> <init>
> INFO: Using ASTQueryTranslatorFactory
> Apr 01, 2013 5:10:19 PM org.hibernate.cfg.SettingsFactory buildSettings
> INFO: Query language substitutions: {}
> Apr 01, 2013 5:10:19 PM org.hibernate.cfg.SettingsFactory buildSettings
> INFO: Second-level cache: enabled
> Apr 01, 2013 5:10:19 PM org.hibernate.cfg.SettingsFactory buildSettings
> INFO: Query cache: enabled
> Apr 01, 2013 5:10:20 PM org.hibernate.cfg.SettingsFactory
> createCacheProvider
> INFO: Cache provider: org.hibernate.cache.EhCacheProvider
> Apr 01, 2013 5:10:20 PM org.hibernate.cfg.SettingsFactory buildSettings
> INFO: Optimize cache for minimal puts: disabled
> Apr 01, 2013 5:10:20 PM org.hibernate.cfg.SettingsFactory buildSettings
> INFO: Structured second-level cache entries: disabled
> Apr 01, 2013 5:10:20 PM org.hibernate.cfg.SettingsFactory
> createQueryCacheFactory
> INFO: Query cache factory: org.hibernate.cache.StandardQueryCacheFactory
> Apr 01, 2013 5:10:20 PM org.hibernate.cfg.SettingsFactory buildSettings
> INFO: Statistics: disabled
> Apr 01, 2013 5:10:20 PM org.hibernate.cfg.SettingsFactory buildSettings
> INFO: Deleted entity synthetic identifier rollback: disabled
> Apr 01, 2013 5:10:20 PM org.hibernate.cfg.SettingsFactory buildSettings
> INFO: Default entity-mode: pojo
> NewsServlet started
> Apr 01, 2013 5:10:20 PM org.apache.catalina.startup.HostConfig
> deployDirectory
> INFO: Deploying web application directory
> /tomcat/tomcat1/apache-tomcat-7.0.37/webapps/manager
> Apr 01, 2013 5:10:20 PM org.apache.catalina.startup.HostConfig
> deployDirectory
> INFO: Deploying web application directory
> /tomcat/tomcat1/apache-tomcat-7.0.37/webapps/ROOT
> Apr 01, 2013 5:10:21 PM org.apache.coyote.AbstractProtocol start
> INFO: Starting ProtocolHandler ["http-bio-8080"]
> Apr 01, 2013 5:10:21 PM org.apache.coyote.AbstractProtocol start
> INFO: Starting ProtocolHandler ["ajp-bio-8009"]
> Apr 01, 2013 5:10:21 PM org.apache.catalina.startup.Catalina start
> INFO: Server startup in 18035 ms
> HOME >> reinitializing data
> Apr 01, 2013 5:11:30 PM org.apache.jasper.compiler.TldLocationsCache
> tldScanJar
> INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable
> debug logging for this logger for a complete list of JARs that were scanned
> but no TLDs were found in them. Skipping unneeded JARs during scanning can
> improve star
> tup time and JSP compilation time.
> HOME >> reinitializing data
>
> Contents of context.xml
>
> <?xml version='1.0' encoding='utf-8'?>
> <!--
>   Licensed to the Apache Software Foundation (ASF) under one or more
>   contributor license agreements.  See the NOTICE file distributed with
>   this work for additional information regarding copyright ownership.
>   The ASF licenses this file to You under the Apache License, Version 2.0
>   (the "License"); you may not use this file except in compliance with
>   the License.  You may obtain a copy of the License at
>
>       http://www.apache.org/licenses/LICENSE-2.0
>
>   Unless required by applicable law or agreed to in writing, software
>   distributed under the License is distributed on an "AS IS" BASIS,
>   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
>   See the License for the specific language governing permissions and
>   limitations under the License.
> -->
> <!-- The contents of this file will be loaded for each web application -->
> <Context>
>
>     <!-- Default set of monitored resources -->
>     <WatchedResource>WEB-INF/web.xml</WatchedResource>
>
>     <!-- Uncomment this to disable session persistence across Tomcat
> restarts -->
>     <!--
>     <Manager pathname="" />
>     -->
>
>     <!-- Uncomment this to enable Comet connection tacking (provides events
>          on session expiration as well as webapp lifecycle) -->
>     <!--
>     <Valve
> className="org.apache.catalina.valves.CometConnectionManagerValve" />
>     -->
>    <Resource name="jdbc/smswebdb"
>             auth="Container"
>             driverclassname="com.microsoft.sqlserver.jdbc.SQLServerDriver"
>             maxactive="100"
>             maxidle="30"
>             maxwait="10000"
>             username="SMSWEB_user"
>             password="SMSWP*D#1AHqX1"
>             type="javax.sql.DataSource"
>             url="jdbc:sqlserver://10.2.152.11:1433
> ;databaseName=SMSwebDB;SelectMethod=Cursor;">
>     </Resource>
>
> <!--    <resource-ref>
>         <description>
>           Resource reference to a factory for java.sql.Connection
>           instances that may be used for talking to the database
>           that is configured in context.xml.
>         </description>
>         <res-ref-name>jdbc/smswebdb</res-ref-name>
>         <res-type>javax.sql.DataSource</res-type>
>         <res-auth>Container</res-auth>
>       </resource-ref>
>  -->
> </Context>
>
> <?xml version='1.0' encoding='UTF-8'?>
> <!DOCTYPE hibernate-configuration PUBLIC
>           "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
>           "
> http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
>
> <!-- Generated by MyEclipse Hibernate Tools.                   -->
> <hibernate-configuration>
>
>     <session-factory>
>                 <property
> name="connection.datasource">java:comp/env/jdbc/smswebdb</property>
>                 <property name="default_schema">SMSWebDB</property>
>                 <property
> name="dialect">org.hibernate.dialect.SQLServerDialect</property>
>                 <property
> name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
>                 <property
> name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
>
>             <property name="hibernate.show_sql">false</property>
>
>                 <!-- Configure L2 cache -->
>                 <property
> name="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</property>
>                 <!--            <property
> name="hibernate.cache.provider_class">net.sf.ehcache.hibernate.EhCacheProvider</property>
> -->
>                 <property
> name="hibernate.cache.use_second_level_cache">true</property>
>                 <property
> name="hibernate.cache.use_query_cache">true</property>
>
>                 <mapping
> resource="com/systemsmadesimple/hibernate/SMSuser.hbm.xml" />
>                 <mapping
> resource="com/systemsmadesimple/hibernate/News.hbm.xml" />
>                 <mapping
> resource="com/systemsmadesimple/hibernate/Staff.hbm.xml" />
>                 <mapping
> resource="com/systemsmadesimple/hibernate/Contract.hbm.xml" />
>                 <mapping
> resource="com/systemsmadesimple/hibernate/Philanthropy.hbm.xml" />
>                 <mapping
> resource="com/systemsmadesimple/hibernate/Customer.hbm.xml" />
>                 <mapping
> resource="com/systemsmadesimple/hibernate/Service.hbm.xml" />
>
>
>     </session-factory>
>
> </hibernate-configuration>
>
>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message