Home » Archived » BIRT » Problem when generating dynamic tables(OutOfMemory error)
Problem when generating dynamic tables [message #929664] |
Mon, 01 October 2012 16:48  |
Eclipse User |
|
|
|
Hello all
I have a web application developed in PHP and integrated with birt by PhpJavaBridge. My birt version is 2.6.2. I have an class in java wich i use like an factory to build report itens as php request them.
My JAVA_OPTS was set like in my catalina.bat:
set JAVA_OPTS=%JAVA_OPTS% -Xms512m -Xmx1024m -XX:MaxPermSize=512m -Djava.awt.headless=true
The report itens are built fine, i can see them in the report design, test connection success, preview datasets ..... verything looks like ok. But when i run the report it gives me the error
in eclipse
java.lang.ClassCastException: java.lang.OutOfMemoryError cannot be cast to java.lang.Exception
in tomcat
Exception in thread "http-apr-9191-exec-5" java.lang.OutOfMemoryError: Java heap
space
at org.eclipse.birt.core.util.IOUtil.readUTF(IOUtil.java:1173)
at org.eclipse.birt.core.util.IOUtil.readString(IOUtil.java:810)
at org.eclipse.birt.data.engine.executor.cache.ResultObjectUtil.readData
(ResultObjectUtil.java:187)
at org.eclipse.birt.data.engine.executor.dscache.CacheUtilFactory$DiskLo
adUtil.loadObject(CacheUtilFactory.java:552)
at org.eclipse.birt.data.engine.executor.dscache.DataSetFromCache.loadOb
ject(DataSetFromCache.java:76)
at org.eclipse.birt.data.engine.executor.dscache.DataSetFromCache.fetch(
DataSetFromCache.java:58)
at org.eclipse.birt.data.engine.executor.cache.OdiAdapter.fetch(OdiAdapt
er.java:222)
at org.eclipse.birt.data.engine.executor.cache.RowResultSet.next(RowResu
ltSet.java:105)
at org.eclipse.birt.data.engine.executor.cache.ExpandableRowResultSet.ne
xt(ExpandableRowResultSet.java:63)
at org.eclipse.birt.data.engine.executor.cache.SmartCacheHelper.populate
Data(SmartCacheHelper.java:316)
at org.eclipse.birt.data.engine.executor.cache.SmartCacheHelper.initInst
ance(SmartCacheHelper.java:285)
at org.eclipse.birt.data.engine.executor.cache.SmartCacheHelper.getResul
tSetCache(SmartCacheHelper.java:246)
at org.eclipse.birt.data.engine.executor.cache.SmartCache.<init>(SmartCa
che.java:73)
at org.eclipse.birt.data.engine.executor.transform.pass.PassUtil.populat
eOdiResultSet(PassUtil.java:142)
at org.eclipse.birt.data.engine.executor.transform.pass.PassUtil.pass(Pa
ssUtil.java:62)
at org.eclipse.birt.data.engine.executor.transform.pass.PassManager.doSi
nglePass(PassManager.java:211)
at org.eclipse.birt.data.engine.executor.transform.pass.PassManager.prep
areDataSetResultSet(PassManager.java:94)
at org.eclipse.birt.data.engine.executor.transform.pass.PassManager.pass
(PassManager.java:125)
at org.eclipse.birt.data.engine.executor.transform.pass.PassManager.popu
lateResultSet(PassManager.java:74)
at org.eclipse.birt.data.engine.executor.transform.ResultSetPopulator.po
pulateResultSet(ResultSetPopulator.java:198)
at org.eclipse.birt.data.engine.executor.transform.CachedResultSet.<init
>(CachedResultSet.java:154)
at org.eclipse.birt.data.engine.executor.DataSourceQuery.execute(DataSou
rceQuery.java:1012)
at org.eclipse.birt.data.engine.impl.PreparedOdaDSQuery$OdaDSQueryExecut
or.executeOdiQuery(PreparedOdaDSQuery.java:441)
at org.eclipse.birt.data.engine.impl.QueryExecutor.execute(QueryExecutor
.java:1103)
at org.eclipse.birt.data.engine.impl.ServiceForQueryResults.executeQuery
(ServiceForQueryResults.java:232)
at org.eclipse.birt.data.engine.impl.QueryResults.getResultIterator(Quer
yResults.java:173)
at org.eclipse.birt.report.engine.data.dte.QueryResultSet.<init>(QueryRe
sultSet.java:98)
at org.eclipse.birt.report.engine.data.dte.DteDataEngine.doExecuteQuery(
DteDataEngine.java:168)
at org.eclipse.birt.report.engine.data.dte.DataGenerationEngine.doExecut
eQuery(DataGenerationEngine.java:80)
at org.eclipse.birt.report.engine.data.dte.AbstractDataEngine.execute(Ab
stractDataEngine.java:265)
at org.eclipse.birt.report.engine.executor.ExecutionContext.executeQuery
(ExecutionContext.java:1890)
at org.eclipse.birt.report.engine.executor.QueryItemExecutor.executeQuer
y(QueryItemExecutor.java:80)
|
|
| |
Re: Problem when generating dynamic tables [message #929740 is a reply to message #929736] |
Mon, 01 October 2012 18:19   |
Eclipse User |
|
|
|
Sure this is my builder/factory java class called from php
package builder;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.eclipse.birt.core.framework.Platform;
import org.eclipse.birt.report.model.api.DataItemHandle;
import org.eclipse.birt.report.model.api.DataSetHandle;
import org.eclipse.birt.report.model.api.DataSourceHandle;
import org.eclipse.birt.report.model.api.DesignConfig;
import org.eclipse.birt.report.model.api.DesignElementHandle;
import org.eclipse.birt.report.model.api.ElementFactory;
import org.eclipse.birt.report.model.api.IDesignEngine;
import org.eclipse.birt.report.model.api.IDesignEngineFactory;
import org.eclipse.birt.report.model.api.LabelHandle;
import org.eclipse.birt.report.model.api.OdaDataSetHandle;
import org.eclipse.birt.report.model.api.OdaDataSourceHandle;
import org.eclipse.birt.report.model.api.ReportDesignHandle;
import org.eclipse.birt.report.model.api.SessionHandle;
import org.eclipse.birt.report.model.api.SlotHandle;
import org.eclipse.birt.report.model.api.StructureFactory;
import org.eclipse.birt.report.model.api.StyleHandle;
import org.eclipse.birt.report.model.api.TableHandle;
import org.eclipse.birt.report.model.api.TextItemHandle;
import org.eclipse.birt.report.model.api.activity.SemanticException;
import org.eclipse.birt.report.model.api.command.ContentException;
import org.eclipse.birt.report.model.api.command.NameException;
import org.eclipse.birt.report.model.api.command.StyleException;
import org.eclipse.birt.report.model.api.elements.DesignChoiceConstants;
import org.eclipse.birt.report.model.api.elements.structures.ComputedColumn;
import com.ibm.icu.util.ULocale;
public class ReportBuilder
{
public static final String DefaultTableStyle = "defaultTableStyle";
public static final String DefaultHeaderStyle = "defaultHeaderStyle";
public static final String DefaultDetailStyle = "defaultDetailStyle";
public static final String DefaultLabelStyle = "defaultLabelStyle";
public static final String DefaultReportItemStyle = "defaultReportItemStyle";
private static final String ON_PREPARE = "onPrepare";
private static final String ON_CREATE = "onCreate";
private static final String ON_RENDER = "onRender";
private static final String ON_PAGE_BREAK = "onPageBreak";
static Map<String, String> scriptMap = new HashMap<String, String>();
static ReportDesignHandle designHandle = null;
static ElementFactory designFactory = null;
static StructureFactory structFactory = null;
static SessionHandle session = null;
static IDesignEngine designEngine = null;
static DesignConfig designConfig = null;
static IDesignEngineFactory factory = null;
private String reportPath = null;
public void prepareOnPrepare(String script){
scriptMap.put(ON_PREPARE, script);
}
public void prepareOnCreate(String script){
scriptMap.put(ON_CREATE, script);
}
public void prepareOnRender(String script){
scriptMap.put(ON_RENDER, script);
}
public void prepareOnPageBreak(String script){
scriptMap.put(ON_PAGE_BREAK, script);
}
/**
* Called externally
* @param title
*/
public void setReportTitle(String title){
//Define titulo do relatório como o parametro
try {
designHandle.setTitle( title );
} catch (SemanticException e) {
System.out.println("ERROR: Report title cannot be null !");
e.printStackTrace();
}
}
/**
* Called externally
* @param author
*/
public void setReportAuthor(String author){
//Define titulo do relatório como o parametro
designHandle.setAuthor( author );
}
/**
* Called externally
* @param templatePath
* @param birtHome
*/
public void initReport(String templatePath, String birtHome){
try{
System.out.print(".....Build Report initiated!");
reportPath = templatePath;
designConfig = new DesignConfig();
designConfig.setBIRTHome(birtHome);
// Startup plugins.
Platform.startup( designConfig );
// Open de report design file.
openDesign();
// Removes design elements
dropReportObjects();
// Create default element style.
createStyles();
}catch (Exception e) {
System.out.println("..........ERROR!");
e.printStackTrace();
}
}
private void openDesign() throws Exception{
try{
System.out.print("\n.....Searching for template");
factory = (IDesignEngineFactory) Platform.createFactoryObject( IDesignEngineFactory.EXTENSION_DESIGN_ENGINE_FACTORY );
designEngine = factory.createDesignEngine( designConfig );
session = designEngine.newSessionHandle( ULocale.ENGLISH ) ;
File templateFile = new File(reportPath);
if(templateFile.exists()) {
System.out.println("..........done!");
designHandle = session.openDesign( reportPath );
} else {
System.out.println("..........template not found!");
System.out.print(".....Creating new design");
designHandle = session.createDesign();
System.out.println("..........done!");
}
designFactory = designHandle.getElementFactory( );
}catch( Exception ex){
throw ex;
}
}
/**
* Called externally
* @throws IOException
*/
public void closeReport()throws IOException{
try{
System.out.print(".....Saving report");
designHandle.saveAs(reportPath);
designHandle.close();
// session.closeAll(true);
}catch(IOException e){
System.out.println("..........ERROR!");
e.printStackTrace();
} finally {
System.out.println(".....Finished!");
Platform.shutdown();
}
}
/**
* Called externally
* @param name
* @param url
* @param user
* @param password
* @return OdaDataSourceHandle
*/
public OdaDataSourceHandle buildDataSource(String name, String url,String user, String password)
{
System.out.print(".....Creating dataSource: \""+name+"\"");
try {
OdaDataSourceHandle dsHandle = designFactory.newOdaDataSource("dataSource_"+name, "org.eclipse.birt.report.data.oda.jdbc" );
dsHandle.setProperty( "odaDriverClass", "oracle.jdbc.OracleDriver" );
dsHandle.setProperty( "odaURL", url );
dsHandle.setProperty( "odaUser", user );
dsHandle.setProperty( "odaPassword", password );
//dsHandle.setProperty( "odaJndiName", jndi );
designHandle.getDataSources( ).add( dsHandle );
System.out.println("..........done!");
return dsHandle;
} catch (Exception e) {
System.out.println("..........ERROR!");
e.printStackTrace();
return null;
}
}
/**
* Called externally
* @param name
* @param query
* @param dataSource
* @return
* @throws Exception
*/
public DataSetHandle buildDataSet(String name, String query ,DataSourceHandle dataSource)
{
System.out.print(".....Creating dataSet: \""+name+"\"");
try {
OdaDataSetHandle dsHandle = designFactory.newOdaDataSet( "dataSet_"+name, "org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet" );
dsHandle.setDataSource( dataSource.getName() );
dsHandle.setQueryText( query );
designHandle.getDataSets( ).add( dsHandle );
System.out.println("..........done!");
return dsHandle;
} catch (Exception e) {
System.out.println("..........ERROR!");
e.printStackTrace();
return null;
}
}
/**
* Called externally
* @param name
* @param text
*/
public void addToDesign(DesignElementHandle item)
{
System.out.print(".....Building item: \""+item.getName()+"\"");
try {
designHandle.getBody( ).add( item );
System.out.println("..........done!");
} catch (ContentException e) {
System.out.print("Error adding item to design.\n"+e.getMessage());
e.printStackTrace();
} catch (NameException e) {
System.out.print("Error adding item to design.\n"+e.getMessage());
e.printStackTrace();
}
}
/**
* Called externally
* @param name
* @param text
* @return
*/
public TextItemHandle createTextItem(String name, String text, String contentType, DataSetHandle dataSet,
ArrayList<String>columnBindings, HashMap<String, String> properties)
{
System.out.print(".....Creating text item: \""+name+"\"");
TextItemHandle textItem = designFactory.newTextItem("textItem_"+name);
try {
if (contentType.equalsIgnoreCase("auto")) {
textItem.setContentType( DesignChoiceConstants.TEXT_CONTENT_TYPE_AUTO );
} else if (contentType.equalsIgnoreCase("html")) {
textItem.setContentType( DesignChoiceConstants.TEXT_CONTENT_TYPE_HTML );
} else if (contentType.equalsIgnoreCase("plain")) {
textItem.setContentType( DesignChoiceConstants.TEXT_CONTENT_TYPE_PLAIN );
} else if (contentType.equalsIgnoreCase("rtf")) {
textItem.setContentType( DesignChoiceConstants.TEXT_CONTENT_TYPE_RTF );
}
if(dataSet != null) {
textItem.setDataSet( dataSet );
}
if(columnBindings != null) {
ComputedColumn dataBinding = null;
for(String binding : columnBindings) {
dataBinding = StructureFactory.createComputedColumn();
dataBinding.setName(binding);
dataBinding.setExpression("dataSetRow[\"" + binding + "\"]");
textItem.addColumnBinding(dataBinding, false);
}
}
textItem.setStyleName( DefaultReportItemStyle );
textItem.setContent(text);
textItem = (TextItemHandle)createElementProperties(textItem, properties);
System.out.println("..........done!");
return textItem;
} catch (SemanticException e) {
System.out.println("..........ERROR!");
e.printStackTrace();
return null;
}
}
/**
* Called externally
* @param name
* @param colSize
* @param ds
* @return
*/
public BirtReportTableHandler createTable(String name, int colSize, DataSetHandle ds, HashMap<String, String> properties)
{
try {
System.out.print(".....Creating table item: \""+name+"\"");
BirtReportTableHandler table = new BirtReportTableHandler(designFactory.newTableItem("table_"+name, colSize), ds);
table.setHandler((TableHandle)createElementProperties(table.getHandler(), properties));
System.out.println("..........done!");
return table;
} catch (Exception e) {
System.out.println("Error creating table: "+name+"\n"+e.getMessage());
e.printStackTrace();
return null;
}
}
/**
* Called externally
* @param name
* @param text
* @return
* @throws Exception
*/
public LabelHandle createLabel(String name, String text, HashMap<String, String> properties){
try {
System.out.print(".....Creating label item: \""+name+"\"");
LabelHandle label = designFactory.newLabel( "label_"+name );
label.setStyleName( DefaultLabelStyle );
label.setText( text );
label = (LabelHandle)createElementProperties(label, properties);
System.out.println("..........done!");
return label;
} catch (ContentException e) {
System.out.println("Error creating label: "+name+"\n"+e.getMessage());
e.printStackTrace();
} catch (NameException e) {
System.out.println("Error creating label: "+name+"\n"+e.getMessage());
e.printStackTrace();
} catch (StyleException e) {
System.out.println("Error creating label: "+name+"\n"+e.getMessage());
e.printStackTrace();
} catch (SemanticException e) {
System.out.println("Error creating label: "+name+"\n"+e.getMessage());
e.printStackTrace();
}
return null;
}
/**
* Called externally
* @param name
* @param expression
* @param dataSet
* @param resultSetCol
* @param columnBindings
* @return
* @throws Exception
*/
public DataItemHandle createDataItem(String name, String expression, DataSetHandle dataSet, String resultSetCol,
ArrayList<String>columnBindings, HashMap<String, String> properties) {
System.out.print(".....Creating data item: \""+name+"\"");
DataItemHandle data = designFactory.newDataItem( "data_"+name );
try {
data.setStyleName( DefaultDetailStyle );
if(dataSet != null) {
data.setDataSet( dataSet );
data.setResultSetColumn( resultSetCol );
}
if(columnBindings != null) {
ComputedColumn dataBinding = null;
for(String binding : columnBindings) {
dataBinding = StructureFactory.createComputedColumn();
dataBinding.setName(binding);
dataBinding.setExpression("dataSetRow[\"" + binding + "\"]");
data.addColumnBinding(dataBinding, false);
}
}
data = (DataItemHandle)createElementProperties(data, properties);
System.out.println("..........done!");
return data;
} catch (StyleException e) {
System.out.println("Error creating data item: "+name+"\n"+e.getMessage());
e.printStackTrace();
return null;
} catch (SemanticException e) {
System.out.println("Error creating data item: "+name+"\n"+e.getMessage());
e.printStackTrace();
return null;
}
}
@SuppressWarnings("unchecked")
private void dropReportObjects()throws Exception{
try{
Iterator<Object> reportItens = designHandle.getBody().getContents().iterator();
while(reportItens.hasNext()){
DesignElementHandle designHandler = (DesignElementHandle)reportItens.next();
designHandler.drop();
}
SlotHandle dataSets = designHandle.getDataSets( );
Iterator<DataSetHandle> itDataset = dataSets.iterator();
while(itDataset.hasNext()) {
DataSetHandle dataSet = itDataset.next();
dataSet.drop();
}
SlotHandle dataSources = designHandle.getDataSources( );
Iterator<DataSourceHandle> itDatasource = dataSources.iterator();
while(itDatasource.hasNext()) {
DataSourceHandle dataSource = itDatasource.next();
dataSource.drop();
}
} catch (Exception e){
throw e;
}
}
public static DesignElementHandle createElementProperties(DesignElementHandle element, HashMap<String, String> properties) throws SemanticException {
if(properties != null) {
try {
if(properties.get("borderLeft") != null) {
element.setProperty(StyleHandle.BORDER_LEFT_WIDTH_PROP, properties.get("borderLeft"));
element.setProperty(StyleHandle.BORDER_LEFT_STYLE_PROP, DesignChoiceConstants.LINE_STYLE_SOLID );
element.setProperty(StyleHandle.BORDER_LEFT_COLOR_PROP, "#000000");
}
if(properties.get("borderRight") != null) {
element.setProperty(StyleHandle.BORDER_RIGHT_WIDTH_PROP, properties.get("borderRight"));
element.setProperty(StyleHandle.BORDER_RIGHT_STYLE_PROP, DesignChoiceConstants.LINE_STYLE_SOLID );
element.setProperty(StyleHandle.BORDER_RIGHT_COLOR_PROP, "#000000");
}
if(properties.get("borderTop") != null) {
element.setProperty(StyleHandle.BORDER_TOP_WIDTH_PROP, properties.get("borderTop"));
element.setProperty(StyleHandle.BORDER_TOP_STYLE_PROP, DesignChoiceConstants.LINE_STYLE_SOLID );
element.setProperty(StyleHandle.BORDER_TOP_COLOR_PROP, "#000000");
}
if(properties.get("borderBottom") != null) {
element.setProperty(StyleHandle.BORDER_BOTTOM_WIDTH_PROP, properties.get("borderBottom"));
element.setProperty(StyleHandle.BORDER_BOTTOM_STYLE_PROP, DesignChoiceConstants.LINE_STYLE_SOLID );
element.setProperty(StyleHandle.BORDER_BOTTOM_COLOR_PROP, "#000000");
}
if(properties.get("paddingLeft") != null) element.setProperty(StyleHandle.PADDING_LEFT_PROP, properties.get("paddingLeft"));
if(properties.get("paddingRight") != null) element.setProperty(StyleHandle.PADDING_RIGHT_PROP, properties.get("paddingRight"));
if(properties.get("paddingTop") != null) element.setProperty(StyleHandle.PADDING_TOP_PROP, properties.get("paddingTop"));
if(properties.get("paddingBottom") != null) element.setProperty(StyleHandle.PADDING_BOTTOM_PROP, properties.get("paddingBottom"));
if(properties.get("marginLeft") != null) element.setProperty(StyleHandle.MARGIN_LEFT_PROP, properties.get("marginLeft"));
if(properties.get("marginRight") != null) element.setProperty(StyleHandle.MARGIN_RIGHT_PROP, properties.get("marginRight"));
if(properties.get("marginTop") != null) element.setProperty(StyleHandle.MARGIN_TOP_PROP, properties.get("marginTop"));
if(properties.get("marginBottom") != null) element.setProperty(StyleHandle.MARGIN_BOTTOM_PROP, properties.get("marginBottom"));
} catch (SemanticException e) {
throw e;
}
}
return element;
}
private void createStyles( ) throws Exception{
try{
//Style da Table
StyleHandle tableStyle = designFactory.newStyle( DefaultTableStyle );
tableStyle.setProperty(StyleHandle.CAN_SHRINK_PROP, true);
designHandle.getStyles( ).add( tableStyle );
//Cria o Style do label
StyleHandle labelStyle = designFactory.newStyle( DefaultLabelStyle );
labelStyle.setProperty( StyleHandle.FONT_WEIGHT_PROP,DesignChoiceConstants.FONT_WEIGHT_BOLD );
labelStyle.setProperty( StyleHandle.FONT_SIZE_PROP, DesignChoiceConstants.FONT_SIZE_X_SMALL);
labelStyle.setProperty( StyleHandle.FONT_FAMILY_PROP, "Arial" );
labelStyle.setProperty( StyleHandle.COLOR_PROP, "#000000" );
labelStyle.setProperty( StyleHandle.PADDING_LEFT_PROP, "2" );
labelStyle.setProperty( StyleHandle.PADDING_RIGHT_PROP, "2" );
labelStyle.setProperty( StyleHandle.PADDING_BOTTOM_PROP, "8" );
labelStyle.setProperty( StyleHandle.TEXT_ALIGN_PROP, "Left" );
designHandle.getStyles( ).add( labelStyle );
//Cria o Style do detalhe
StyleHandle dataStyle = designFactory.newStyle( DefaultDetailStyle );
dataStyle.setProperty( StyleHandle.FONT_SIZE_PROP, DesignChoiceConstants.FONT_SIZE_X_SMALL);
dataStyle.setProperty( StyleHandle.FONT_FAMILY_PROP, "Arial"
);
dataStyle.setProperty( StyleHandle.COLOR_PROP, "#000000" );
dataStyle.setProperty( StyleHandle.PADDING_LEFT_PROP, "2" );
dataStyle.setProperty( StyleHandle.PADDING_RIGHT_PROP, "2" );
dataStyle.setProperty( StyleHandle.TEXT_ALIGN_PROP, "Left" );
designHandle.getStyles( ).add( dataStyle );
//Cria o Style da TableHeader Row
StyleHandle headerStyle = designFactory.newStyle( DefaultHeaderStyle );
//headerStyle.setProperty( StyleHandle.BORDER_TOP_STYLE_PROP, DesignChoiceConstants.LINE_STYLE_SOLID );
//headerStyle.setProperty( StyleHandle.BORDER_TOP_COLOR_PROP, "#2275FF" );
//headerStyle.setProperty( StyleHandle.BORDER_TOP_WIDTH_PROP, "2px" );
headerStyle.setProperty( StyleHandle.BORDER_BOTTOM_STYLE_PROP, DesignChoiceConstants.LINE_STYLE_SOLID );
headerStyle.setProperty( StyleHandle.BORDER_BOTTOM_WIDTH_PROP, "2px" );
headerStyle.setProperty( StyleHandle.BORDER_BOTTOM_COLOR_PROP, "#2275FF" );
designHandle.getStyles( ).add( headerStyle );
//Cria o Style do report item
StyleHandle itemStyle = designFactory.newStyle( DefaultReportItemStyle );
itemStyle.setProperty( StyleHandle.FONT_SIZE_PROP, DesignChoiceConstants.FONT_SIZE_X_SMALL);
itemStyle.setProperty( StyleHandle.FONT_FAMILY_PROP, "Arial" );
itemStyle.setProperty( StyleHandle.COLOR_PROP, "#000000" );
designHandle.getStyles( ).add( itemStyle );
}catch(Exception e){
throw new Exception(e.getMessage());
}
}
}
so from php i call each element i wanna build according to my request, after my builder returns the build up java class to my php i add it using the "addToDesign" method, to the design body . It can be a text item and after it 2 tables each one with different data and different report itens and after more 2 text itens elements (my testing example).
|
|
| | | | | | |
Re: Problem when generating dynamic tables [message #931847 is a reply to message #931630] |
Wed, 03 October 2012 15:25   |
Eclipse User |
|
|
|
So in the report you posted, the first and last text item are bound to the same dataset. If you remove one of these the issue goes away?
I no data set caching was improved in 3.7, but these should be caching. One thing to try is to add a grid that contains the first text item, the table and then the last text item. Remove the binding setting for the text items and set it once on the grid. One another note, why in the following code are you setting the dataset on data items instead of setting on the container element?
public DataItemHandle createDataItem(String name, String expression, DataSetHandle dataSet, String resultSetCol,
ArrayList<String>columnBindings, HashMap<String, String> properties) {
System.out.print(".....Creating data item: \""+name+"\"");
DataItemHandle data = designFactory.newDataItem( "data_"+name );
try {
data.setStyleName( DefaultDetailStyle );
if(dataSet != null) {
data.setDataSet( dataSet );
data.setResultSetColumn( resultSetCol );
}
Jason
|
|
|
Re: Problem when generating dynamic tables [message #931963 is a reply to message #931847] |
Wed, 03 October 2012 17:40   |
Eclipse User |
|
|
|
Because i can have a data item with different dataset binding, i already changed these lines to
if(dataSet != null) {
data.setDataSet( dataSet );
if(resultSetCol != null) {
data.setResultSetColumn( resultSetCol );
so when i create a table i dont inform dataItem's data set, just the resultsetcol and bind the dataset to the table. Only if the dataset parameter is set that it will bind it to the data item instead of the container.
Anyway, just tested creating textItens inside a grid with just 1 cell and bound the datasets to the grids instead of the text items. The outOfMemory error still occurs.
|
|
|
Re: Problem when generating dynamic tables [message #931964 is a reply to message #931847] |
Wed, 03 October 2012 17:42   |
Eclipse User |
|
|
|
Because i can have a data item with different dataset binding, i already changed these lines to
if(dataSet != null) {
data.setDataSet( dataSet );
if(resultSetCol != null) {
data.setResultSetColumn( resultSetCol );
so when i create a table i dont inform dataItem's data set, just the resultsetcol and bind the dataset to the table. Only if the dataset parameter is set then it will be bound to the data item instead of the container.
I cant do the grid thing because as this is a dynamic proccess there are cases in what ill have n elements bound to n datasets, i mean in this example i had 2 text item to same dataset and 1 table to another, but what if i had 2 text in dataset 1, 2 table in dataset 2, more 2 texts in dataset 3 and 3 tables in dataset 4, if i follow ur container idea i will have to create a grid for almost each design element.
[Updated on: Wed, 03 October 2012 20:10] by Moderator Report message to a moderator
|
|
|
Re: Problem when generating dynamic tables [message #931988 is a reply to message #931964] |
Wed, 03 October 2012 18:16   |
Eclipse User |
|
|
|
I just created another environment to test this with birt 3.7.2.
In tomcat cleared my javabridge platform folder, copied the lib from 3.7.2 runtime to javabridge lib and also updated the viewer.
First time i run the report is built fine but the outOfMemory error still happens, but second time it start giving me this error
org.eclipse.birt.core.exception.BirtException: error.CannotStartupOSGIPlatform
at org.eclipse.birt.core.framework.Platform.startup(Platform.java:81)
at builder.ReportBuilder.initReport(ReportBuilder.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at php.java.bridge.JavaBridge.Invoke(JavaBridge.java:1044)
at php.java.bridge.Request.handleRequest(Request.java:417)
i checked migration changes and all i did was add runtime lib to my project buildpath and removed the following line from source
designConfig.setBIRTHome(birtHome);
|
|
| | | | | |
Re: Problem when generating dynamic tables [message #933850 is a reply to message #932990] |
Fri, 05 October 2012 11:59   |
Eclipse User |
|
|
|
Jason, i limited the platform lifecycle to user's session in php, before was limited per build request. Now the platform is started during user session, the build became faster but unfortunatelly it still giving me the error
The test was made with platform started, i build up the report and test it without shutting down the platform(because if i do it ill need to restart it again in the next request so i would be back to the same place i was) and when the user ends his session the platform is then shutted down.
[Updated on: Fri, 05 October 2012 12:38] by Moderator Report message to a moderator
|
|
|
Re: Problem when generating dynamic tables [message #933887 is a reply to message #933850] |
Fri, 05 October 2012 12:34   |
Eclipse User |
|
|
|
There is another weird stuff in birt 3.7.2 generated report... when i render it in preview its ok but if i see it in any webviewer (from Eclipse birt 3.7.2 RCP viewer and tomcat viewer) the last text item is duplicated several times.
|
|
| | | | | | | |
Goto Forum:
Current Time: Sat Feb 15 03:15:59 GMT 2025
Powered by FUDForum. Page generated in 0.07143 seconds
|