I'm working with Spring 2.5, JBOSS 4.0.5 and JPA.
and i get this exception when i try to deploy HP Code:
org..beans.factory.BeanCreationException:nbsp;Errornbsp;creatingnbsp;beannbsp;withnbsp;namenbsp;'entityManagerFactory':nbsp;Invocationnbsp;ofnbsp;initnbsp;methodnbsp;failed;nestednbsp;exceptionnbsp;isnbsp;javax.naming.NameNotFoundException:nbsp;AEDLPersistenceUnitnbsp;notnbsp;boundnbsp;atnbsp;org..beans.factory.support.AbstractAutowireCapableBeanFact..............Causednbsp;by:nbsp;javax.naming.NameNotFoundException:nbsp;AEDLPersistenceUnitnbsp;notnbsp;boundnbsp;atnbsp;org.jnp.server.NamingServer.getBinding(NamingServer.java:529)nbsp;atnbsp;org.jnp.server.NamingServer.getBinding(NamingServer.java:537)nbsp;atnbsp;org.jnp.server.NamingServer.getObject(NamingServer.java:543)nbsp;atnbsp;org.jnp.server.NamingServer.lookup(NamingServer.java:296)nbsp;atnbsp;org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)nbsp;atnbsp;org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)nbsp;atnbsp;javax.naming.InitialContext.lookup(InitialContext.java:392)nbsp;atnbsp;org..jndi.JndiTemplate$1.doInContext(JndiTemplate.java:155)nbsp;atnbsp;org..jndi.JndiTemplate.execute(JndiTemplate.java:88)nbsp;atnbsp;org..jndi.JndiTemplate.lookup(JndiTemplate.java:153)nbsp;atnbsp;org..jndi.JndiTemplate.lookup(JndiTemplate.java:178)nbsp;atnbsp;org..jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:95)nbsp;atnbsp;org..jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:105)nbsp;atnbsp;org..jndi.JndiObjectFactoryBean.lookupWithFallback(JndiObjectFactoryBean.java:200)nbsp;atnbsp;org..jndi.JndiObjectFactoryBean.afterPropertiesSet(JndiObjectFactoryBean.java:186)nbsp;atnbsp;org..beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369)nbsp;atnbsp;org..beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)nbsp;...nbsp;150nbsp;morenbsp;
These are my configuration files.
web.xmlPHP Code:
lt;?xmlnbsp;version="1.0"nbsp;encoding="UTF-8"?gt;lt;web-appnbsp;version="2.5"nbsp;xmlns:xsi="2001/XMLSchema-instance"nbsp;xmlns="xml/ns/javaee"nbsp;xmlns:web="xml/ns/javaee/web-app_2_5.xsd"nbsp;id="WebApp_ID"nbsp;gt;lt;display-namegt;AEDLlt;/display-namegt;lt;context-paramgt;lt;param-namegt;javax.faces.DEFAULT_SUFFIXlt;/param-namegt;lt;param-valuegt;.xhtmllt;/param-valuegt;lt;/context-paramgt;lt;context-paramgt;lt;param-namegt;javax.faces.CONFIG_FILESlt;/param-namegt;lt;param-valuegt;/WEB-INF/jsf/faces-config.xml,nbsp;/WEB-INF/jsf/managed-beans.xml,nbsp;/WEB-INF/jsf/navigation-rules.xmlnbsp;lt;/param-valuegt;lt;/context-paramgt;lt;context-paramgt;lt;param-namegt;facelets.REFRESH_PERIODlt;/param-namegt;lt;param-valuegt;2lt;/param-valuegt;lt;/context-paramgt;lt;context-paramgt;lt;param-namegt;facelets.DEVELOPMENTlt;/param-namegt;lt;param-valuegt;truelt;/param-valuegt;lt;/context-paramgt;lt;context-paramgt;lt;param-namegt;javax.faces.STATE_SAVING_METHODlt;/param-namegt;lt;param-valuegt;clientlt;/param-valuegt;lt;/context-paramgt;lt;context-paramgt;lt;param-namegt;com.sun.faces.validateXmllt;/param-namegt;lt;param-valuegt;truelt;/param-valuegt;lt;/context-paramgt;lt;context-paramgt;lt;param-namegt;com.sun.faces.verifyObjectslt;/param-namegt;lt;param-valuegt;truelt;/param-valuegt;lt;/context-paramgt;lt;context-paramgt;lt;param-namegt;org.ajax4jsf.SKINlt;/param-namegt;lt;param-valuegt;blueSkylt;/param-valuegt;lt;/context-paramgt;lt;context-paramgt;lt;param-namegt;org.richfaces.SKINlt;/param-namegt;lt;param-valuegt;blueSkylt;/param-valuegt;lt;/context-paramgt;lt;context-paramgt;lt;param-namegt;contextConfigLocationlt;/param-namegt;lt;param-valuegt;/WEB-INF/spring/applicationContext-business.xmlnbsp;/WEB-INF/spring/applicationContext-jdbc.xmlnbsp;lt;/param-valuegt;lt;/context-paramgt;lt;persistence-unit-refgt;lt;descriptiongt;Unidadnbsp;denbsp;persistencianbsp;paranbsp;AEDL.nbsp;lt;/descriptiongt;lt;persistence-unit-ref-namegt;persistence/AEDLPersistenceUnitlt;/persistence-unit-ref-namegt;lt;persistence-unit-namegt;AEDLPersitenceUnitlt;/persistence-unit-namegt;lt;/persistence-unit-refgt;lt;!--nbsp;Listenernbsp;loadsnbsp;thenbsp;rootnbsp;applicationnbsp;contextnbsp;ofnbsp;thisnbsp;webnbsp;appnbsp;atnbsp;startup.nbsp;--gt;lt;listenergt;lt;listener-classgt;org..web.context.ContextLoaderListenerlt;/listener-classgt;lt;/listenergt;lt;filtergt;lt;display-namegt;Ajax4jsfnbsp;Filterlt;/display-namegt;lt;filter-namegt;ajax4jsflt;/filter-namegt;lt;filter-classgt;org.ajax4jsf.Filterlt;/filter-classgt;lt;init-paramgt;lt;param-namegt;createTempFileslt;/param-namegt;lt;param-valuegt;truelt;/param-valuegt;lt;/init-paramgt;lt;init-paramgt;lt;param-namegt;maxRequestSizelt;/param-namegt;lt;param-valuegt;20000000lt;/param-valuegt;lt;/init-paramgt;lt;/filtergt;lt;filtergt;lt;filter-namegt;faces-redirect-filterlt;/filter-namegt;lt;filter-classgt;filter.FacesRedirectFilterlt;/filter-classgt;lt;/filtergt;lt;filter-mappinggt;lt;filter-namegt;ajax4jsflt;/filter-namegt;lt;servlet-namegt;Facesnbsp;Servletlt;/servlet-namegt;lt;dispatchergt;REQUESTlt;/dispatchergt;lt;dispatchergt;FORWARDlt;/dispatchergt;lt;dispatchergt;INCLUDElt;/dispatchergt;lt;/filter-mappinggt;lt;filter-mappinggt;lt;filter-namegt;faces-redirect-filterlt;/filter-namegt;lt;ucl-patterngt;/pages/*lt;/ucl-patterngt;lt;/filter-mappinggt;lt;servletgt;lt;servlet-namegt;Facesnbsp;Servletlt;/servlet-namegt;lt;servlet-classgt;javax.faces.webapp.FacesServletlt;/servlet-classgt;lt;load-on-startupgt;1lt;/load-on-startupgt;lt;/servletgt;lt;servlet-mappinggt;lt;servlet-namegt;Facesnbsp;Servletlt;/servlet-namegt;lt;ucl-patterngt;*.jsflt;/ucl-patterngt;lt;/servlet-mappinggt;lt;session-configgt;lt;session-timeoutgt;20lt;/session-timeoutgt;lt;/session-configgt;lt;welcome-file-listgt;lt;welcome-filegt;index.htmllt;/welcome-filegt;lt;/welcome-file-listgt;lt;/web-appgt;
applicationContext-jdbc.xml
PHP Code:
lt;beansnbsp;xmlns="schema/beans"nbsp;xmlns:xsi="2001/XMLSchema-instance"nbsp;xmlns:jee="schema/jee"nbsp;xmlns:tx="schema/tx"nbsp;xmlns:context="schema/context"nbsp;xsi:schemaLocation="schema/beansnbsp;schema/beans/spring-beans-2.0.xsdnbsp;schema/jeenbsp;schema/jee/spring-jee-2.0.xsdnbsp;schema/txnbsp;schema/tx/spring-tx-2.5.xsdnbsp;schema/contextnbsp;schema/context/spring-context-2.5.xsd"gt;lt;jee:jndi-lookupnbsp;id="entityManagerFactory"nbsp;jndi-name="java:/AEDLPersistenceUnit"/gt;lt;!--nbsp;Let'snbsp;accessnbsp;thenbsp;JTAnbsp;transactionnbsp;managernbsp;ofnbsp;thenbsp;applicationnbsp;servernbsp;--gt;lt;beannbsp;id="txManager"nbsp;class="org..transaction.jta.JtaTransactionManager"gt;lt;propertynbsp;name="transactionManagerName"nbsp;value="java:/TransactionManager"/gt;lt;propertynbsp;name="userTransactionName"nbsp;value="UserTransaction"/gt;lt;/beangt;lt;/beansgt;#91 HP#93 ersitence.xmlnbsp;
lt;?xml version=quot;1.0quot; encoding=quot;UTF-8quot;?gt;
lt;persistence version=quot;1.0quot; xmlns=quot;xml/ns/persistencequot; xmlns:xsi=quot;2001/XMLSchema-instancequot; xsi:schemaLocation=quot;xml/ns/persistence xml/ns/persistence/persistence_1_0.xsdquot;gt;
lt;persistence-unit name=quot;AEDLPersistenceUnitquot; transaction-type=quot;JTAquot;gt;
lt;providergt;org.hibernate.ejb.HibernatePersistence lt;/providergt;
lt;jta-data-sourcegt;java:mysqlDSlt;/jta-data-sourcegt;
lt;propertiesgt;
lt;property name=quot;hibernate.dialectquot; value=quot;org.hibernate.dialect.MySQLDialectquot; /gt; lt;property name=quot;hibernate.transaction.manager_lookup_classquot; value=quot;org.hibernate.transaction.JBossTransactionM anagerLookupquot;/gt; lt;property name=quot;jboss.entity.manager.factory.jndi.namequot; value=quot;java:/AEDLPersistenceUnitquot;/gt; lt;property name=quot;hibernate.case.user_query_cachequot; value=quot;truequot; /gt;
lt;property name=quot;hibernate.show_sqlquot; value=quot;truequot; /gt;
lt;property name=quot;hibernate.hbm2ddl.autoquot; value=quot;nonequot; /gt;
lt;/propertiesgt;
lt;/persistence-unitgt;
lt;/persistencegt;
#91;/PHP#93;Thanks for yout time..
I solved my earlier problem but now i get this exception:
org..beans.factory.BeanCreationExce ption: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/spring/applicationContext-jdbc.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: org.hibernate.HibernateException: Hibernate Dialect must be explicitly set
Is there a way the dialect?
This is the way i declare my entity manager in applicationContext.xmlPHP Code:
lt;beannbsp;id="entityManagerFactory"nbsp;class="org..orm.jpa.LocalEntityManagerFactoryBean"gt;lt;propertynbsp;name="persistenceUnitName"nbsp;value="AEDLPersitenceUnit"nbsp;/gt;lt;propertynbsp;name="jpaVendorAdapter"gt;lt;beannbsp;id="jpaVendorAdapter"nbsp;class="org..orm.jpa.vendor.HibernateJpaVendorAdapter"gt;lt;propertynbsp;name="showSql"nbsp;value="true"nbsp;/gt;lt;propertynbsp;name="generateDdl"nbsp;value="false"nbsp;/gt;lt;propertynbsp;name="database"nbsp;value="MYSQL"nbsp;/gt;lt;propertynbsp;name="databasePlatform"nbsp;value="org.hibernate.dialect.MySQLDialect"nbsp;/gt;lt;/beangt;lt;/propertygt;lt;propertynbsp;name="jpaDialect"gt;lt;beannbsp;class="org..orm.jpa.vendor.HibernateJpaDialect"nbsp;/gt;lt;/propertygt;lt;/beangt;
I tried without jpaDialect property and doesn't work either.
any ideas?? |