views:

319

answers:

2

Hello All...

I have working copy of war file which is working fine in windows..

Now when i am deploying that war file into linux + tomcat, it's giving me following stacktrace :

2009-11-23 17:06:08,675  INFO (org.springframework.jdbc.datasource.DriverManagerDataSource:153) - Loaded JDBC driver: com.mysql.jdbc.Driver
2009-11-23 17:06:08,771  INFO (org.hibernate.cfg.annotations.Version:15) - Hibernate Annotations 3.4.0.CR1
2009-11-23 17:06:08,790  INFO (org.hibernate.cfg.Environment:520) - Hibernate 3.3.0.CR1
2009-11-23 17:06:08,796  INFO (org.hibernate.cfg.Environment:553) - hibernate.properties not found
2009-11-23 17:06:08,803  INFO (org.hibernate.cfg.Environment:687) - Bytecode provider name : cglib
2009-11-23 17:06:08,809  INFO (org.hibernate.cfg.Environment:604) - using JDK 1.4 java.sql.Timestamp handling
2009-11-23 17:06:08,905  INFO (org.hibernate.annotations.common.Version:14) - Hibernate Commons Annotations 3.1.0.CR1
2009-11-23 17:06:08,915  INFO (org.hibernate.cfg.Configuration:1452) - configuring from url: jndi:/localhost/MailServerV2/WEB-INF/classes/hibernate.cfg.xml
2009-11-23 17:06:08,968  INFO (org.springframework.beans.factory.support.DefaultListableBeanFactory:421) - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@afae4a: defining beans [propertyConfigurer,dataSource,sessionFactory,hibernateTemplate,transactionManager,domainsDao,forwardingsDao,gatewayDao,interfacesDao,transportDao,userDao,IDomainsProcessor,IForwardingsProcessor,IGatewayProcessor,IInterfacesProcessor,ITransportProcessor,IUserProcessor,domainsProcessor,forwardingsProcessor,gatewayProcessor,interfacesProcessor,transportProcessor,userProcessor,IUserSecurityProcessor,ITransportSecurityProcessor,IInterfacesSecurityProcessor,IGatewaySecurityProcessor,IForwardingsSecurityProcessor,IDomainsSecurityProcessor,domainsSecurityProcessor,forwardingsSecurityProcessor,gatewaySecurityProcessor,interfacesSecurityProcessor,transportSecurityProcessor,userSecurityProcessor]; root of factory hierarchy
2009-11-23 17:06:08,972 ERROR (org.springframework.web.context.ContextLoader:213) - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in URL [jndi:/localhost/MailServerV2/WEB-INF/classes/spring-config/spring-db-applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Could not parse configuration: jndi:/localhost/MailServerV2/WEB-INF/classes/hibernate.cfg.xml
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1395)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:512)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:289)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:286)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:188)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:526)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:730)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:387)
        at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:270)
        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3764)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4212)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)
        at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:626)
        at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
        at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022)
        at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
        at org.apache.catalina.core.StandardService.start(StandardService.java:448)
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:616)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
Caused by: org.hibernate.HibernateException: Could not parse configuration: jndi:/localhost/MailServerV2/WEB-INF/classes/hibernate.cfg.xml
        at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1505)
        at org.hibernate.cfg.AnnotationConfiguration.doConfigure(AnnotationConfiguration.java:985)
        at org.hibernate.cfg.AnnotationConfiguration.doConfigure(AnnotationConfiguration.java:64)
        at org.hibernate.cfg.Configuration.configure(Configuration.java:1454)
        at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:973)
        at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:64)
        at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:604)
        at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1454)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1392)
        ... 36 more
Caused by: org.dom4j.DocumentException: feature-read-only Nested exception: feature-read-only
        at org.dom4j.io.SAXReader.read(SAXReader.java:484)
        at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1495)
        ... 45 more
