wl8685 2015-09-01 01:25 采纳率: 0%
浏览 12083

springMVC+maven,启动报报JNDI的错误,但我没有用到JNDI

要修改一个项目,用的技术有springMVC,maven等,部署到tomcat下,启动时报错。项目中使用的连接池连接数据库,没有使用JNDI,为什么启动时老是去查找JNDI?
applicationContext.xml中定义了项目的环境:


location="classpath*:/application.properties" />

    <!-- Tomcat JDBC连接池 -->
    <bean id="dataSource" class="org.apache.tomcat.jdbc.pool.DataSource" destroy-method="close">
        <property name="driverClassName" value="${jdbc.driver}" />
        <property name="url" value="${jdbc.url}" />
        <property name="username" value="${jdbc.username}" />
        <property name="password" value="${jdbc.password}" />
        <property name="defaultAutoCommit" value="false" />
    </bean>
</beans>

pom.xml中设置了spring.profiles.active

 <!-- jetty插件, 设定context path与spring profile -->
            <plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>${jetty.version}</version>
                <configuration>
                    <systemProperties>
                        <systemProperty>
                            <name>spring.profiles.active</name>
                            <value>development</value>
                        </systemProperty>
                    </systemProperties>
                    <useTestClasspath>true</useTestClasspath>

                    <webAppConfig>
                        <contextPath>/${project.artifactId}</contextPath>
                    </webAppConfig>
                </configuration>
            </plugin>

==========启动日志==========
13:57:46.586 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'spring.profiles.active' in [servletConfigInitParams]
13:57:46.586 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'spring.profiles.active' in [servletContextInitParams]
13:57:46.586 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'spring.profiles.active' in [jndiProperties]
13:57:46.586 [main] DEBUG o.springframework.jndi.JndiTemplate - Looking up JNDI object with name [java:comp/env/spring.profiles.active]
13:57:46.586 [main] DEBUG o.s.jndi.JndiLocatorDelegate - Converted JNDI name [java:comp/env/spring.profiles.active] not found - trying original name [spring.profiles.active]. javax.naming.NameNotFoundException: Name spring.profiles.active is not bound in this Context
13:57:46.586 [main] DEBUG o.springframework.jndi.JndiTemplate - Looking up JNDI object with name [spring.profiles.active]
13:57:46.586 [main] DEBUG o.s.jndi.JndiPropertySource - JNDI lookup for name [spring.profiles.active] threw NamingException with message: Name spring.profiles.active is not bound in this Context. Returning null.
13:57:46.586 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'spring.profiles.active' in [systemProperties]
13:57:46.586 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'spring.profiles.active' in [systemEnvironment]
13:57:46.586 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Could not find key 'spring.profiles.active' in any property source. Returning [null]

.....
......
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.driver' in [environmentProperties]
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.driver' in [servletConfigInitParams]
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.driver' in [servletContextInitParams]
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.driver' in [jndiProperties]
13:57:46.836 [main] DEBUG o.springframework.jndi.JndiTemplate - Looking up JNDI object with name [java:comp/env/jdbc.driver]
13:57:46.836 [main] DEBUG o.s.jndi.JndiLocatorDelegate - Converted JNDI name [java:comp/env/jdbc.driver] not found - trying original name [jdbc.driver]. javax.naming.NameNotFoundException: Name jdbc.driver is not bound in this Context
13:57:46.836 [main] DEBUG o.springframework.jndi.JndiTemplate - Looking up JNDI object with name [jdbc.driver]
13:57:46.836 [main] DEBUG o.s.jndi.JndiPropertySource - JNDI lookup for name [jdbc.driver] threw NamingException with message: Name jdbc.driver is not bound in this Context. Returning null.
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.driver' in [systemProperties]
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.driver' in [systemEnvironment]
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Could not find key 'jdbc.driver' in any property source. Returning [null]
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.driver' in [localProperties]
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Found key 'jdbc.driver' in [localProperties] with type [String] and value 'com.mysql.jdbc.Driver'
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.url' in [environmentProperties]
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.url' in [servletConfigInitParams]
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.url' in [servletContextInitParams]
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.url' in [jndiProperties]
13:57:46.836 [main] DEBUG o.springframework.jndi.JndiTemplate - Looking up JNDI object with name [java:comp/env/jdbc.url]
13:57:46.836 [main] DEBUG o.s.jndi.JndiLocatorDelegate - Converted JNDI name [java:comp/env/jdbc.url] not found - trying original name [jdbc.url]. javax.naming.NameNotFoundException: Name jdbc.url is not bound in this Context
13:57:46.836 [main] DEBUG o.springframework.jndi.JndiTemplate - Looking up JNDI object with name [jdbc.url]
13:57:46.836 [main] DEBUG o.s.jndi.JndiPropertySource - JNDI lookup for name [jdbc.url] threw NamingException with message: Name jdbc.url is not bound in this Context. Returning null.
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.url' in [systemProperties]
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.url' in [systemEnvironment]
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Could not find key 'jdbc.url' in any property source. Returning [null]
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.url' in [localProperties]
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Found key 'jdbc.url' in [localProperties] with type [String] and value 'jdbc:mysql://127.0.0.1:3306/drolohq?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull'
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.username' in [environmentProperties]
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.username' in [servletConfigInitParams]
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.username' in [servletContextInitParams]
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.username' in [jndiProperties]
13:57:46.836 [main] DEBUG o.springframework.jndi.JndiTemplate - Looking up JNDI object with name [java:comp/env/jdbc.username]
13:57:46.836 [main] DEBUG o.s.jndi.JndiLocatorDelegate - Converted JNDI name [java:comp/env/jdbc.username] not found - trying original name [jdbc.username]. javax.naming.NameNotFoundException: Name jdbc.username is not bound in this Context
13:57:46.836 [main] DEBUG o.springframework.jndi.JndiTemplate - Looking up JNDI object with name [jdbc.username]
13:57:46.836 [main] DEBUG o.s.jndi.JndiPropertySource - JNDI lookup for name [jdbc.username] threw NamingException with message: Name jdbc.username is not bound in this Context. Returning null.
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.username' in [systemProperties]
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.username' in [systemEnvironment]
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Could not find key 'jdbc.username' in any property source. Returning [null]
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.username' in [localProperties]
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Found key 'jdbc.username' in [localProperties] with type [String] and value 'root'

  • 写回答

3条回答 默认 最新

  • white...... 2015-09-08 05:55
    关注

    看下jetty的配置文件 看看有没有配置jndi···

    评论

报告相同问题?

悬赏问题

  • ¥15 树莓派与pix飞控通信
  • ¥15 自动转发微信群信息到另外一个微信群
  • ¥15 outlook无法配置成功
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题