Java - Problema de Configuración - Spring + iBatis

   
Vista:

Problema de Configuración - Spring + iBatis

Publicado por Cecilia (4 intervenciones) el 10/02/2009 01:51:26
Hola, estoy realizando una llamada desde un jsp que crea un objeto en BD de la siguiente manera:

Application app = new Application();
app.setNamecharge(nombre); //estos son parametros que obtengo del formulario
app.setPhonecharge(telefono);
app.setEmailcharge(correo);
app.setPurpose(proposito);

ApplicationManagementService ams; //esta es mi interfaz
BusinessFactory bf = new BusinessFactory();
ams = (ApplicationManagementService) bf.getBusinessObject("applicationManagementService");
ams.addApplication(app);

Me da el siguiente error:

javax.servlet.ServletException: java.lang.NoClassDefFoundError: Could not initialize class ve.com.sinru.worktables.util.BusinessFactory

----------------------------------------------------------------------------------------------------------------------
StandardWrapperValve[jsp]: PWC1406: Servlet.service() for servlet jsp threw exception
java.lang.NoClassDefFoundError: Could not initialize class ve.com.sinru.worktables.util.BusinessFactory
at org.apache.jsp.crearTema_jsp._jspService(crearTema_jsp.java from :289)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:93)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:470)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:364)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:288)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)

------------------------------------------FIN DEL ERROR---------------------------------------------------------

Mi clase BusinessFactory tiene:

private ApplicationContext dataSourceCtx;
private BeanFactory factory;

public BusinessFactory()
{
dataSourceCtx = new ClassPathXmlApplicationContext("/spring-config.xml");

factory = (BeanFactory) dataSourceCtx
}

public Object getBusinessObject(String name)
{
return factory.getBean(name);
}
}

Mi archivo de configuración de spring:

....
<beans>
<!-- =============== DataSource ================== -->

<!-- BASE DE DATOS DEL AMBIENTE DE DESARROLLO-->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="org.postgresql.Driver" />
<property name="url" value="jdbc:postgresql://127.0.0.1/wtdb" />
<property name="username" value="wtadmin" />
<property name="password" value="wtadmin123" />
<property name="initialSize" value="5" />
<property name="maxActive" value="10" />
</bean>
<!-- =============== SqlMapClient ================ -->
<bean id="sqlMapClient"
class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="configLocation" value="ibatis-config.xml" />
</bean>

<bean id="genericDao"
class="ve.com.sinru.worktables.dao.GenericDao">
<constructor-arg index="0">
<ref local="sqlMapClient" />
</constructor-arg>
</bean>
<!-- ================ Service Components ======== -->
<bean id="applicationManagementService"
class="ve.com.sinru.worktables.service.impl.ApplicationManagementServiceImpl">
<constructor-arg index="0">
<ref local="genericDao" />
</constructor-arg>
</bean>

.......
</beans>

Mi archivo de configuración de iBatis:

<sqlMapConfig>

<!-- List the SQL Map XML files. -->
<sqlMap resource="sqlMaps/applicationDao.xml"/>
......
</sqlMapConfig>


applicationDao.xml:
<sqlMap namespace="ApplicationDao">
<typeAlias alias="Application" type="ve.com.sinru.worktables.domain.Application"/>


<resultMap id="ApplicationResult" class="Application">
<result property="idtopic" column="idtopic"/>
<result property="title" column="title"/>
<result property="purpose" column="purpose"/>
<result property="daterequest" column="daterequest"/>
<result property="iduserapplication" column="iduserapplication"/>
<result property="namecharge" column="namecharge"/>
<result property="surnamecharge" column="surnamecharge"/>
<result property="phonecharge" column="phonecharge"/>
<result property="celphonecharge" column="celphonecharge"/>
<result property="idunitchargelevel0.idunit" column="idunitchargelevel0"/>
<result property="idunitchargelevel1.idunit" column="idunitchargelevel1"/>
<result property="idunitchargelevel2.idunit" column="idunitchargelevel2"/>
<result property="emailcharge" column="emailcharge"/>
<result property="comment" column="comment"/>
<result property="datechange" column="datechange"/>
<result property="idstatecharge.idstate" column="idstatecharge"/>
<result property="idstatecharge.name" column="name_state"/>
<result property="idstatus.idstatus" column="idstatus"/>
<result property="idstatecharge.idzone.idzone" column="idzone"/>
<result property="idstatecharge.idzone.name" column="name_zone"/>
<result property="idsubsidiarycharge.idsubsidiary" column="idsubsidiarycharge"/>
<result property="idtypeapplication.idtypeapplication" column="idtypeapplication"/>
<result property="idtypeemploymentcharge.idtypeemployment" column="idtypeemploymentcharge"/>
<result property="iduser.iduser" column="iduser"/>
<result property="idunit.idunit" column="idunit"/>
</resultMap>
<!-- Insert a new Application -->

<insert id="addApplication" parameterClass="Application">

INSERT INTO
public.application
VALUES (
nextval('public.idtopic_sec'),
#title#,
#purpose#,
now(),
#idtypeapplication.idtypeapplication#,
#idunit.idunit#,
#iduserapplication#,
#namecharge#,
#surnamecharge#,
#phonecharge#,
#celphonecharge#,
#idunitchargelevel0.idunit#,
#idunitchargelevel1.idunit#,
#idunitchargelevel2.idunit#,
#emailcharge#,
#idstatecharge.idstate#,
#idsubsidiarycharge.idsubsidiary#,
#idtypeemploymentcharge.idtypeemployment#,
1,
#comment#,
#iduser.iduser#,
now()
)

</insert>

....
</sqlMap>

AYUDAAAAAAAAAAAAA POR FAVOR!!!!!!!!!!!! Por qué puede ser que no consigue la clase BusinessFactory???
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Problema de Configuración - Spring + iBatis

Publicado por mario (622 intervenciones) el 10/02/2009 17:18:53
Tienes todas las dependencias en el proyecto web ?

ibatis, spring, commons, etc.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar