I´m trying to configure spring + hibernate + jsf in my web application with a glassfish 4.0 server. I use Hibernate in the persistence layer, spring for the business layer and jsf for the web layer. I have configured the hibernate and jsf layers properly. But while I´m trying to configure the spring layer, it doesn´t work.
For configuring the database, I have use MySQL Workbench, and I have connected the hibernate layer with the database properly, all the POJOS are properly created.
But now Im trying to add the spring layer, and it gives me an error in my Application context. The error displayed shows as follows:
And my Aplication file is like this:
Error occurred during deployment: Exception while loading the app :java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 13 in XML document from ServletContext resource [/WEB-INF/salon_bazter.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 13; columnNumber: 90; cvc-complex-type.2.4.c: El comodín coincidente es estricto, pero no se ha encontrado ninguna declaración para el elemento 'jee:jndi-lookup'.. Please see server.log for more details. And the log shows this exception:
ContainerBase.addChild: start: org.apache.catalina.LifecycleException:org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 13 in XML document from ServletContext resource [/WEB-INF/salon_bazter.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 13; columnNumber: 90; cvc-complex-type.2.4.c: El comodín coincidente es estricto, pero no se ha encontrado ninguna declaración para el elemento 'jee:jndi-lookup'. at org.apache.catalina.core.StandardContext.start(StandardContext.java:5920) at com.sun.enterprise.web.WebModule.start(WebModule.java:691) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1041) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:1024) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:747) at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2278) at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1924) at com.sun.enterprise.web.WebApplication.start(WebApplication.java:139) at org.glassfish.internal.data.EngineRef.start(EngineRef.java:122) at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:291) at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:352) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:497) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219) at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491) at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:527) at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:523) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:356)....... My Aplication context shows as follows:
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jee="http://www.springframework.org/schema/jee/spring-jee" xmlns:tx="http://www.springframework.org/schema/tx/spring-tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/jee/spring-jee http://www.springframework.org/schema/jee/spring-jee.xsd http://www.springframework.org/schema/tx/spring-txd http://www.springframework.org/schema/tx/spring-tx.xsd"> <!--Para obtener el pool de conexiones vía jndi name--> <jee:jndi-lookup id="salonBazterDataSource" jndi-name="jdbc/centro_belleza_bazter" /> <!--Para declarar una factoría de Sesiones de hibernate--> <bean id="miSessionFact" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> <property name="dataSource" ref="salonBazterDataSource" /> <property name="annotatedClasses"> <list> <value>model.Cliente</value> <value>model.Noticias</value> <value>model.Tratamiento</value> <value>model.Historico</value> <value>model.VentaTratamiento</value> <value>model.Agenda</value> <value>model.Proveedor</value> <value>model.Trabajador</value> <value>model.Producto</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect" >org.hibernate.dialect.DerbyDialect</prop> <prop key="hibernate.show_sql" >true</prop> <prop key="hibernate.format_sql" >true</prop> </props> </property> </bean> <!--Para declarar un Gestor transaccional de Hibernate--> <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="miSessionFact" /> </bean> <!--Para definir que el Contexto transaccional será administrado por contenedor--> <tx:annotation-driven transaction-manager="transactionManager" /> <!--Para definir un bean de tipo noticiasService--> <bean id="noticiasService" class="negocio.clientes.NoticiasServiceImpl" > <property name="sessionFactory" ref="miSessionFact" /> </bean> The problem seems to be in my jndi declaration. The glassfish-resources where the jdbc is created, looks as follows:
<resources> <jdbc-resource enabled="true" jndi-name="jdbc/centro_belleza_bazter" object-type="user" pool-name="connectionPoolBazter"> <description/> </jdbc-resource> <jdbc-connection-pool allow-non-component-callers="false" associate-with-thread="false" connection-creation-retry-attempts="0" connection-creation-retry-interval-in-seconds="10" connection-leak-reclaim="false" connection-leak-timeout-in-seconds="0" connection-validation-method="auto-commit" datasource-classname="com.mysql.jdbc.jdbc2.optional.MysqlDataSource" fail-all-connections="false" idle-timeout-in-seconds="300" is-connection-validation-required="false" is-isolation-level-guaranteed="true" lazy-connection-association="false" lazy-connection-enlistment="false" match-connections="false" max-connection-usage-count="0" max-pool-size="32" max-wait-time-in-millis="60000" name="connectionPoolBazter" non-transactional-connections="false" ping="false" pool-resize-quantity="2" pooling="true" res-type="javax.sql.DataSource" statement-cache-size="0" statement-leak-reclaim="false" statement-leak-timeout-in-seconds="0" statement-timeout-in-seconds="-1" steady-pool-size="8" validate-atmost-once-period-in-seconds="0" wrap-jdbc-objects="true"> <property name="URL" value="jdbc:mysql://localhost:3306/centro_belleza_bazter?zeroDateTimeBehavior=convertToNull"/> <property name="User" value="root"/> <property name="Password" value="root"/> </jdbc-connection-pool> </resources> Could anybody help me??? Does anybody had the same problem???
Thanks in advance!!!!
Line 13 in XML document from ServletContext resource [/WEB-INF/salon_bazter.xml] is invalid;