robertoeb 15 de jun. de 2005
Erra isso, tava no lugar errado…
Mas agora da esse erro
2005 - 06 - 15 16 : 16 : 02 , 210 INFO hibernate . cfg . Configuration -> Mapping resource : daos / Pessoa . hbm . xml
2005 - 06 - 15 16 : 16 : 02 , 270 ERROR hibernate . cfg . Configuration -> Could not compile the mapping document
net . sf . hibernate . MappingException : persistent class [ Pessoa ] not found
at net . sf . hibernate . cfg . Binder . bindClass ( Binder . java : 81 )
at net . sf . hibernate . cfg . Binder . bindRootClass ( Binder . java : 207 )
at net . sf . hibernate . cfg . Binder . bindRoot ( Binder . java : 1167 )
at net . sf . hibernate . cfg . Configuration . add ( Configuration . java : 245 )
at net . sf . hibernate . cfg . Configuration . addInputStream ( Configuration . java : 268 )
at net . sf . hibernate . cfg . Configuration . addClass ( Configuration . java : 309 )
at meuservico . HibernateUtil .( HibernateUtil . java : 32 )
at daos . PessoaDAO .( PessoaDAO . java : 19 )
at daos . TesteAmigo . main ( TesteAmigo . java : 14 )
Caused by : java . lang . ClassNotFoundException : Pessoa
at java . net . URLClassLoader $ 1. run ( URLClassLoader . java : 199 )
at java . security . AccessController . doPrivileged ( Native Method )
at java . net . URLClassLoader . findClass ( URLClassLoader . java : 187 )
at java . lang . ClassLoader . loadClass ( ClassLoader . java : 289 )
at sun . misc . Launcher $ AppClassLoader . loadClass ( Launcher . java : 274 )
at java . lang . ClassLoader . loadClass ( ClassLoader . java : 235 )
at java . lang . ClassLoader . loadClassInternal ( ClassLoader . java : 302 )
at java . lang . Class . forName0 ( Native Method )
at java . lang . Class . forName ( Class . java : 141 )
at net . sf . hibernate . util . ReflectHelper . classForName ( ReflectHelper . java : 75 )
at net . sf . hibernate . cfg . Binder . bindClass ( Binder . java : 78 )
… 8 more
2005 - 06 - 15 16 : 16 : 02 , 320 ERROR meuservico . HibernateUtil -> Building SessionFactory failed .
net . sf . hibernate . MappingException : Error reading resource : daos / Pessoa . hbm . xml
at net . sf . hibernate . cfg . Configuration . addClass ( Configuration . java : 312 )
at meuservico . HibernateUtil .( HibernateUtil . java : 32 )
at daos . PessoaDAO .( PessoaDAO . java : 19 )
at daos . TesteAmigo . main ( TesteAmigo . java : 14 )
Caused by : net . sf . hibernate . MappingException : persistent class [ Pessoa ] not found
at net . sf . hibernate . cfg . Binder . bindClass ( Binder . java : 81 )
at net . sf . hibernate . cfg . Binder . bindRootClass ( Binder . java : 207 )
at net . sf . hibernate . cfg . Binder . bindRoot ( Binder . java : 1167 )
at net . sf . hibernate . cfg . Configuration . add ( Configuration . java : 245 )
at net . sf . hibernate . cfg . Configuration . addInputStream ( Configuration . java : 268 )
at net . sf . hibernate . cfg . Configuration . addClass ( Configuration . java : 309 )
… 3 more
Caused by : java . lang . ClassNotFoundException : Pessoa
at java . net . URLClassLoader $ 1. run ( URLClassLoader . java : 199 )
at java . security . AccessController . doPrivileged ( Native Method )
at java . net . URLClassLoader . findClass ( URLClassLoader . java : 187 )
at java . lang . ClassLoader . loadClass ( ClassLoader . java : 289 )
at sun . misc . Launcher $ AppClassLoader . loadClass ( Launcher . java : 274 )
at java . lang . ClassLoader . loadClass ( ClassLoader . java : 235 )
at java . lang . ClassLoader . loadClassInternal ( ClassLoader . java : 302 )
at java . lang . Class . forName0 ( Native Method )
at java . lang . Class . forName ( Class . java : 141 )
at net . sf . hibernate . util . ReflectHelper . classForName ( ReflectHelper . java : 75 )
at net . sf . hibernate . cfg . Binder . bindClass ( Binder . java : 78 )
… 8 more
java . lang . ExceptionInInitializerError
at meuservico . HibernateUtil .( HibernateUtil . java : 37 )
at daos . PessoaDAO .( PessoaDAO . java : 19 )
at daos . TesteAmigo . main ( TesteAmigo . java : 14 )
Caused by : net . sf . hibernate . MappingException : Error reading resource : daos / Pessoa . hbm . xml
at net . sf . hibernate . cfg . Configuration . addClass ( Configuration . java : 312 )
at meuservico . HibernateUtil .( HibernateUtil . java : 32 )
… 2 more
Caused by : net . sf . hibernate . MappingException : persistent class [ Pessoa ] not found
at net . sf . hibernate . cfg . Binder . bindClass ( Binder . java : 81 )
at net . sf . hibernate . cfg . Binder . bindRootClass ( Binder . java : 207 )
at net . sf . hibernate . cfg . Binder . bindRoot ( Binder . java : 1167 )
at net . sf . hibernate . cfg . Configuration . add ( Configuration . java : 245 )
at net . sf . hibernate . cfg . Configuration . addInputStream ( Configuration . java : 268 )
at net . sf . hibernate . cfg . Configuration . addClass ( Configuration . java : 309 )
… 3 more
Caused by : java . lang . ClassNotFoundException : Pessoa
at java . net . URLClassLoader $ 1. run ( URLClassLoader . java : 199 )
at java . security . AccessController . doPrivileged ( Native Method )
at java . net . URLClassLoader . findClass ( URLClassLoader . java : 187 )
at java . lang . ClassLoader . loadClass ( ClassLoader . java : 289 )
at sun . misc . Launcher $ AppClassLoader . loadClass ( Launcher . java : 274 )
at java . lang . ClassLoader . loadClass ( ClassLoader . java : 235 )
at java . lang . ClassLoader . loadClassInternal ( ClassLoader . java : 302 )
at java . lang . Class . forName0 ( Native Method )
at java . lang . Class . forName ( Class . java : 141 )
at net . sf . hibernate . util . ReflectHelper . classForName ( ReflectHelper . java : 75 )
at net . sf . hibernate . cfg . Binder . bindClass ( Binder . java : 78 )
… 8 more
Exception in thread “ main ”
robertoeb 15 de jun. de 2005
Correto novamente
Agora erro na outro mapeamento…endereco
2005 - 06 - 15 16 : 35 : 47 , 340 INFO hibernate . cfg . Configuration -> Mapping resource : daos / Endereco . hbm . xml
2005 - 06 - 15 16 : 35 : 49 , 150 ERROR hibernate . util . XMLHelper -> Error parsing XML : XML InputStream ( 10 ) Attribute “ name ” must be declared for element type “ param ” .
2005 - 06 - 15 16 : 35 : 49 , 150 INFO hibernate . cfg . Binder -> Mapping class : daos . Endereco -> Endereco
2005 - 06 - 15 16 : 35 : 49 , 150 ERROR meuservico . HibernateUtil -> Building SessionFactory failed .
net . sf . hibernate . MappingException : Error reading resource : daos / Endereco . hbm . xml
at net . sf . hibernate . cfg . Configuration . addClass ( Configuration . java : 312 )
at meuservico . HibernateUtil .( HibernateUtil . java : 33 )
at daos . PessoaDAO .( PessoaDAO . java : 19 )
at daos . TesteAmigo . main ( TesteAmigo . java : 14 )
Caused by : net . sf . hibernate . MappingException : invalid mapping
at net . sf . hibernate . cfg . Configuration . addInputStream ( Configuration . java : 269 )
at net . sf . hibernate . cfg . Configuration . addClass ( Configuration . java : 309 )
… 3 more
Caused by : org . xml . sax . SAXParseException : Attribute “ name ” must be declared for element type “ param ” .
at org . apache . xerces . util . ErrorHandlerWrapper . createSAXParseException ( Unknown Source )
at org . apache . xerces . util . ErrorHandlerWrapper . error ( Unknown Source )
at org . apache . xerces . impl . XMLErrorReporter . reportError ( Unknown Source )
at org . apache . xerces . impl . XMLErrorReporter . reportError ( Unknown Source )
at org . apache . xerces . impl . dtd . XMLDTDValidator . addDTDDefaultAttrsAndValidate ( Unknown Source )
at org . apache . xerces . impl . dtd . XMLDTDValidator . handleStartElement ( Unknown Source )
at org . apache . xerces . impl . dtd . XMLDTDValidator . startElement ( Unknown Source )
at org . apache . xerces . impl . XMLNSDocumentScannerImpl . scanStartElement ( Unknown Source )
at org . apache . xerces . impl . XMLDocumentFragmentScannerImpl $ FragmentContentDispatcher . dispatch ( Unknown Source )
at org . apache . xerces . impl . XMLDocumentFragmentScannerImpl . scanDocument ( Unknown Source )
at org . apache . xerces . parsers . XML11Configuration . parse ( Unknown Source )
at org . apache . xerces . parsers . XML11Configuration . parse ( Unknown Source )
at org . apache . xerces . parsers . XMLParser . parse ( Unknown Source )
at org . apache . xerces . parsers . AbstractSAXParser . parse ( Unknown Source )
at org . dom4j . io . SAXReader . read ( SAXReader . java : 465 )
at net . sf . hibernate . cfg . Configuration . addInputStream ( Configuration . java : 268 )
… 4 more
java . lang . ExceptionInInitializerError
at meuservico . HibernateUtil .( HibernateUtil . java : 37 )
at daos . PessoaDAO .( PessoaDAO . java : 19 )
at daos . TesteAmigo . main ( TesteAmigo . java : 14 )
Caused by : net . sf . hibernate . MappingException : Error reading resource : daos / Endereco . hbm . xml
at net . sf . hibernate . cfg . Configuration . addClass ( Configuration . java : 312 )
at meuservico . HibernateUtil .( HibernateUtil . java : 33 )
… 2 more
Caused by : net . sf . hibernate . MappingException : invalid mapping
at net . sf . hibernate . cfg . Configuration . addInputStream ( Configuration . java : 269 )
at net . sf . hibernate . cfg . Configuration . addClass ( Configuration . java : 309 )
… 3 more
Caused by : org . xml . sax . SAXParseException : Attribute “ name ” must be declared for element type “ param ” .
at org . apache . xerces . util . ErrorHandlerWrapper . createSAXParseException ( Unknown Source )
at org . apache . xerces . util . ErrorHandlerWrapper . error ( Unknown Source )
at org . apache . xerces . impl . XMLErrorReporter . reportError ( Unknown Source )
at org . apache . xerces . impl . XMLErrorReporter . reportError ( Unknown Source )
at org . apache . xerces . impl . dtd . XMLDTDValidator . addDTDDefaultAttrsAndValidate ( Unknown Source )
at org . apache . xerces . impl . dtd . XMLDTDValidator . handleStartElement ( Unknown Source )
at org . apache . xerces . impl . dtd . XMLDTDValidator . startElement ( Unknown Source )
at org . apache . xerces . impl . XMLNSDocumentScannerImpl . scanStartElement ( Unknown Source )
at org . apache . xerces . impl . XMLDocumentFragmentScannerImpl $ FragmentContentDispatcher . dispatch ( Unknown Source )
at org . apache . xerces . impl . XMLDocumentFragmentScannerImpl . scanDocument ( Unknown Source )
at org . apache . xerces . parsers . XML11Configuration . parse ( Unknown Source )
at org . apache . xerces . parsers . XML11Configuration . parse ( Unknown Source )
at org . apache . xerces . parsers . XMLParser . parse ( Unknown Source )
at org . apache . xerces . parsers . AbstractSAXParser . parse ( Unknown Source )
at org . dom4j . io . SAXReader . read ( SAXReader . java : 465 )
at net . sf . hibernate . cfg . Configuration . addInputStream ( Configuration . java : 268 )
… 4 more
fabio.patricio 15 de jun. de 2005
betobcsc:
Correto novamente
Agora erro na outro mapeamento…endereco
Cara tu ta lendo o stack pra ver o que ocorre?
]['s
robertoeb 15 de jun. de 2005
Amigo estou lendo sim… mas nao consegui entender… sera que tem algum lugar que posso aprender a identificar esses erros?
fabio.patricio 15 de jun. de 2005
Sim.
Quando pegar um stack destes procura onde diz
E apos os : tenta entender o que a mensagem quer dizer.
Exemplo:
Ou seja, pra ti agora a mensagem que interessa é esta.
Agora sim, se nao entender o que ela quer dizer pergunta por aqui. As vezes o erro é tao basico que uma lida no stack ja mata a questao. E é bom saber extrair informacao dele senao nunca vai conseguir evoluir.
]['s
keller 15 de jun. de 2005
sera que tem algum lugar que posso aprender a identificar esses erros?
Dicionario de Ingles! + Um pouco de intuição…
gui.
Mauricio_Linhares 15 de jun. de 2005
Na boa, eu não coloquei nenhuma classe com pacote no tutorial, exatamente pra evitar esse tipo de problema, retire todas as declarações de pacote que você colocou e deixe os arquivos do mesmo modo que estão no tutorial.
Os arquivos fonte são os que estão dentro de “Hibernate\Java\src”.
Depois que você tiver testado tudo aí você muda os pacotes e faz o que você quizer