无法查找JNDI名称[java:/ comp / env / jdbc / ptsvcs

时间:2015-08-25 12:17:20

标签: java apache hibernate jdbc tomcat5.5

我正在使用tomcat 5.5和JSP&休眠。我无法解决为什么数据源源名称不是查找。所以,请给我一些想法。如何解决它。

org.hibernate.service.jndi.JndiException: Unable to lookup JNDI name [java:/comp/env/jdbc/ptsvcs]
    at org.hibernate.service.jndi.internal.JndiServiceImpl.locate(JndiServiceImpl.java:68)
    at org.hibernate.service.jdbc.connections.internal.DatasourceConnectionProviderImpl.configure(DatasourceConnectionProviderImpl.java:116)
    at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:75)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:159)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131)
    at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.buildJdbcConnectionAccess(JdbcServicesImpl.java:223)
    at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:89)
    at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:75)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:159)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131)
    at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:78)
    at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2293)
    at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2289)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1758)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1798)
    at bphx.c2ab.hibernate.HibernateSessionFactory.createCachedSessionFactory(HibernateSessionFactory.java:251)
    at bphx.c2ab.hibernate.HibernateSessionFactory.<init>(HibernateSessionFactory.java:162)
    at bphx.c2ab.hibernate.HibernateSessionFactory.current(HibernateSessionFactory.java:149)
    at com.csc.pt.servlet.common.PTBusinessServiceServlet.init(PTBusinessServiceServlet.java:124)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1139)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:966)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3996)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4266)
    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:634)
    at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:561)
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:496)
    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1203)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:319)
    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(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
Caused by: javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
    at org.apache.naming.NamingContext.lookup(NamingContext.java:770)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:781)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:781)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
    at org.apache.naming.SelectorContext.lookup(SelectorContext.java:121)
    at javax.naming.InitialContext.lookup(Unknown Source)
    at org.hibernate.service.jndi.internal.JndiServiceImpl.locate(JndiServiceImpl.java:65)
    ... 44 more
[bphx.sdf.errLogger](ERROR): %%%% Could not create SessionFactory for cached operations %%%%: Unable to lookup JNDI name [java:/comp/env/jdbc/ptsvcs]
[bphx.sdf.errLogger](ERROR): %%%% Could not create SessionFactory for cached operations %%%%: Unable to lookup JNDI name [java:/comp/env/jdbc/ptsvcs]
[bphx.sdf.errLogger](ERROR): %%%% Error Creating SessionFactory %%%%: Unable to lookup JNDI name [java:/comp/env/jdbc/ptsvcs]
[bphx.sdf.errLogger](ERROR): %%%% Error Creating SessionFactory %%%%: Unable to lookup JNDI name [java:/comp/env/jdbc/ptsvcs]
org.hibernate.service.jndi.JndiException: Unable to lookup JNDI name [java:/comp/env/jdbc/ptsvcs]
    at org.hibernate.service.jndi.internal.JndiServiceImpl.locate(JndiServiceImpl.java:68)
    at org.hibernate.service.jdbc.connections.internal.DatasourceConnectionProviderImpl.configure(DatasourceConnectionProviderImpl.java:116)
    at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:75)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:159)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131)
    at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.buildJdbcConnectionAccess(JdbcServicesImpl.java:223)
    at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:89)
    at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:75)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:159)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131)
    at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:78)
    at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2293)
    at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2289)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1758)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1798)
    at bphx.c2ab.hibernate.HibernateSessionFactory.rebuildSessionFactory(HibernateSessionFactory.java:216)
    at bphx.c2ab.hibernate.HibernateSessionFactory.rebuildSessionFactory(HibernateSessionFactory.java:462)
    at bphx.c2ab.hibernate.HibernateSessionFactory$1.run(HibernateSessionFactory.java:157)
    at java.lang.Thread.run(Unknown Source)
Caused by: javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
    at org.apache.naming.NamingContext.lookup(NamingContext.java:770)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:781)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:781)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
    at org.apache.naming.SelectorContext.lookup(SelectorContext.java:121)
    at javax.naming.InitialContext.lookup(Unknown Source) more

URL = “JDBC:SQLSERVER:// BASvDEVPNTWA7:1433;的databaseName = J.2.3.0_DEV; sendStringParametersAsUnicode = FALSE; sendTimeAsDateTime =假”

        driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
        maxActive="10" 
        maxIdle="5" 
        maxWait="10000" 
        removeAbandoned="true" 
        removeAbandonedTimeout="60" 
        logAbandoned="true" 
        defaultTransactionIsolation ="1"/-->

0 个答案:

没有答案