spring and birt [message #146487] |
Tue, 21 March 2006 09:01  |
Eclipse User |
|
|
|
Originally posted by: mishra.vaibhav.gmail.com
Hi,
Instead of accessing the database directly using jdbc datasources, I want
to use some java api. I tried the samples related to scripted datasource
using POJOs.
Now, the problem is that my application uses spring, and the objects can
not be instantiated directly. Instead they have to be accessed through the
web application context like -
///////////////////////////////////////////////
WebApplicationContext ctx =
WebApplicationContextUtils.getRequiredWebApplicationContext( servletContext);
return ctx.getBean(name);
///////////////////////////////////////////////
If I could get servletContext somehow in BIRT, this could be used.
However, I could not find the way to do this.
So, I tried another way which does not requires ServletContext -
///////////////////////////////////////////////
ClassPathXmlApplicationContext appContext = new
ClassPathXmlApplicationContext(
new String[] { "/WEB-INF/web.xml",
"/WEB-INF/applicationContext.xml",
"/WEB-INF/applicationContext-hibernate.xml" });
BeanFactory factory = (BeanFactory) appContext;
return factory.getBean(name);
///////////////////////////////////////////////
The problem is now that when I run the report, BIRT is unable to parse the
web.xml and the cause of exception is -
///////////////////////////////////////////////
Caused by: org.eclipse.birt.data.engine.core.DataException: A BIRT
exception occurred: Error evaluating Javascript expression. Script engine
error: Wrapped
org.springframework.beans.factory.BeanDefinitionStoreExcepti on:
IOException parsing XML document from class path resource
[WEB-INF/web.xml]; nested exception is java.net.ConnectException:
Connection timed out: connect (DataSet[Data Set].__bm_OPEN#2)
///////////////////////////////////////////////
Can anyone suggest something why I am getting this connection timeout?
My web.xml contains following lines in the beginning -
///////////////////////////////////////////////
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
///////////////////////////////////////////////
Thanks
Vaibhav
|
|
|
|
|
Re: spring and birt [message #146730 is a reply to message #146703] |
Wed, 22 March 2006 02:21  |
Eclipse User |
|
|
|
Originally posted by: mishra.vaibhav.gmail.com
Hey, I solved the problem. It was due to wrong return statement in fetch
method.
Now, I correct it as -
============================
if(!iter.hasNext()) {
return false;
}
node = iter.next();
row["username"] = node.getUsername();
row["firstName"] = node.getFirstName();
row["lastName"] = node.getLastName();
row["email"] = node.getEmail();
row["phone"] = node.getPhone();
row["department"] = node.getDepartment();
return true;
============================
|
|
|
Powered by
FUDForum. Page generated in 0.04516 seconds