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

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'

  • 写回答

4条回答 默认 最新

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

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

    评论

报告相同问题?

悬赏问题

  • ¥50 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥200 uniapp长期运行卡死问题解决
  • ¥15 latex怎么处理论文引理引用参考文献
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?