Hi,
I have been trying out CaveatEmptor3.1alpha3 on a small example of my own. I basically simplifying the downloaded package (to one single UserDAO) and put a jsp and a jsf page to access it.
What I discovered is that everytime I start my Tomcat server and access the jsp for the first time, all data in user table got erased. If I add back the rows (without stopping tomcat) things will run OK from there.
Can somebody tell what could have gone wrong?
Thanks in advance
Yee
-----------------------------------------------------------------------
Below is the mapping file and trace:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="com.traleva.erp.bo.model">
<class name="User"
table="user">
<id name="userId" column="userId"
unsaved-value="null">
<generator class="assigned"/>
</id>
<property name="password"
column="password"/>
</class>
</hibernate-mapping>
-------------------------------------------------------------
6/10/2005 00:26:49 org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
6/10/2005 00:26:49 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1763 ms
6/10/2005 00:26:50 org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
6/10/2005 00:26:50 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5.9
6/10/2005 00:26:50 org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
6/10/2005 00:26:52 org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\Java\Tomcat-5.5.9\webapps\TralevaERP\WEB-INF\lib\jsdk23.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
00:26:54,367 INFO FacesConfigurator:226 - Reading standard config org/apache/myfaces/resource/standard-faces-config.xml
00:26:55,038 INFO FacesConfigurator:385 - Reading config jar:file:/C:/Java/Tomcat-5.5.9/temp/myfaces15274.jar!/META-INF/faces-config.xml
00:26:55,669 INFO FacesConfigurator:385 - Reading config jar:file:/C:/Java/Tomcat-5.5.9/temp/myfaces15275.jar!/META-INF/faces-config.xml
00:26:56,750 INFO FacesConfigurator:385 - Reading config jar:file:/C:/Java/Tomcat-5.5.9/temp/myfaces15276.jar!/META-INF/faces-config.xml
00:26:57,111 INFO FacesConfigurator:420 - Reading config /WEB-INF/faces-config.xml
00:26:57,131 INFO FacesConfigurator:435 - Reading config /WEB-INF/faces-config.xml
00:26:57,492 DEBUG ApplicationFactory:53 - New ApplicationFactory instance created
00:26:59,434 INFO StartupServletContextListener:122 - ServletContext 'C:\Java\Tomcat-5.5.9\webapps\TralevaERP\' initialized.
00:26:59,545 INFO ContextLoader:146 - Root WebApplicationContext: initialization started
00:26:59,555 INFO [/TralevaERP]:636 - Loading Spring root WebApplicationContext
00:26:59,725 INFO XmlBeanDefinitionReader:150 - Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml]
00:26:59,865 INFO XmlWebApplicationContext:90 - Bean factory for application context [Root WebApplicationContext]: org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [userService]; root of BeanFactory hierarchy
00:26:59,965 INFO XmlWebApplicationContext:294 - 1 beans defined in application context [Root WebApplicationContext]
00:27:00,005 INFO CollectionFactory:61 - JDK 1.4+ collections available
00:27:00,065 INFO CollectionFactory:66 - Commons Collections 3.x available
00:27:00,095 INFO XmlWebApplicationContext:432 - Unable to locate MessageSource with name 'messageSource': using default [org.springframework.context.support.DelegatingMessageSource@1fb24d3]
00:27:00,105 INFO XmlWebApplicationContext:454 - Unable to locate ApplicationEventMulticaster with name 'applicationEventMulticaster': using default [org.springframework.context.event.SimpleApplicationEventMulticaster@d2efa1]
00:27:00,115 INFO UiApplicationContextUtils:68 - No ThemeSource found for [Root WebApplicationContext]: using ResourceBundleThemeSource
00:27:00,135 INFO DefaultListableBeanFactory:260 - Pre-instantiating singletons in factory [org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [userService]; root of BeanFactory hierarchy]
00:27:00,145 INFO DefaultListableBeanFactory:222 - Creating shared instance of singleton bean 'userService'
00:27:00,386 INFO ContextLoader:161 - Using context class [org.springframework.web.context.support.XmlWebApplicationContext] for root WebApplicationContext
00:27:00,386 INFO ContextLoader:171 - Root WebApplicationContext: initialization completed in 841 ms
00:27:00,386 INFO ContextLoaderListener:220 - Loading faces application context...
00:27:00,396 INFO ContextLoaderListener:85 - FacesConfigWebApplicationContext: initialization started
00:27:00,396 INFO [/TralevaERP]:636 - Loading FacesConfigWebApplicationContext
00:27:00,516 INFO ContextLoaderListener:109 - DelegatingVariableResolver: initialization started
00:27:00,516 INFO [/TralevaERP]:636 - Setting custom DelegatingVariableResolver
00:27:00,526 INFO ContextLoaderListener:114 - DelegatingVariableResolver: initialization successsful
00:27:00,546 INFO HibernateFilterLong:46 - Servlet filter init, now disconnecting/reconnecting a Session for each request.
6/10/2005 00:27:00 org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
6/10/2005 00:27:01 org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
6/10/2005 00:27:01 org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/180 config=null
6/10/2005 00:27:01 org.apache.catalina.storeconfig.StoreLoader load
INFO: Find registry server-registry.xml at classpath resource
6/10/2005 00:27:01 org.apache.catalina.startup.Catalina start
INFO: Server startup in 12047 ms
00:27:30,860 DEBUG HibernateFilterLong:66 - Disabling automatic flushing of the Session.
00:27:31,100 INFO Environment:474 - Hibernate 3.1 rc1
00:27:31,130 INFO Environment:489 - loaded properties from resource hibernate.properties: {hibernate.order_updates=true, hibernate.default_batch_fetch_size=8, hibernate.connection.driver_class=org.hsqldb.jdbcDriver, hibernate.cglib.use_reflection_optimizer=true, hibernate.cache.provider_class=org.hibernate.cache.HashtableCacheProvider, hibernate.cache.use_query_cache=true, hibernate.max_fetch_depth=1, hibernate.dialect=org.hibernate.dialect.HSQLDialect, hibernate.jdbc.use_streams_for_binary=true, hibernate.query.substitutions=true 1, false 0, yes 'Y', no 'N', hibernate.proxool.pool_alias=pool1, hibernate.connection.username=sa, hibernate.cache.region_prefix=hibernate.test, hibernate.connection.url=jdbc:hsqldb:., hibernate.connection.password=****, hibernate.jdbc.batch_versioned_data=true, hibernate.connection.pool_size=1}
00:27:31,130 INFO Environment:519 - using java.io streams to persist binary types
00:27:31,140 INFO Environment:520 - using CGLIB reflection optimizer
00:27:31,160 INFO Environment:550 - using JDK 1.4 java.sql.Timestamp handling
00:27:31,661 INFO Configuration:1243 - configuring from resource: /hibernate.cfg.xml
00:27:31,671 INFO Configuration:1220 - Configuration resource: /hibernate.cfg.xml
00:27:31,941 DEBUG ImportFromClasspathEntityResolver:38 - Trying to resolve system id:
http://hibernate.sourceforge.net/hibern ... on-3.0.dtd
00:27:32,131 INFO Configuration:460 - Reading mappings from resource: com/traleva/erp/bo/model/User.hbm.xml
00:27:32,141 DEBUG ImportFromClasspathEntityResolver:38 - Trying to resolve system id:
http://hibernate.sourceforge.net/hibern ... ng-3.0.dtd
00:27:32,242 INFO Configuration:1354 - Configured SessionFactory: null
00:27:32,612 INFO HbmBinder:266 - Mapping class: com.traleva.erp.bo.model.User -> user
00:27:32,912 INFO Configuration:1000 - processing extends queue
00:27:32,912 INFO Configuration:1004 - processing collection mappings
00:27:32,973 INFO Configuration:1013 - processing association property references
00:27:32,973 INFO Configuration:1035 - processing foreign key constraints
00:27:33,644 INFO DriverManagerConnectionProvider:41 - Using Hibernate built-in connection pool (not for production use!)
00:27:33,644 INFO DriverManagerConnectionProvider:42 - Hibernate connection pool size: 1
00:27:33,644 INFO DriverManagerConnectionProvider:45 - autocommit mode: false
00:27:33,664 INFO DriverManagerConnectionProvider:80 - using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://yee:3306/traleva
00:27:33,674 INFO DriverManagerConnectionProvider:86 - connection properties: {user=root, password=****}
00:27:34,395 INFO SettingsFactory:77 - RDBMS: MySQL, version: 4.1.14-nt
00:27:34,395 INFO SettingsFactory:78 - 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 $ )
00:27:34,575 INFO Dialect:100 - Using dialect: org.hibernate.dialect.MySQLDialect
00:27:34,605 INFO TransactionFactoryFactory:31 - Using default transaction strategy (direct JDBC transactions)
00:27:34,625 INFO TransactionManagerLookupFactory:33 - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
00:27:34,625 INFO SettingsFactory:125 - Automatic flush during beforeCompletion(): disabled
00:27:34,625 INFO SettingsFactory:129 - Automatic session close at end of transaction: disabled
00:27:34,625 INFO SettingsFactory:136 - JDBC batch size: 15
00:27:34,635 INFO SettingsFactory:139 - JDBC batch updates for versioned data: enabled
00:27:34,655 INFO SettingsFactory:144 - Scrollable result sets: enabled
00:27:34,655 INFO SettingsFactory:152 - JDBC3 getGeneratedKeys(): enabled
00:27:34,655 INFO SettingsFactory:160 - Connection release mode: null
00:27:34,665 INFO SettingsFactory:184 - Maximum outer join fetch depth: 3
00:27:34,665 INFO SettingsFactory:187 - Default batch fetch size: 8
00:27:34,665 INFO SettingsFactory:191 - Generate SQL with comments: disabled
00:27:34,665 INFO SettingsFactory:195 - Order SQL updates by primary key: enabled
00:27:34,665 INFO SettingsFactory:338 - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
00:27:34,695 INFO ASTQueryTranslatorFactory:21 - Using ASTQueryTranslatorFactory
00:27:34,705 INFO SettingsFactory:203 - Query language substitutions: {no='N', true=1, yes='Y', false=0}
00:27:34,705 INFO SettingsFactory:209 - Second-level cache: enabled
00:27:34,705 INFO SettingsFactory:213 - Query cache: disabled
00:27:34,705 INFO SettingsFactory:325 - Cache provider: org.hibernate.cache.HashtableCacheProvider
00:27:34,715 INFO SettingsFactory:228 - Optimize cache for minimal puts: disabled
00:27:34,715 INFO SettingsFactory:233 - Cache region prefix: hibernate.test
00:27:34,725 INFO SettingsFactory:237 - Structured second-level cache entries: disabled
00:27:34,785 INFO SettingsFactory:257 - Echoing all SQL to stdout
00:27:34,785 INFO SettingsFactory:264 - Statistics: disabled
00:27:34,785 INFO SettingsFactory:268 - Deleted entity synthetic identifier rollback: disabled
00:27:34,785 INFO SettingsFactory:283 - Default entity-mode: POJO
00:27:35,466 INFO SessionFactoryImpl:154 - building session factory
00:27:36,818 DEBUG User:26 - User constructor called
00:27:37,289 INFO SessionFactoryObjectFactory:82 - Not binding factory to JNDI, no JNDI name configured
00:27:37,309 INFO Configuration:1000 - processing extends queue
00:27:37,309 INFO Configuration:1004 - processing collection mappings
00:27:37,309 INFO Configuration:1013 - processing association property references
00:27:37,309 INFO Configuration:1035 - processing foreign key constraints
00:27:37,329 INFO Configuration:1000 - processing extends queue
00:27:37,329 INFO Configuration:1004 - processing collection mappings
00:27:37,329 INFO Configuration:1013 - processing association property references
00:27:37,329 INFO Configuration:1035 - processing foreign key constraints
00:27:37,339 INFO SchemaExport:153 - Running hbm2ddl schema export
00:27:37,359 INFO SchemaExport:180 - exporting generated schema to database
00:27:37,639 INFO SchemaExport:200 - schema export complete
00:27:37,659 INFO SessionFactoryImpl:431 - Checking 0 named queries
00:27:38,070 DEBUG UserServiceImpl:67 - UserServiceImpl.login():
00:27:38,090 DEBUG UserDAOHibernate:32 - UserDaoHibernateImpl created
00:27:38,190 DEBUG User$$EnhancerByCGLIB$$d63138:26 - User constructor called
Hibernate:
select
user0_.userId as userId0_0_,
user0_.password as password0_0_
from
user user0_
where
user0_.userId=?
00:27:38,310 ERROR UserServiceImpl:83 - Could not login
org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.traleva.erp.bo.model.User#yee]
at org.hibernate.ObjectNotFoundException.throwIfNull(ObjectNotFoundException.java:27)
at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:65)
at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:98)
at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:133)
at com.traleva.erp.bo.model.User$$EnhancerByCGLIB$$d63138.getPassword(<generated>)
at com.traleva.erp.bo.service.impl.UserServiceImpl.login(UserServiceImpl.java:73)
at org.apache.jsp.MyJsp_jsp._jspService(org.apache.jsp.MyJsp_jsp:83)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)