2015-04-16 2 views
1

Я пытаюсь для более часа, чтобы найти ошибку, и до сих пор я не могу:Java, Maven, спящий режим - отображение проблема

 cd C:\Users\zimnyk\Documents\NetBeansProjects\kwestionariusz; "JAVA_HOME=C:\\Program Files\\Java\\jdk1.8.0_40" cmd /c "\"\"C:\\Program Files\\NetBeans 8.0.2\\java\\maven\\bin\\mvn.bat\" -Dexec.args=\"-classpath %classpath com.mycompany.kwestionariusz.main\" -Dexec.executable=\"C:\\Program Files\\Java\\jdk1.8.0_40\\bin\\java.exe\" -Dmaven.ext.class.path=\"C:\\Program Files\\NetBeans 8.0.2\\java\\maven-nblib\\netbeans-eventspy.jar\" -Dfile.encoding=UTF-8 org.codehaus.mojo:exec-maven-plugin:1.2.1:exec\"" 
    Running NetBeans Compile On Save execution. Phase execution is skipped and output directories of dependency projects (with Compile on Save turned on) will be used instead of their jar artifacts. 
    Scanning for projects... 

    ------------------------------------------------------------------------ 
    Building kwestionariusz 1.0-SNAPSHOT 
    ------------------------------------------------------------------------ 

    --- exec-maven-plugin:1.2.1:exec (default-cli) @ kwestionariusz --- 
    kwi 16, 2015 11:29:46 AM org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit> 
    INFO: HCANN000001: Hibernate Commons Annotations {4.0.4.Final} 
    kwi 16, 2015 11:29:46 AM org.hibernate.Version logVersion 
    INFO: HHH000412: Hibernate Core {4.3.1.Final} 
    kwi 16, 2015 11:29:46 AM org.hibernate.cfg.Environment <clinit> 
    INFO: HHH000206: hibernate.properties not found 
    16, 2015 11:29:46 AM org.hibernate.cfg.Environment buildBytecodeProvider 

    INFO: HHH000021: Bytecode provider name : javassist 
    kwi 16, 2015 11:29:46 AM org.hibernate.cfg.Configuration configure 
    INFO: HHH000043: Configuring from resource: /hibernate.cfg.xml 
    kwi 16, 2015 11:29:46 AM org.hibernate.cfg.Configuration getConfigurationInputStream 
    INFO: HHH000040: Configuration resource: /hibernate.cfg.xml 
    kwi 16, 2015 11:29:46 AM org.hibernate.internal.util.xml.DTDEntityResolver resolveEntity 
    WARN: HHH000223: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide! 
    kwi 16, 2015 11:29:46 AM org.hibernate.cfg.Configuration addResource 
    INFO: HHH000221: Reading mappings from resource: Osoba.hbm.xml 
    kwi 16, 2015 11:29:46 AM org.hibernate.internal.util.xml.DTDEntityResolver resolveEntity 
    WARN: HHH000223: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide! 
    Initial SessionFactory creation failed.org.hibernate.InvalidMappingException: Unable to read XML 
    Exception in thread "main" java.lang.ExceptionInInitializerError 
     at com.mycompany.kwestionariusz.util.NewHibernateUtil.<clinit>(NewHibernateUtil.java:31) 
     at com.mycompany.kwestionariusz.main.main(main.java:20) 
    Caused by: org.hibernate.InvalidMappingException: Unable to read XML 
     at org.hibernate.internal.util.xml.MappingReader.legacyReadMappingDocument(MappingReader.java:375) 
     at org.hibernate.internal.util.xml.MappingReader.readMappingDocument(MappingReader.java:304) 
     at org.hibernate.cfg.Configuration.add(Configuration.java:516) 
     at org.hibernate.cfg.Configuration.add(Configuration.java:512) 
     at org.hibernate.cfg.Configuration.add(Configuration.java:686) 
     at org.hibernate.cfg.Configuration.addResource(Configuration.java:769) 
     at org.hibernate.cfg.AnnotationConfiguration.addResource(AnnotationConfiguration.java:123) 
     at org.hibernate.cfg.AnnotationConfiguration.addResource(AnnotationConfiguration.java:46) 
     at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:2255) 
     at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:2227) 
     at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2207) 
     at org.hibernate.cfg.AnnotationConfiguration.doConfigure(AnnotationConfiguration.java:213) 
     at org.hibernate.cfg.AnnotationConfiguration.doConfigure(AnnotationConfiguration.java:46) 
     at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2160) 
     at org.hibernate.cfg.AnnotationConfiguration.doConfigure(AnnotationConfiguration.java:201) 
     at org.hibernate.cfg.AnnotationConfiguration.doConfigure(AnnotationConfiguration.java:46) 
     at org.hibernate.cfg.Configuration.configure(Configuration.java:2075) 
     at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:183) 
     at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:46) 
     at org.hibernate.cfg.Configuration.configure(Configuration.java:2054) 
     at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:177) 
     at com.mycompany.kwestionariusz.util.NewHibernateUtil.<clinit>(NewHibernateUtil.java:27) 
     ... 1 more 
    Caused by: org.dom4j.DocumentException: Error on line 13 of document : The value of attribute "column" associated with an element type "null" must not contain the '<' character. Nested exception: The value of attribute "column" associated with an element type "null" must not contain the '<' character. 
     at org.dom4j.io.SAXReader.read(SAXReader.java:482) 
     at org.hibernate.internal.util.xml.MappingReader.legacyReadMappingDocument(MappingReader.java:325) 
     ... 22 more 
    ------------------------------------------------------------------------ 
    BUILD FAILURE 
    ------------------------------------------------------------------------ 
    Total time: 2.478s 
    Finished at: Thu Apr 16 11:29:47 CEST 2015 
    Final Memory: 8M/106M 
    ------------------------------------------------------------------------ 
    Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project kwestionariusz: Command execution failed. Process exited with an error: 1 (Exit value: 1) -> [Help 1] 

    To see the full stack trace of the errors, re-run Maven with the -e switch. 
    Re-run Maven using the -X switch to enable full debug logging. 

    For more information about the errors and possible solutions, please read the following articles: 
    [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException] 

