[jboss-user] [JBoss Seam] - Glassfish example and the entity converter.
soluble
do-not-reply at jboss.com
Sat Jun 9 13:51:09 EDT 2007
If I add the entity converter initialization config to components.xml in the \jboss-seam-1.2.1.GA\examples\glassfish example I find that deploying the app for the first time works. However, deploying subsequent times fails with many errors produced in the log files (detailed below).
To use the entity converter, the following changes need to be made to the Glassfish example:
The following needs to be added to components.xml:
| <core:entity-manager-factory name="dbFactory"
| persistence-unit-name="bookingDatabase"/>
| <core:managed-persistence-context name="entityManager"
| auto-create="true" entity-manager-factory="#{dbFactory}"/>
| <core:entity-converter entity-manager="${entityManager}"/>
|
and the persistence.xml needs to use a JTA factory:
| <?xml version="1.0" encoding="UTF-8"?>
| <persistence xmlns="http://java.sun.com/xml/ns/persistence"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
| http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
| version="1.0">
| <persistence-unit name="bookingDatabase" transaction-type="JTA">
| <provider>org.hibernate.ejb.HibernatePersistence</provider>
| <jta-data-source>jdbc/__default</jta-data-source>
| <properties>
|
| <property name="hibernate.dialect"
| value="org.hibernate.dialect.DerbyDialect"/>
| <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
| <property name="hibernate.show_sql" value="true"/>
| <property name="hibernate.transaction.flush_before_completion" value="true"/>
| <property name="hibernate.transaction.manager_lookup_class"
| value="org.hibernate.transaction.SunONETransactionManagerLookup"/>
| <property name="hibernate.cache.provider_class"
| value="org.hibernate.cache.HashtableCacheProvider"/>
| </properties>
| </persistence-unit>
| </persistence>
|
The first time I deploy the application, the context starts and I have a functioning Hotel Booking system. Subsequent undeploy/deploy cycles, without changing any code results in the following errors and an unfunctioning application.
| ...
| Parent -> EJBClassLoader :
| urlSet = []
| doneCalled = false
| Parent -> java.net.URLClassLoader at 5c3987
|
| was requested to find resource org/hibernate/ejb/persistence_1_0.xsd after done was invoked from the following stack trace
| java.lang.Throwable
| at com.sun.enterprise.loader.EJBClassLoader.findResource(EJBClassLoader.java:458)
| at java.lang.ClassLoader.getResource(ClassLoader.java:977)
| at java.lang.ClassLoader.getResourceAsStream(ClassLoader.java:1159)
| at com.sun.enterprise.loader.EJBClassLoader.getResourceAsStream(EJBClassLoader.java:795)
| at org.hibernate.util.DTDEntityResolver.resolveInHibernateNamespace(DTDEntityResolver.java:78)
| at org.hibernate.cfg.EJB3DTDEntityResolver.resolveEntity(EJB3DTDEntityResolver.java:53)
| at com.sun.org.apache.xerces.internal.util.EntityResolverWrapper.resolveEntity(EntityResolverWrapper.java:107)
| at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.resolveEntity(XMLEntityManager.java:1100)
| at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.resolveDocument(XMLSchemaLoader.java:595)
| at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.findSchemaGrammar(XMLSchemaValidator.java:2403)
| at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1753)
| at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:685)
| at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:400)
| at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(XMLNSDocumentScannerImpl.java:626)
| at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3084)
| at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:912)
| at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:645)
| at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
| at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:508)
| at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
| at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
| at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
| at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:225)
| at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:283)
| at org.hibernate.ejb.packaging.PersistenceXmlLoader.loadURL(PersistenceXmlLoader.java:70)
| at org.hibernate.ejb.packaging.PersistenceXmlLoader.deploy(PersistenceXmlLoader.java:79)
| at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:212)
| at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:120)
| at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:96)
| at org.jboss.seam.core.EntityManagerFactory.startup(EntityManagerFactory.java:74)
| ...
|
| ...
| Parent -> EJBClassLoader :
| urlSet = []
| doneCalled = false
| Parent -> java.net.URLClassLoader at 5c3987
|
| was requested to find class sun.net.www.protocol.http.HttpURLConnection.LogStrings after done was invoked from the following stack trace
| java.lang.Throwable
| at com.sun.enterprise.loader.EJBClassLoader.findClassData(EJBClassLoader.java:707)
| at com.sun.enterprise.loader.EJBClassLoader.findClass(EJBClassLoader.java:627)
| at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
| at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
| at java.util.ResourceBundle$Control.newBundle(ResourceBundle.java:2370)
| at java.util.ResourceBundle.loadBundle(ResourceBundle.java:1400)
| at java.util.ResourceBundle.findBundle(ResourceBundle.java:1365)
| at java.util.ResourceBundle.findBundle(ResourceBundle.java:1294)
| at java.util.ResourceBundle.findBundle(ResourceBundle.java:1294)
| at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1236)
| at java.util.ResourceBundle.getBundle(ResourceBundle.java:964)
| at java.util.logging.Logger.findResourceBundle(Logger.java:1298)
| at java.util.logging.Logger.setupResourceInfo(Logger.java:1326)
| at java.util.logging.Logger.getLogger(Logger.java:326)
| at com.sun.enterprise.server.logging.BaseLogManager.doInitializeLogger(BaseLogManager.java:125)
| at com.sun.enterprise.server.logging.BaseLogManager.addLogger(BaseLogManager.java:195)
| at java.util.logging.Logger.getLogger(Logger.java:278)
| at sun.net.www.protocol.http.HttpURLConnection.<clinit>(HttpURLConnection.java:63)
| at sun.net.www.protocol.http.Handler.openConnection(Handler.java:44)
| at sun.net.www.protocol.http.Handler.openConnection(Handler.java:39)
| at java.net.URL.openConnection(URL.java:945)
| at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:651)
| at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(XMLEntityManager.java:1316)
| at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDocumentEntity(XMLEntityManager.java:1268)
| at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.setInputSource(XMLDocumentScannerImpl.java:280)
| at com.sun.org.apache.xerces.internal.impl.xs.opti.SchemaParsingConfig.parse(SchemaParsingConfig.java:409)
| at com.sun.org.apache.xerces.internal.impl.xs.opti.SchemaParsingConfig.parse(SchemaParsingConfig.java:491)
| at com.sun.org.apache.xerces.internal.impl.xs.opti.SchemaDOMParser.parse(SchemaDOMParser.java:510)
| at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getSchemaDocument(XSDHandler.java:1802)
| at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:531)
| at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:552)
| at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.findSchemaGrammar(XMLSchemaValidator.java:2408)
| at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1753)
| at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:685)
| at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:400)
| at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(XMLNSDocumentScannerImpl.java:626)
| at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3084)
| at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:912)
| at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:645)
| at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
| at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:508)
| at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
| at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
| at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
| at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:225)
| at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:283)
| at org.hibernate.ejb.packaging.PersistenceXmlLoader.loadURL(PersistenceXmlLoader.java:70)
| at org.hibernate.ejb.packaging.PersistenceXmlLoader.deploy(PersistenceXmlLoader.java:79)
| at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:212)
| at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:120)
| at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:96)
| at org.jboss.seam.core.EntityManagerFactory.startup(EntityManagerFactory.java:74)
|
and so on, ending with
PWC1306: Context startup failed due to previous errors
Does anyone have any idea why this might be? It severely affects the code/debug cycle as each time a developer will need to undeploy, restart Glassfish and then redeploy to get things working.
This is a follow on from a previous post (http://www.jboss.org/index.html?module=bb&op=viewtopic&t=110033).
I am using Glassfish v2 build 48 and jboss-1.2.1.GA.
Thanks in advance.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4052828#4052828
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4052828
More information about the jboss-user
mailing list