cancel
Showing results for 
Search instead for 
Did you mean: 

Migrating Spring/Hibernate app from JBoss

Former Member
0 Kudos

Hi!

Can anybody help me with this issue?

I have ported my JBoss Spring/Hibernate application to netweaver(6.40) and when I do deploy this works fine, but if the web server is restarted, i get the following error:

#1.5#000854E05820003F00000007000003F800042848D1D5C32C#1170193130031#com.sap.engine.services.servlets_jsp.WebApplications#sap.com/GestionAcademica1#com.sap.engine.services.servlets_jsp.WebApplications#Guest#2####3c7ebf71b0aa11dbc636000854e05820#SAPEngine_Application_Thread[impl:3]_9##0#0#Error##Plain###action: null The error is: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in ServletContext resource [/WEB-INF/Spring/applicationContext.xml]: Initialization of bean failed; nested exception is com.sap.engine.services.jndi.persistent.exceptions.NameNotFoundException: Object not found in lookup of GestionDS.

com.sap.engine.services.jndi.persistent.exceptions.NameNotFoundException: Object not found in lookup of GestionDS.

at com.sap.engine.services.jndi.implserver.ServerContextImpl.lookup(ServerContextImpl.java:646)

at com.sap.engine.services.jndi.implclient.ClientContext.lookup(ClientContext.java:344)

at com.sap.engine.services.jndi.implclient.OffsetClientContext.lookup(OffsetClientContext.java:254)

at com.sap.engine.services.jndi.implclient.OffsetClientContext.lookup(OffsetClientContext.java:271)

at javax.naming.InitialContext.lookup(InitialContext.java:347)

at javax.naming.InitialContext.lookup(InitialContext.java:347)

at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:123)

at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:85)

at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:121)

at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:146)

at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:86)

at org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:104)

at org.springframework.jndi.JndiObjectFactoryBean.afterPropertiesSet(JndiObjectFactoryBean.java:125)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1059)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:363)

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:226)

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147)

at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:269)

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:320)

at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:134)

at org.springframework.web.struts.ContextLoaderPlugIn.createWebApplicationContext(ContextLoaderPlugIn.java:353)

at org.springframework.web.struts.ContextLoaderPlugIn.initWebApplicationContext(ContextLoaderPlugIn.java:296)

at org.springframework.web.struts.ContextLoaderPlugIn.init(ContextLoaderPlugIn.java:225)

at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:869)

at org.apache.struts.action.ActionServlet.init(ActionServlet.java:336)

at javax.servlet.GenericServlet.init(GenericServlet.java:258)

at com.sap.engine.services.servlets_jsp.server.runtime.context.WebComponents.addServlet(WebComponents.java:134)

at com.sap.engine.services.servlets_jsp.server.container.ApplicationThreadInitializer.loadServlets(ApplicationThreadInitializer.java:376)

at com.sap.engine.services.servlets_jsp.server.container.ApplicationThreadInitializer.run(ApplicationThreadInitializer.java:110)

at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)

at java.security.AccessController.doPrivileged(Native Method)

at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:94)

at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)

#

I'ved checked the xml and hbm.xml files and they are valids.

This is my application-context.xml file:

<?xml version="1.0" encoding="ISO_8859-1"?>

<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

<beans>

<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">

<property name="jndiName" value="jdbc/GestionDS"/>

</bean>

<!Sesion Factory para hibernate>

<bean id="sprSessionfactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">

<property name="dataSource"><ref bean="dataSource"/></property>

<property name="mappingResources">

<list>

<value>Alumno.hbm.xml</value>

<value>AlumnoHojaVida.hbm.xml</value>

<value>AnioLectivo.hbm.xml</value>

<value>AnleXParametro.hbm.xml</value>

<value>BitacoraParametros.hbm.xml</value>

<value>CalendarioEscolar.hbm.xml</value>

<value>CamposTablasBasicas.hbm.xml</value>

<value>DaneDepartamentos.hbm.xml</value>

<value>DaneMunicipios.hbm.xml</value>

<value>Docente.hbm.xml</value>

<value>Evaluaciones.hbm.xml</value>

<value>InInstitucion.hbm.xml</value>

<value>IntensidadHoraria.hbm.xml</value>

<value>Grado.hbm.xml</value>

<value>Horario.hbm.xml</value>

<value>Logro.hbm.xml</value>

<value>LogroIndicador.hbm.xml</value>

<value>LogroInstitucionPeriodo.hbm.xml</value>

<value>NivelDesarrollo.hbm.xml</value>

<value>NivelEnsenanza.hbm.xml</value>

<value>NomenclaturaEvaluacion.hbm.xml</value>

<value>NucleosEducativos.hbm.xml</value>

<value>ParametroDesarrollo.hbm.xml</value>

<value>ParametrosGenerales.hbm.xml</value>

<value>PlanEstudio.hbm.xml</value>

<value>PlanEstudioDocente.hbm.xml</value>

<value>PlanEstudioGrado.hbm.xml</value>

<value>PlanEstudioPei.hbm.xml</value>

<value>PlanEstudioPeiDetalle.hbm.xml</value>

<value>PlantillaFirma.hbm.xml</value>

<value>PlantillaSede.hbm.xml</value>

<value>PlantillaTexto.hbm.xml</value>

<value>RangosTiempoClase.hbm.xml</value>

<value>SedeGrupo.hbm.xml</value>

<value>SedeInstitucion.hbm.xml</value>

<value>SeinJornNiveGrad.hbm.xml</value>

<value>TablasBasicas.hbm.xml</value>

<value>TipoCampo.hbm.xml</value>

<value>TipoCaracter.hbm.xml</value>

<value>TipoEvaluacion.hbm.xml</value>

<value>TipoHojaVidaDetalle.hbm.xml</value>

<value>TipoHojaVidaPrincipal.hbm.xml</value>

<value>TipoHojaVidaSolucion.hbm.xml</value>

<value>TipoIdentificacion.hbm.xml</value>

<value>TipoNivelFolio.hbm.xml</value>

<value>TipoIndicadorLogro.hbm.xml</value>

<value>TipoMetodologia.hbm.xml</value>

<value>TipoValidacionCampo.hbm.xml</value>

<value>Consultas.xml</value>

</list>

</property>

<property name="hibernateProperties">

<props>

<prop key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop>

<prop key="hibernate.show_sql">false</prop>

</props>

</property>

</bean>

<!manejador de transacciones>

<bean id="transactionManager"

class="org.springframework.orm.hibernate3.HibernateTransactionManager">

<property name="sessionFactory"><ref bean="sprSessionfactory"/></property>

</bean>

</beans>

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

hello, I have the same error.

I already made these adjustments and I still have the same problem.

This is my configuration:

<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">

<property name="jndiName" value="java:comp/env/jdbc/bascula_ds"/>

<property name="resourceRef" value="false"/>

</bean>

It works when I start the server and then disconnects. Not able to reconnect unless you restart the application server

Sorry for my English.

Thank you very much for your help

Former Member
0 Kudos

Hi, Indira!

I have the same problem.

Did you resolve this problem?

Thanks.

Ballock.

Former Member
0 Kudos

Thanks Krishna for you reply.

I tried to use the BasicDataSource class to redefine my dataSource Bean, and the problem is solved(The application works fine when I do deploy and when I restart the Web Server), however the performance of all applications deployed in the web server is very slow , and furthermore, the web server has many fallen. If I delete the BasicDataSource configuration and I add the previous configuration using JndiObjectFactoryBean class, the web server is more stable.

Former Member
0 Kudos

Hi,

<u><b>Option-I</b></u>

comment the jndi lookup code

<!--

<property name="jndiName"><value>jdbc/...</value></property>

-->

try the foll:


<bean 
		id="dataSource" 
		class="org.apache.commons.dbcp.BasicDataSource" 
		destroy-method="close">
		<property 
			name="driverClassName" 
			value="com.microsoft.jdbc.sqlserver.SQLServerDriver" 
			/>
		<property 
			name="url" 
			value="jdbc:microsoft:sqlserver://hostname:1433;DatabaseName=dbName" 
			/>
		<property 
			name="username" 
			value="sa" 
			/>
		<property 
			name="password" 
			value="sa" 
			/>
	</bean>

Changes ur hostname,dbName, username & pwd.

<u><b>Option-II</b></u>

U should have created datasource in VisualAdmin. After Restart of webserver , u stop the datasource and start the datasource in V.A

Let me know if any issues.

Wbr,

KK

Former Member
0 Kudos

Hello Benny.

Yes, I was a bean called dataSource, whenever I change this name to ConexionBD but the same error is thrown.

Benny
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello,

Well, do you have a bean called datasource in your application?

Even if thsiis OK, Id suggest to rename it, as I don't think this is a good name for a Bean, as there is a class called datasource in the Java Environment.

regards,

Benny