Это как ошибка выглядит так, мое отображение файла:

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> 
<hibernate-mapping> 
    <class name="com.mycompany.kwestionariusz.Osoba" table="DaneOsobowe"> 
     <property name="imie" column="Imie"/> 
     <property name="nazwisko" column="Nazwisko"/> 
     <property name="telefon" column="Telefon"/> 
     <property name="email" column="Email"/> 
     <property name="uczelnia" column="Uczelnia"/> 
     <property name="doswiadczenie" column="Doswiadczenie"/> 
     <property name="zainteresowania" column="Zainteresowania"/> 
     <property name="skadSlyszal" column="SkadSlyszal"/> 
    </class> 
</hibernate-mapping> 

и это мой конфигурационный файл:

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> 
<hibernate-configuration> 
    <session-factory> 
    <property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property> 
    <property name="hibernate.connection.driver_class">org.postgresql.Driver</property> 
    <property name="hibernate.connection.url">jdbc:postgresql://localhost:5432/postgres</property> 
<property name="hibernate.connection.username">postgres</property> 
<property name="hibernate.connection.password">test</property> 
<mapping resource="Osoba.hbm.xml"/> 


</session-factory> 
</hibernate-configuration> 

Это мой первый раз с Maven и спящим режимом, так и ошибка выглядит плохо для меня , не могли бы вы мне помочь, пожалуйста?

линии 20 основного файла:

Session session = NewHibernateUtil.getSessionFactory().getCurrentSession(); 
     session.beginTransaction(); 

и линии ~ 31 из NewJavaUtil является:

} 
    catch (Throwable ex) { 
       // Log the exception. 
       System.err.println("Initial SessionFactory creation failed." + ex); 
       throw new ExceptionInInitializerError(ex); 
      } 
+0

Вместо использования println() я бы действительно использовал ex.printStackTrace(), чтобы получить дополнительную информацию об исключении. И, пожалуйста, не используйте ExceptionInInitializerError, эта ошибка имеет очень специфический смысл, и это не так (что вы можете искать в javadocs) – Gimby

+0

Я добавил для сопоставления файла в строке 5, он помог с одной ошибкой, но новый: \t ... 1 еще Вызвано: org.dom4j.DocumentException: Ошибка в строке 5 документа: значение атрибута «таблица» «связанный с типом элемента« null »не должен содержать символ« <». Вложенное исключение: значение атрибута «таблица», связанное с типом элемента «null», не должно содержать символ «<». – arienn

ответ

0

Проблема была в новых линиях, когда я добавил новую линию между все в файле отображения то он начал работать

+0

Я уверен, что это было другое изменение, которое вы сделали в то же время. Добавление новых строк в файле XML не будет иметь никакого различия. – Gimby

+0

Я просто удалил все это и скопировал его снова в строку – arienn

+0

, но все же мне пришлось добавить это: thread , чтобы читать работы – arienn

Смежные вопросы