简体   繁体   English

Maven Web应用程序-通过sysdeo插件运行Tomcat而不检索.properties

[英]Maven web application - running Tomcat by sysdeo plugin not retrieving .properties

I am using Maven-spring-hibernate for a web application with modular approach, having JAR files for the different components and building them up into a web application at the end. 我正在将Maven-spring-hibernate用于具有模块化方法的Web应用程序,具有用于不同组件的JAR文件,最后将它们构建到Web应用程序中。

I have the following JAR which contains a META-INF folder with a property file ( database.properties , with username/password). 我有以下JAR,其中包含带有属性文件( database.properties ,具有用户名/密码)的META-INF文件夹。

common-model-1.0.0.jar

I have other component JAR's too, which are also using database connections. 我也有其他组件JAR,它们也使用数据库连接。

common-service-1.0.0.jar
master-1.0.0.jar
master-model-1.0.0.jar
master-service-1.0.0.jar

When I deploy to the Tomcat started from the command line (catalina start/stop) the application works perfectly. 当我从命令行(catalina启动/停止)启动部署到Tomcat时,该应用程序运行正常。

But when I run Tomcat from inside Eclipse using Sysdeo Eclipse Tomcat plugin it throws the following exception 但是,当我使用Sysdeo Eclipse Tomcat插件从Eclipse内部运行Tomcat时,它将引发以下异常

Could not obtain connection to query metadata java.sql.SQLException: ORA-01005: null password given; logon denied

Is there any thing configuration that I might have missed? 我可能会错过任何配置吗?

When i debug jpa log found following 当我调试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'

Finally my problem is resolved. 终于我的问题解决了。

I had sts eclipse with tomcat 6.x 我在tomcat 6.x中遇到了sts eclipse

I was using Sysdeo tomcatPluginV32.zip 我正在使用Sysdeo tomcatPluginV32.zip

Now i installed latest Sysdeo tomcatPluginV33.zip and it works fine now. 现在,我安装了最新的Sysdeo tomcatPluginV33.zip,它现在可以正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM