Archiwum
predeploy for PersistenceUnit failed
Poniżej zamieściłem fragment bardzo ładnego wyjątku 😉 i jestem ciekaw skąd się to bierze?
W NetBeans stworzyłem projekt „Java EE” -> „Enterprise Application”, później „Entity Classes from Database”, jakiś kontroler i przy próbie uruchomienia pojawia się taki wyjątek.
Google nie dały odpowiedzi, więc usunąłem persistence.xml i stworzyłem PU jeszcze raz z nową nazwą.
Tym razem poszło. Dlaczego tak? Nie wiem. I w sumie to nie pierwsza taka sytuacja.
Jeśli ktoś zna odpowiedź będę wdzięczny za podpowiedź 🙂
deployed with moduleid = iStockeXchange [CIACH] Parent -> EJBClassLoader : urlSet = [] doneCalled = false Parent -> java.net.URLClassLoader@78ff9053 was requested to find class eu.ryznar.currency.dao.CurrencyDao after done was invoked from the following stack trace java.lang.Throwable at com.sun.enterprise.loader.EJBClassLoader.findClassData(EJBClassLoader.java:708) at com.sun.enterprise.loader.EJBClassLoader$DelegatingClassLoader.findClass(EJBClassLoader.java:1377) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at oracle.toplink.essentials.ejb.cmp3.persistence.PersistenceUnitProcessor.loadClass(PersistenceUnitProcessor.java:262) at oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataProcessor.processPersistenceUnitClasses(MetadataProcessor.java:413) [CIACH] Exception [TOPLINK-28018] (Oracle TopLink Essentials - 2.1 (Build b60e-fcs (12/23/2008))): oracle.toplink.essentials.exceptions.EntityManagerSetupException Exception Description: predeploy for PersistenceUnit [iStockeXchange-currency-ejbPU] failed. Internal Exception: Exception [TOPLINK-30007] (Oracle TopLink Essentials - 2.1 (Build b60e-fcs (12/23/2008))): oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException Exception Description: An exception was thrown while loading class: eu.ryznar.currency.dao.CurrencyDao to check whether it implements @Entity, @Embeddable, or @MappedSuperclass. Internal Exception: java.lang.ClassNotFoundException: eu.ryznar.currency.dao.CurrencyDao javax.persistence.PersistenceException: Exception [TOPLINK-28018] (Oracle TopLink Essentials - 2.1 (Build b60e-fcs (12/23/2008))): oracle.toplink.essentials.exceptions.EntityManagerSetupException Exception Description: predeploy for PersistenceUnit [iStockeXchange-currency-ejbPU] failed. Internal Exception: Exception [TOPLINK-30007] (Oracle TopLink Essentials - 2.1 (Build b60e-fcs (12/23/2008))): oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException Exception Description: An exception was thrown while loading class: eu.ryznar.currency.dao.CurrencyDao to check whether it implements @Entity, @Embeddable, or @MappedSuperclass. Internal Exception: java.lang.ClassNotFoundException: eu.ryznar.currency.dao.CurrencyDao at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:644) [CIACH] Caused by: Exception [TOPLINK-28018] (Oracle TopLink Essentials - 2.1 (Build b60e-fcs (12/23/2008))): oracle.toplink.essentials.exceptions.EntityManagerSetupException Exception Description: predeploy for PersistenceUnit [iStockeXchange-currency-ejbPU] failed. Internal Exception: Exception [TOPLINK-30007] (Oracle TopLink Essentials - 2.1 (Build b60e-fcs (12/23/2008))): oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException Exception Description: An exception was thrown while loading class: eu.ryznar.currency.dao.CurrencyDao to check whether it implements @Entity, @Embeddable, or @MappedSuperclass. Internal Exception: java.lang.ClassNotFoundException: eu.ryznar.currency.dao.CurrencyDao at oracle.toplink.essentials.exceptions.EntityManagerSetupException.predeployFailed(EntityManagerSetupException.java:228) ... 73 more Caused by: Exception [TOPLINK-30007] (Oracle TopLink Essentials - 2.1 (Build b60e-fcs (12/23/2008))): oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException Exception Description: An exception was thrown while loading class: eu.ryznar.currency.dao.CurrencyDao to check whether it implements @Entity, @Embeddable, or @MappedSuperclass. Internal Exception: java.lang.ClassNotFoundException: eu.ryznar.currency.dao.CurrencyDao at oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException.exceptionLoadingClassWhileLookingForAnnotations(PersistenceUnitLoadingException.java:161) at oracle.toplink.essentials.ejb.cmp3.persistence.PersistenceUnitProcessor.loadClass(PersistenceUnitProcessor.java:265) at oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataProcessor.processPersistenceUnitClasses(MetadataProcessor.java:413) at oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataProcessor.processPersistenceUnitClasses(MetadataProcessor.java:373) at oracle.toplink.essentials.ejb.cmp3.persistence.PersistenceUnitProcessor.processORMetadata(PersistenceUnitProcessor.java:292) at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:608) ... 72 more Caused by: java.lang.ClassNotFoundException: eu.ryznar.currency.dao.CurrencyDao at com.sun.enterprise.loader.EJBClassLoader.findClassData(EJBClassLoader.java:710) at com.sun.enterprise.loader.EJBClassLoader$DelegatingClassLoader.findClass(EJBClassLoader.java:1377) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at oracle.toplink.essentials.ejb.cmp3.persistence.PersistenceUnitProcessor.loadClass(PersistenceUnitProcessor.java:262) ... 76 more CORE5021: Application NOT loaded: [iStockeXchange] ADM1075:Error on listening event:[Error while loading application [iStockeXchange]. Please refer to the server log for more details. ]
JSF i EJB 3 – prosta aplikacja CRUD
Tutorial do którego dzisiaj się odniosę to prosta aplikacja webowa wykonana w środowisku Netbeans z wykorzystaniem JSF, EJB 3 oraz bazy danych (autor wykorzystuje PostgreSQL, ja miałem pod ręką MySQL – ale w tym przypadku baza nie robi różnicy).
Tutorial składa się z trzech części: pierwsza druga i trzecia
U mnie problemy zaczęły się w trzeciej części, w drugim kroku „Add fields to the User Entity Bean”
Po dodaniu nowych pól do bazy i klasy aplikacja przestała działać – pojawił sie wyjątek, już nie pamiętam dokładnie co tam pisało 😛 ale jakiś problem z PU i odnalezieniem klasy UserDAOBean.
Jak sobie z tym poradziłem? W części webowej aplikacji, z gałęzi „Libraries” usunąłem JumpStartEjbJsf-ejb.jar i dodałem go jeszcze raz. Czy można inaczej, nie wiem. Jeśli ktoś ma pomysł proszę o podpowiedź.
Ale to nie koniec. Kolejny problem to kroki 3-7. Po dodaniu do gałęzi „Libraries” podanych bibliotek Apache Commons Lang, Apache Commons Validator oraz Jakarta Oro, i próbie dodania użytkownika z błędnym mejlem dostałem taki wyjątek
codjava.lang.NoClassDefFoundError: org/apache/commons/validator/EmailValidator
to samo z lang/StringUtils. Oczywiście wujek Google prawie zawsze pomaga, no i tutaj podpowiada żeby te pliki *jar wrzucić do katalogu /WEB-INF/lib – pomogło.
Jednak walidacja mejla nadal sypie wyjątkami, tym razem
javax.servlet.ServletException: Uncompilable source code.
Problem leży w klasie EmailValidator, nie ma takiej metody jak
htmlInputText.getLabel()
Oczywiście znowu google, przeglądanie API i taki przebłysk, skąd w gałęzi „Libraries” mam MyFaces? Okazuje się że podczas dodawania JSF do projektu z menu „Properties”, w zakładce „Libraries” opcja „Registered Libraries” domyślnie wybrane jest „Facelets 1.1.14 MyFaces”. W związku z tym usunąłem te pliki jar, i z menu kontekstowego „Add Library…” wybrałem JSF 1.2.
Co się okazuje, tu metoda getLabel() jest, i poprzedni problem również znika, tzn można usunąć katalog /lib z WEB-INF i wszystko ładnie działa.
Źródeł nie zamieszczam, w przytoczonym tutorialu źródła są pełne, więc przerabiajac go nic nam nie umknie 🙂
Mam nadzieję że nie ma jakiś strasznych herezji w tym artykule 😉 jeśli są proszę o zwrócenie mi uwagi.
Pozdrawiam
Najnowsze komentarze