Build.xml因JNDI错误而失败

时间:2014-08-11 06:47:59

标签: ant build jndi

MY ant build停止使用JNDI错误,它几天前就完美运行了。日志说它没有初始上下文异常。

Buildfile: C:\vseelsh_workspace\vseelsh_perforce_ws\pem_rd\NBDX\nbdx\build.xml
clean:
   [delete] Deleting directory C:\vseelsh_workspace\vseelsh_perforce_ws\pem_rd\NBDX\nbdx\build
prepare:
    [mkdir] Created dir: C:\vseelsh_workspace\vseelsh_perforce_ws\pem_rd\NBDX\nbdx\build
    [mkdir] Created dir: C:\vseelsh_workspace\vseelsh_perforce_ws\pem_rd\NBDX\nbdx\build\classes
    [mkdir] Created dir: C:\vseelsh_workspace\vseelsh_perforce_ws\pem_rd\NBDX\nbdx\build\dist
    [mkdir] Created dir: C:\vseelsh_workspace\vseelsh_perforce_ws\pem_rd\NBDX\nbdx\build\report
compile:
    [javac] C:\vseelsh_workspace\vseelsh_perforce_ws\pem_rd\NBDX\nbdx\build.xml:75: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
    [javac] Compiling 331 source files to C:\vseelsh_workspace\vseelsh_perforce_ws\pem_rd\NBDX\nbdx\build\classes
copyresources:
     [copy] Copying 3 files to C:\vseelsh_workspace\vseelsh_perforce_ws\pem_rd\NBDX\nbdx\build\classes
test:
schemaexport:
[hibernatetool] Executing Hibernate Tool with a JPA Configuration
[hibernatetool] 1. task: hbm2ddl (Generates database schema)
[hibernatetool] log4j:WARN No appenders could be found for logger (org.jboss.logging).
[hibernatetool] log4j:WARN Please initialize the log4j system properly.
[hibernatetool] log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
[hibernatetool] SLF4J: Class path contains multiple SLF4J bindings.
[hibernatetool] SLF4J: Found binding in [jar:file:/C:/vseelsh_workspace/vseelsh_perforce_ws/pem_rd/NBDX/nbdx/lib/gwt/gwt-2.3.0/gwt-2.3.0/samples/DynaTableRf/war/WEB-INF/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
[hibernatetool] SLF4J: Found binding in [jar:file:/C:/Jboss/jboss-as-7.1.1.Final/modules/org/slf4j/impl/main/slf4j-jboss-logmanager-1.0.0.GA.jar!/org/slf4j/impl/StaticLoggerBinder.class]
[hibernatetool] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
[hibernatetool] An exception occurred while running exporter #2:hbm2ddl (Generates database schema)
[hibernatetool] To get the full stack trace run ant with -verbose
[hibernatetool] org.hibernate.service.jndi.JndiException: Error parsing JNDI name [java:/nbdxDS]
[hibernatetool] javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial

BUILD FAILED

1 个答案:

答案 0 :(得分:0)

问题已解决。实际上我的项目有两个persistence.xml文件,其中一个文件由build.xml用于导出模式。在build.xml使用的这个文件中,我不应该使用数据源标记来引用JNDI(它直接引用数据库凭据来连接它)。我错误地将内容从一个persistence.xml文件复制到另一个导致其中包含jta-datasource标记的内容,这是我无法注意到的。它强制构建过程在此文件中查找称为JNDI的数据源,这基本上是不可能的,因为尚未创建数据源并由任何其他进程存储在JNDI中。删除此jta-datasource标记后,已解决此持久性标记已解决问题。

相关问题