-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 posts ] 
Author Message
 Post subject: tomcat hibernate startup slow
PostPosted: Wed May 17, 2006 7:03 am 
Newbie

Joined: Thu Apr 06, 2006 4:38 am
Posts: 7
I have a question when I startup the tomcat,
I am using tomcat5, hibernate, mysql to build my web apps
I have 3 web apps, the problem that I have is when I startup the tomcat, the follow message will show in the log,


-------------------------------------------------------------------------------
0 [main] INFO org.hibernate.cfg.Environment - Hibernate 3.0.5
0 [main] INFO org.hibernate.cfg.Environment - hibernate.properties not found
0 [main] INFO org.hibernate.cfg.Environment - using CGLIB reflection optimizer
0 [main] INFO org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling
172 [main] INFO org.hibernate.cfg.Configuration - configuring from resource: /hibernate.cfg.xml
172 [main] INFO org.hibernate.cfg.Configuration - Configuration resource: /hibernate.cfg.xml
...
359 [main] INFO org.hibernate.cfg.Configuration - Mapping resource: com/xxx/hibernate/xxxx.hbm.xml
531 [main] INFO org.hibernate.cfg.HbmBinder - Mapping class: com.xxx.hibernate.xxx -> xxx
(show for each database table)
...
1047 [main] INFO org.hibernate.cfg.Configuration - Configured SessionFactory: null
1047 [main] INFO org.hibernate.cfg.Configuration - processing extends queue
1047 [main] INFO org.hibernate.cfg.Configuration - processing collection mappings
1047 [main] INFO org.hibernate.cfg.HbmBinder - Mapping collection: com.xxx.hibernate.CorpnetCompanies.xxx -> xxx
1047 [main] INFO org.hibernate.cfg.HbmBinder - Mapping collection: com.xxx.hibernate.CorpnetCompanies.xxx -> xxx
1047 [main] INFO org.hibernate.cfg.Configuration - processing association property references
1047 [main] INFO org.hibernate.cfg.Configuration - processing foreign key constraints
1469 [main] INFO org.hibernate.connection.C3P0ConnectionProvider - C3P0 using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://127.0.0.1/xxx?useUnicode=true
1469 [main] INFO org.hibernate.connection.C3P0ConnectionProvider - Connection properties: {user=xxx, password=****}
1469 [main] INFO org.hibernate.connection.C3P0ConnectionProvider - autocommit mode: false
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@ebf3f0 [ connectionPoolDataSource -> com.mchange.v2.c3p0.WrapperConnectionPoolDataSource@9af0b1 [ acquireIncrement -> 2, autoCommitOnClose -> false, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, idleConnectionTestPeriod -> 300, initialPoolSize -> 3, maxIdleTime -> 0, maxPoolSize -> 5, maxStatements -> 100, minPoolSize -> 3, nestedDataSource -> com.mchange.v2.c3p0.DriverManagerDataSource@dc4c81 [ description -> null, driverClass -> null, factoryClassLocation -> null, jdbcUrl -> jdbc:mysql://127.0.0.1/xxx?useUnicode=true, properties -> {user=admin, password=obey} ] , propertyCycle -> 300, testConnectionOnCheckout -> false ] , factoryClassLocation -> null, numHelperThreads -> 3 ]
2031 [main] INFO org.hibernate.cfg.SettingsFactory - RDBMS: MySQL, version: 4.1.16-nt
2031 [main] INFO org.hibernate.cfg.SettingsFactory - JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-3.1.10 ( $Date: 2005/05/19 15:52:23 $, $Revision: 1.1.2.2 $ )
2078 [main] INFO org.hibernate.dialect.Dialect - Using dialect: org.hibernate.dialect.MySQLDialect
2094 [main] INFO org.hibernate.transaction.TransactionFactoryFactory - Using default transaction strategy (direct JDBC transactions)
2109 [main] INFO org.hibernate.transaction.TransactionManagerLookupFactory - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
2109 [main] INFO org.hibernate.cfg.SettingsFactory - Automatic flush during beforeCompletion(): disabled
2109 [main] INFO org.hibernate.cfg.SettingsFactory - Automatic session close at end of transaction: disabled
2109 [main] INFO org.hibernate.cfg.SettingsFactory - JDBC batch size: 15
2109 [main] INFO org.hibernate.cfg.SettingsFactory - JDBC batch updates for versioned data: disabled
2109 [main] INFO org.hibernate.cfg.SettingsFactory - Scrollable result sets: enabled
2109 [main] INFO org.hibernate.cfg.SettingsFactory - JDBC3 getGeneratedKeys(): enabled
2109 [main] INFO org.hibernate.cfg.SettingsFactory - Connection release mode: null
2109 [main] INFO org.hibernate.cfg.SettingsFactory - Maximum outer join fetch depth: 3
2109 [main] INFO org.hibernate.cfg.SettingsFactory - Default batch fetch size: 1
2109 [main] INFO org.hibernate.cfg.SettingsFactory - Generate SQL with comments: disabled
2109 [main] INFO org.hibernate.cfg.SettingsFactory - Order SQL updates by primary key: disabled
2109 [main] INFO org.hibernate.cfg.SettingsFactory - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
2125 [main] INFO org.hibernate.hql.ast.ASTQueryTranslatorFactory - Using ASTQueryTranslatorFactory
2125 [main] INFO org.hibernate.cfg.SettingsFactory - Query language substitutions: {}
2125 [main] INFO org.hibernate.cfg.SettingsFactory - Second-level cache: enabled
2125 [main] INFO org.hibernate.cfg.SettingsFactory - Query cache: disabled
2125 [main] INFO org.hibernate.cfg.SettingsFactory - Cache provider: org.hibernate.cache.NoCacheProvider
2125 [main] INFO org.hibernate.cfg.SettingsFactory - Optimize cache for minimal puts: disabled
2125 [main] INFO org.hibernate.cfg.SettingsFactory - Structured second-level cache entries: disabled
2156 [main] INFO org.hibernate.cfg.SettingsFactory - Echoing all SQL to stdout
2156 [main] INFO org.hibernate.cfg.SettingsFactory - Statistics: disabled
2156 [main] INFO org.hibernate.cfg.SettingsFactory - Deleted entity synthetic identifier rollback: disabled
2156 [main] INFO org.hibernate.cfg.SettingsFactory - Default entity-mode: pojo
2219 [main] INFO org.hibernate.impl.SessionFactoryImpl - building session factory
3219 [main] INFO org.hibernate.impl.SessionFactoryObjectFactory - Factory name: xxxSF
3219 [main] INFO org.hibernate.util.NamingHelper - JNDI InitialContext properties:{}
3234 [main] INFO org.hibernate.impl.SessionFactoryObjectFactory - Bound factory to JNDI name: xxxSF
3234 [main] WARN org.hibernate.impl.SessionFactoryObjectFactory - InitialContext did not implement EventContext
3234 [main] INFO org.hibernate.impl.SessionFactoryImpl - Checking 0 named queries
4203 [main] INFO org.apache.struts.tiles.TilesPlugin - Tiles definition factory loaded for module ''.
2006¦~5¤ë17¤é ¤U¤È06:16:40 org.apache.catalina.core.ApplicationContext log
-----------------------------------------------------------------


when I deploy 1 app, it will show two time in the log for the app,
when I deploy 2 apps, it will show three time in the log for each app,
when I deploy 3 apps, it will show four time in the log for each app,
...
therefore the startup time will get very slow, but all apps work fine after startup.

is there anyone know why, plx help!!!


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 17, 2006 12:33 pm 
Proxool Developer
Proxool Developer

Joined: Tue Aug 26, 2003 10:42 am
Posts: 373
Location: Belgium
Don't see where there is a problem... This is normal Hibernate startup. This will happen once for every application you deploy in your Tomcat - three times in your case.

You can still turnoff logging for Hibernate if you want to get rid of it (go from INFO to WARN or ERROR)...

Did I miss something ?


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 17, 2006 9:23 pm 
Newbie

Joined: Thu Apr 06, 2006 4:38 am
Posts: 7
but when I deploy 3 apps, it will show 12 time in the log, which is 4 time for each app.
when I deploy 4 apps, it will show 20 time, 5 time for each app.

is it normal?


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 17, 2006 10:53 pm 
Newbie

Joined: Thu Apr 06, 2006 4:38 am
Posts: 7
I just find out something,
the above message appear over and over again because I put
<listener>
<listener-class>com.xxx.hibernate.HibernateListener</listener-class>
</listener>
in my web.xml for all apps and HibernateListenser call HibernateUtil.getSessionFactory(); everytime it run the listenser.


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 18, 2006 4:56 am 
Proxool Developer
Proxool Developer

Joined: Tue Aug 26, 2003 10:42 am
Posts: 373
Location: Belgium
chun499 wrote:
I just find out something,
the above message appear over and over again because I put
<listener>
<listener-class>com.xxx.hibernate.HibernateListener</listener-class>
</listener>
in my web.xml for all apps and HibernateListenser call HibernateUtil.getSessionFactory(); everytime it run the listenser.


You shouldn't have this problem.

The listener is defined in your apps' web.xml - so it is private to this particular application.
Although your HibernateUtil probably contains a bunch of static methods and var, each application is isolated from the other (by means of different classloader). Therefore, initialization of one shouldn't affect the other.

However, it seems the behavior varies depending on the number of applications you deploy. Are you 100% sure of that ?

What do you have in your Tomcat deployment descriptor (for every app) ?


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 18, 2006 5:41 am 
Expert
Expert

Joined: Tue Nov 23, 2004 7:00 pm
Posts: 570
Location: mostly Frankfurt Germany
May be Tomcat is waiting for your Struts Tiles configuration?

Sebastian

_________________
Best Regards
Sebastian
---
Training for Hibernate and Java Persistence
Tutorials for Hibernate, Spring, EJB, JSF...
eBook: Hibernate 3 - DeveloperGuide
Paper book: Hibernate 3 - Das Praxisbuch
http://www.laliluna.de


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 19, 2006 5:44 am 
Newbie

Joined: Thu Apr 06, 2006 4:38 am
Posts: 7
in server.xml, I put the following for every host, (xxx is the app name)

<Host name="xxx" appBase="webapps"
unpackWARs="false" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Context displayName='xxx' path="" docBase="xxx/" reloadable="true" />
</Host>

in web.xml for every app,
<listener>
<listener-class>com.xxx.hibernate.HibernateListener</listener-class>
</listener>

the HibernateListener.java look like this,
public class HibernateListener implements ServletContextListener {
public void contextInitialized(ServletContextEvent event) {
HibernateUtil.getSessionFactory();
}

public void contextDestroyed(ServletContextEvent event) {
HibernateUtil.getSessionFactory().close();
}
}


so is there any problem on my setup????


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 22, 2006 4:03 am 
Newbie

Joined: Thu Apr 06, 2006 4:38 am
Posts: 7
I think the problem is when tomcat deploy each app, all the HibernateListener class will react. If I deploy 3 apps, each HibernateListener class will react 3 time, so total will be 9 time. I think there is some problem on my setup that cause this problem.

So is there anyone help me with this??


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.