我正在将 Maven-spring-hibernate 用于具有模块化方法的 Web 应用程序,为不同的组件提供 JAR 文件,并在最后将它们构建到 Web 应用程序中。
我有以下 JAR,其中包含一个带有属性文件的 META-INF 文件夹(database.properties
带有用户名/密码)。
common-model-1.0.0.jar
我也有其他组件 JAR,它们也使用数据库连接。
common-service-1.0.0.jar
master-1.0.0.jar
master-model-1.0.0.jar
master-service-1.0.0.jar
当我从命令行(catalina 启动/停止)开始部署到 Tomcat 时,应用程序运行良好。
但是当我使用 Sysdeo Eclipse Tomcat 插件从 Eclipse 内部运行 Tomcat 时,它会引发以下异常
Could not obtain connection to query metadata java.sql.SQLException: ORA-01005: null password given; logon denied
有什么我可能错过的配置吗?
当我调试 jpa 日志时发现以下
09:27:47,765 DEBUG [org.springframework.jndi.JndiTemplate] - Looking up JNDI object with name [dev.username]
09:27:47,765 DEBUG [org.springframework.jndi.JndiPropertySource] - JNDI lookup for name [dev.username] threw NamingException with message: Name dev.username is not bound in this Context. Returning null.
09:27:47,765 DEBUG [org.springframework.core.env.PropertySourcesPropertyResolver] - Searching for key 'dev.username' in [systemProperties]
09:27:47,765 DEBUG [org.springframework.core.env.PropertySourcesPropertyResolver] - Searching for key 'dev.username' in [systemEnvironment]
09:27:47,765 DEBUG [org.springframework.core.env.PropertySourcesPropertyResolver] - Could not find key 'dev.username' in any property source. Returning [null]
09:27:47,765 DEBUG [org.springframework.core.env.PropertySourcesPropertyResolver] - Searching for key 'dev.username' in [localProperties]
09:27:47,766 DEBUG [org.springframework.core.env.PropertySourcesPropertyResolver] - Found key 'dev.username' in [localProperties] with type [String] and value 'cms_ownr'
09:27:47,766 DEBUG [org.springframework.core.env.PropertySourcesPropertyResolver] - Searching for key 'dev.password' in [environmentProperties]
09:27:47,766 DEBUG [org.springframework.core.env.PropertySourcesPropertyResolver] - Searching for key 'dev.password' in [servletConfigInitParams]
09:27:47,766 DEBUG [org.springframework.core.env.PropertySourcesPropertyResolver] - Searching for key 'dev.password' in [servletContextInitParams]
09:27:47,766 DEBUG [org.springframework.core.env.PropertySourcesPropertyResolver] - Searching for key 'dev.password' in [jndiProperties]
09:27:47,766 DEBUG [org.springframework.jndi.JndiTemplate] - Looking up JNDI object with name [java:comp/env/dev.password]
09:27:47,766 DEBUG [org.springframework.jndi.JndiLocatorDelegate] - Converted JNDI name [java:comp/env/dev.password] not found - trying original name [dev.password]. javax.naming.NameNotFoundException: Name dev.password is not bound in this Context
09:27:47,766 DEBUG [org.springframework.jndi.JndiTemplate] - Looking up JNDI object with name [dev.password]
09:27:47,766 DEBUG [org.springframework.jndi.JndiPropertySource] - JNDI lookup for name [dev.password] threw NamingException with message: Name dev.password is not bound in this Context. Returning null.
09:27:47,767 DEBUG [org.springframework.core.env.PropertySourcesPropertyResolver] - Searching for key 'dev.password' in [systemProperties]
09:27:47,767 DEBUG [org.springframework.core.env.PropertySourcesPropertyResolver] - Searching for key 'dev.password' in [systemEnvironment]
09:27:47,767 DEBUG [org.springframework.core.env.PropertySourcesPropertyResolver] - Could not find key 'dev.password' in any property source. Returning [null]
09:27:47,767 DEBUG [org.springframework.core.env.PropertySourcesPropertyResolver] - Searching for key 'dev.password' in [localProperties]
09:27:47,767 DEBUG [org.springframework.core.env.PropertySourcesPropertyResolver] - Found key 'dev.password' in [localProperties] with type [String] and value 'cms_ownr'