Connect to JDBC when deploying War?

2013-11-05
2013-11-05
  • Hi,

    We are trying to deploy a War file on a simple tomcat server on a VPS. We have created the WAR file, installed Tomcat, deployed the war, created de database, restored from my local DB, etc... But I get this error:

    HTTP Status 500 -

    type Exception report

    message

    description The server encountered an internal error () that prevented it from fulfilling this request.

    exception

    javax.servlet.ServletException: Filter execution threw an exception

    root cause

    java.lang.ExceptionInInitializerError
    com.openxava.naviox.web.NaviOXFilter.doFilter(NaviOXFilter.java:33)

    root cause

    javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build EntityManagerFactory
    org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:915)
    org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:57)
    javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:63)
    org.openxava.jpa.XPersistence.getEntityManagerFactory(XPersistence.java:182)
    org.openxava.jpa.XPersistence.openManager(XPersistence.java:113)
    org.openxava.jpa.XPersistence.getManager(XPersistence.java:94)
    com.openxava.naviox.impl.DB.createDB(DB.java:72)
    com.openxava.naviox.impl.DB.init(DB.java:33)
    com.openxava.naviox.Modules.<clinit>(Modules.java:34)
    com.openxava.naviox.web.NaviOXFilter.doFilter(NaviOXFilter.java:33)

    root cause

    org.hibernate.HibernateException: Could not find datasource
    org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:79)
    org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:143)
    org.hibernate.ejb.InjectionSettingsFactory.createConnectionProvider(InjectionSettingsFactory.java:51)
    org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:90)
    org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2863)
    org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2859)
    org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1870)
    org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:906)
    org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:57)
    javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:63)
    org.openxava.jpa.XPersistence.getEntityManagerFactory(XPersistence.java:182)
    org.openxava.jpa.XPersistence.openManager(XPersistence.java:113)
    org.openxava.jpa.XPersistence.getManager(XPersistence.java:94)
    com.openxava.naviox.impl.DB.createDB(DB.java:72)
    com.openxava.naviox.impl.DB.init(DB.java:33)
    com.openxava.naviox.Modules.<clinit>(Modules.java:34)
    com.openxava.naviox.web.NaviOXFilter.doFilter(NaviOXFilter.java:33)

    root cause

    javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
    org.apache.naming.NamingContext.lookup(NamingContext.java:770)
    org.apache.naming.NamingContext.lookup(NamingContext.java:140)
    org.apache.naming.NamingContext.lookup(NamingContext.java:781)
    org.apache.naming.NamingContext.lookup(NamingContext.java:140)
    org.apache.naming.NamingContext.lookup(NamingContext.java:781)
    org.apache.naming.NamingContext.lookup(NamingContext.java:153)
    org.apache.naming.SelectorContext.lookup(SelectorContext.java:152)
    javax.naming.InitialContext.lookup(InitialContext.java:409)
    org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:75)
    org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:143)
    org.hibernate.ejb.InjectionSettingsFactory.createConnectionProvider(InjectionSettingsFactory.java:51)
    org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:90)
    org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2863)
    org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2859)
    org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1870)
    org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:906)
    org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:57)
    javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:63)
    org.openxava.jpa.XPersistence.getEntityManagerFactory(XPersistence.java:182)
    org.openxava.jpa.XPersistence.openManager(XPersistence.java:113)
    org.openxava.jpa.XPersistence.getManager(XPersistence.java:94)
    com.openxava.naviox.impl.DB.createDB(DB.java:72)
    com.openxava.naviox.impl.DB.init(DB.java:33)
    com.openxava.naviox.Modules.<clinit>(Modules.java:34)
    com.openxava.naviox.web.NaviOXFilter.doFilter(NaviOXFilter.java:33)

    note The full stack trace of the root cause is available in the Apache Tomcat/6.0.35 logs.

    It seems it cannot see the Database, but I have managed to see it through pgadmin3 without problems. Is there anything I must configure on the VPS to make our app work?.

    Thanks in advance,

    Jose.

     
    • Solved: Modified the context.xml file on /etc/tomcat6