2009-11-23 17:06:08,974 ERROR (org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/MailServerV2]:3768) - Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in URL [jndi:/localhost/MailServerV2/WEB-INF/classes/spring-config/spring-db-applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Could not parse configuration: jndi:/localhost/MailServerV2/WEB-INF/classes/hibernate.cfg.xml
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1395)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:512)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:289)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:286)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:188)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:526)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:730)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:387)
        at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:270)
        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3764)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4212)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)
        at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:626)
        at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
        at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022)
        at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
        at org.apache.catalina.core.StandardService.start(StandardService.java:448)
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:616)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
Caused by: org.hibernate.HibernateException: Could not parse configuration: jndi:/localhost/MailServerV2/WEB-INF/classes/hibernate.cfg.xml
        at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1505)
        at org.hibernate.cfg.AnnotationConfiguration.doConfigure(AnnotationConfiguration.java:985)
        at org.hibernate.cfg.AnnotationConfiguration.doConfigure(AnnotationConfiguration.java:64)
        at org.hibernate.cfg.Configuration.configure(Configuration.java:1454)
        at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:973)
        at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:64)
        at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:604)
        at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1454)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1392)
        ... 36 more
Caused by: org.dom4j.DocumentException: feature-read-only Nested exception: feature-read-only
        at org.dom4j.io.SAXReader.read(SAXReader.java:484)
        at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1495)
        ... 45 more
Nov 23, 2009 5:06:08 PM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
Nov 23, 2009 5:06:08 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/MailServerV2] startup failed due to previous errors
2009-11-23 17:06:08,979  INFO (org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/MailServerV2]:653) - Closing Spring root WebApplicationContext
Nov 23, 2009 5:06:11 PM org.apache.catalina.core.ApplicationContext log
INFO: org.apache.webapp.balancer.BalancerFilter: init(): ruleChain: [org.apache.webapp.balancer.RuleChain: [org.apache.webapp.balancer.rules.URLStringMatchRule: Target string: News / Redirect URL: http://www.cnn.com], [org.apache.webapp.balancer.rules.RequestParameterRule: Target param name: paramName / Target param value: paramValue / Redirect URL: http://www.yahoo.com], [org.apache.webapp.balancer.rules.AcceptEverythingRule: Redirect URL: http://jakarta.apache.org]]
Nov 23, 2009 5:06:11 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
Nov 23, 2009 5:06:11 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
Nov 23, 2009 5:06:11 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
Nov 23, 2009 5:06:11 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
Nov 23, 2009 5:06:11 PM org.apache.coyote.http11.Http11BaseProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Nov 23, 2009 5:06:12 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Nov 23, 2009 5:06:12 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/266  config=null
Nov 23, 2009 5:06:12 PM org.apache.catalina.storeconfig.StoreLoader load
INFO: Find registry server-registry.xml at classpath resource
Nov 23, 2009 5:06:12 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 19798 ms

My hibernate.cfg.xml has following code :

<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"&gt;
<hibernate-configuration>
    <session-factory>
        <mapping class="com.sufalam.mailserver.bean.Admin"/>
        //....All classes mapping...
    </session-factory>
</hibernate-configuration>

Can anybody tell me what should be the problem exactly ?

Thanks in advance...

+1  A: 

Could not parse configuration: jndi:/localhost/MailServerV2/WEB-INF/classes/hibernate.cfg.xml

Sounds like it can't find the xml file (did you check it can access it?) or it is somehow malformed. Please post relevant pieces of the hibernate.cfg.xml.

And check that you don't have multiple jars on the classpath which contain the same classes (e.g. somehow dom4j twice on the classpath)

jitter
I have added hibernate.cfg.xml code.. And I have dom4j.jar only single time in my classpath..
Nirmal
@Nirmal: you do know which paths are covered by the classpath? You need to verify at least the `/WEB-INF/lib`, `Appserver/lib`, `JRE/lib` and probably more, depending on Appserver configuration. There should be **no** collissions.
BalusC
@jitter: Thanks a lot for your feedback... I have checked all the paths.. There is no collisions in libs...
Nirmal
+1  A: 

Hi Nirmal, I've run into problems in the past with special characters causing problems when sharing xml between windows and linux. Open your hibernate.cfg.xml inside a plain text editor vim and make sure you don't see any strange characters. Here's some more info.

Dave Paroulek
@Paroulek : Thanks for replying, but i have not found any strange character in the hibernate.cfg.xml.
Nirmal