Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
I am getting this error on Tomcat server
hamsa
Hi
Pls help me on this error.
Table table:
- Can not load the report query: 11. Errors occurred when generating the report document for the report element with ID 11. (Element ID:11)
Error.ReportQueryLoadingError2 ( 1 time(s) )
detail : org.eclipse.birt.report.engine.api.EngineException: Can not load the report query: 11. Errors occurred when generating the report document for the report element with ID 11. (Element ID:11)
at org.eclipse.birt.report.engine.data.dte.DataPresentationEngine.doExecuteQuery(DataPresentationEngine.java:164)
at org.eclipse.birt.report.engine.data.dte.AbstractDataEngine.execute(AbstractDataEngine.java:267)
at org.eclipse.birt.report.engine.executor.ExecutionContext.executeQuery(ExecutionContext.java:1939)
at org.eclipse.birt.report.engine.internal.document.v4.ReportItemExecutor.executeQuery(ReportItemExecutor.java:412)
at org.eclipse.birt.report.engine.internal.document.v4.TableItemExecutor.doExecute(TableItemExecutor.java:72)
at org.eclipse.birt.report.engine.internal.document.v4.ReportItemExecutor.execute(ReportItemExecutor.java:294)
at org.eclipse.birt.report.engine.internal.document.v4.ContainerExecutor.prepareChildExecutor(ContainerExecutor.java:226)
at org.eclipse.birt.report.engine.internal.document.v4.ContainerExecutor.hasNextChild(ContainerExecutor.java:110)
at org.eclipse.birt.report.engine.internal.executor.wrap.WrappedReportItemExecutor.hasNextChild(WrappedReportItemExecutor.java:86)
at org.eclipse.birt.report.engine.internal.executor.wrap.WrappedReportItemExecutor.hasNextChild(WrappedReportItemExecutor.java:86)
at org.eclipse.birt.report.engine.api.impl.RenderTask$ReportExecutorWrapper.hasNextChild(RenderTask.java:780)
at org.eclipse.birt.report.engine.layout.html.HTMLPageLM$1.hasNextChild(HTMLPageLM.java:68)
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:62)
at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout(HTMLPageLM.java:92)
at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:100)
at org.eclipse.birt.report.engine.api.impl.RenderTask$PageRangeRender.render(RenderTask.java:661)
at org.eclipse.birt.report.engine.api.impl.RenderTask.render(RenderTask.java:294)
at org.eclipse.birt.report.service.ReportEngineService.renderReport(ReportEngineService.java:1555)
at org.eclipse.birt.report.service.BirtViewerReportService.getPage(BirtViewerReportService.java:204)
at org.eclipse.birt.report.service.actionhandler.AbstractGetPageActionHandler.doExecution(AbstractGetPageActionHandler.java:238)
at org.eclipse.birt.report.service.actionhandler.AbstractGetPageActionHandler.__execute(AbstractGetPageActionHandler.java:105)
at org.eclipse.birt.report.service.actionhandler.AbstractBaseActionHandler.execute(AbstractBaseActionHandler.java:90)
at org.eclipse.birt.report.soapengine.processor.AbstractBaseDocumentProcessor.__executeAction(AbstractBaseDocumentProcessor.java:47)
at org.eclipse.birt.report.soapengine.processor.AbstractBaseComponentProcessor.executeAction(AbstractBaseComponentProcessor.java:143)
at org.eclipse.birt.report.soapengine.processor.BirtDocumentProcessor.handleGetPage(BirtDocumentProcessor.java:87)
at sun.reflect.GeneratedMethodAccessor105.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.birt.report.soapengine.processor.AbstractBaseComponentProcessor.process(AbstractBaseComponentProcessor.java:112)
at org.eclipse.birt.report.soapengine.endpoint.BirtSoapBindingImpl.getUpdatedObjects(BirtSoapBindingImpl.java:66)
at sun.reflect.GeneratedMethodAccessor104.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:397)
at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:186)
at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:454)
at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
at org.eclipse.birt.report.servlet.BirtSoapMessageDispatcherServlet.doPost(BirtSoapMessageDispatcherServlet.java:265)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.eclipse.birt.report.servlet.BirtSoapMessageDispatcherServlet.service(BirtSoapMessageDispatcherServlet.java:122)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.eclipse.birt.report.filter.ViewerFilter.doFilter(ViewerFilter.java:68)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Find more posts tagged with
Comments
hamsa
import java.io.IOException;<br />
import java.util.ArrayList; <br />
<br />
import org.eclipse.birt.core.framework.Platform;<br />
import org.eclipse.birt.report.model.api.CellHandle;<br />
import org.eclipse.birt.report.model.api.DataItemHandle;<br />
import org.eclipse.birt.report.model.api.DesignConfig; <br />
import org.eclipse.birt.report.model.api.ElementFactory;<br />
import org.eclipse.birt.report.model.api.IDesignEngine;<br />
import org.eclipse.birt.report.model.api.IDesignEngineFactory;<br />
import org.eclipse.birt.report.model.api.LabelHandle;<br />
import org.eclipse.birt.report.model.api.OdaDataSetHandle;<br />
import org.eclipse.birt.report.model.api.OdaDataSourceHandle;<br />
import org.eclipse.birt.report.model.api.PropertyHandle;<br />
import org.eclipse.birt.report.model.api.ReportDesignHandle;<br />
import org.eclipse.birt.report.model.api.RowHandle;<br />
import org.eclipse.birt.report.model.api.SessionHandle;<br />
import org.eclipse.birt.report.model.api.SlotHandle;<br />
import org.eclipse.birt.report.model.api.StructureFactory;<br />
import org.eclipse.birt.report.model.api.TextItemHandle;<br />
import org.eclipse.birt.report.model.api.TableHandle;<br />
import org.eclipse.birt.report.model.api.ListHandle;<br />
import org.eclipse.birt.report.model.api.SharedStyleHandle;<br />
import org.eclipse.birt.report.model.api.activity.SemanticException;<br />
import org.eclipse.birt.report.model.api.elements.structures.ComputedColumn;<br />
import org.eclipse.birt.report.model.api.StyleHandle;<br />
import org.eclipse.birt.report.model.api.elements.structures.HighlightRule;<br />
<br />
import com.ibm.icu.util.ULocale;<br />
import org.eclipse.birt.report.model.api.elements.DesignChoiceConstants;<br />
<br />
/**<br />
* Use the Design Engine API (model api) to design a report instead of the <br />
* BIRT designer. This class will generate a similar report as <br />
* derby_sample.rptdesign that was created using the Eclipse BIRT designer.<br />
*/<br />
public class SampleDEAPIReport<br />
{<br />
ReportDesignHandle designHandle = null;<br />
ElementFactory designFactory = null;<br />
StructureFactory structFactory = null; <br />
<br />
public static SessionHandle setup()<br />
{<br />
<br />
//Configure the Engine and start the Platform<br />
DesignConfig config = new DesignConfig( );<br />
config.setProperty("BIRT_HOME", System.getProperty("BIRT_HOME"));<br />
IDesignEngine engine = null;<br />
try{<br />
Platform.startup( config );<br />
IDesignEngineFactory factory = (IDesignEngineFactory) Platform<br />
.createFactoryObject( IDesignEngineFactory.EXTENSION_DESIGN_ENGINE_FACTORY );<br />
engine = factory.createDesignEngine( config );<br />
<br />
}catch( Exception ex){<br />
ex.printStackTrace();<br />
} <br />
SessionHandle session = engine.newSessionHandle( ULocale.ENGLISH ) ;<br />
return session;<br />
}<br />
<br />
public static ReportDesignHandle createReport(SessionHandle session)<br />
{<br />
// create a design or a template<br />
ReportDesignHandle reportDesignHandle = session.createDesign();<br />
<br />
return reportDesignHandle;<br />
}<br />
<br />
<br />
<br />
public static void main( String[] args )<br />
{<br />
try<br />
{<br />
String qry = "select SAMP.DEPARTMENT.DEPTNAME,SAMP.EMPLOYEE.FIRSTNME,SAMP.EMPLOYEE.LASTNAME,SAMP.EMPLOYEE.JOB,CHAR(SAMP.EMPLOYEE.HIREDATE) as Hiredate,SAMP.EMPLOYEE.SALARY,SAMP.EMPLOYEE.BONUS,SAMP.EMPLOYEE.COMM"+<br />
" from SAMP.EMPLOYEE, SAMP.DEPARTMENT where SAMP.DEPARTMENT.DEPTNO = SAMP.EMPLOYEE.WORKDEPT order by SAMP.DEPARTMENT.DEPTNAME";<br />
String dataSourceName = "Sample Derby";<br />
String dataSetName ="Sample Derby Data Set";<br />
<br />
SessionHandle session = setup();<br />
ReportDesignHandle reportDesignHandle = createReport(session);<br />
<br />
addDataSource(reportDesignHandle,dataSourceName,"org.apache.derby.jdbc.EmbeddedDriver","jdbc:derby:C:/birt/demo/sample","APP","PWD");<br />
buildDataSet(reportDesignHandle,dataSetName,dataSourceName,qry);<br />
<br />
ElementFactory elementFactory = reportDesignHandle.getElementFactory();<br />
<br />
// Create Styles.<br />
StyleHandle labelStyle = elementFactory.newStyle( "headerLabel" );<br />
labelStyle.setProperty( StyleHandle.FONT_WEIGHT_PROP,<br />
DesignChoiceConstants.FONT_WEIGHT_BOLD );<br />
labelStyle.setProperty( StyleHandle.FONT_FAMILY_PROP, "Andalus" );<br />
labelStyle.setProperty( StyleHandle.COLOR_PROP, "red" );<br />
labelStyle.setProperty( StyleHandle.BACKGROUND_COLOR_PROP,"aqua");<br />
labelStyle.setProperty( StyleHandle.FONT_SIZE_PROP,"larger" );<br />
labelStyle.setProperty( StyleHandle.COLOR_PROP, "red" );//$NON-NLS-1$<br />
reportDesignHandle.getStyles( ).add( labelStyle );<br />
<br />
<br />
StyleHandle detailStyle = elementFactory.newStyle( "detailStyle" );<br />
detailStyle.setProperty( StyleHandle.FONT_WEIGHT_PROP,<br />
DesignChoiceConstants.FONT_WEIGHT_BOLD );<br />
detailStyle.setProperty( StyleHandle.BACKGROUND_COLOR_PROP,"#C0C0C0");<br />
detailStyle.setProperty( StyleHandle.TEXT_ALIGN_PROP,"center");<br />
PropertyHandle highlightRules = detailStyle.getPropertyHandle("highlightRules");<br />
<br />
<br />
HighlightRule rules = StructureFactory.createHighlightRule();<br />
rules.setOperator("eq");<br />
rules.setProperty("backgroundColor","#80FFFF");<br />
rules.setTestExpression("Total.runningCount() % 2");<br />
rules.setValue1("0");<br />
highlightRules.addItem(rules);<br />
reportDesignHandle.getStyles( ).add( detailStyle );<br />
StyleHandle dateStyle = elementFactory.newStyle( "dateStyle" );<br />
dateStyle.setDateTimeFormat("DD_MM_YYYY");<br />
dateStyle.setDateTimeFormatCategory("Medium Date");<br />
//dateStyle.setD<br />
reportDesignHandle.getStyles( ).add( dateStyle );<br />
<br />
<br />
TextItemHandle text = elementFactory.newTextItem("text");<br />
text.setContent("Employee Report");<br />
reportDesignHandle.getComponents().add(text);<br />
<br />
// create a new table in the report with 5 columns<br />
TableHandle table = elementFactory.newTableItem( "table", 5 );<br />
table.setWidth( "100%" );<br />
<br />
// associate the dataset for this table<br />
table.setDataSet( reportDesignHandle.findDataSet(dataSetName ) );<br />
<br />
// columns that are retrieved as part of the query in dataset<br />
String[] cols ={<br />
"DEPTNAME",<br />
"FIRSTNME",<br />
"LASTNAME",<br />
"JOB",<br />
"HIREDATE",<br />
"SALARY",<br />
"BONUS",<br />
"COMM"<br />
};<br />
<br />
// columns that are used in the report<br />
String[][] reportCols ={<br />
{"DEPTNAME","Dept Name"},<br />
{"LASTNAME","Last Name"},<br />
{"JOB","Job"},<br />
{"HIREDATE","Hire Date"},<br />
{"Total Income","Total Income"}<br />
};<br />
<br />
// Set Column Bindings<br />
PropertyHandle computedSet = table.getColumnBindings( ); <br />
ComputedColumn cs1 = null;<br />
<br />
// DEPTNAME expression.<br />
cs1 = StructureFactory.createComputedColumn();<br />
cs1.setName(reportCols[0][0]);<br />
cs1.setExpression("var newOutput = dataSetRow[\"DEPTNAME\"].substr(0,1);"+<br />
"var input = dataSetRow[\"DEPTNAME\"].substr(1).toLowerCase();"+<br />
"var j;"+<br />
"for(i = 0;i<=input.length; i++) {"+<br />
"if(input.charAt(i)==\" \") {"+<br />
"newOutput = newOutput + input.charAt(i) + input.charAt(i+1).toUpperCase();"+<br />
"j = i + 1;"+<br />
"}else {if(i!=j) {newOutput = newOutput + input.charAt(i);}}}newOutput;");<br />
computedSet.addItem(cs1);<br />
<br />
for( int i=1; i < cols.length; i++){<br />
cs1 = StructureFactory.createComputedColumn();<br />
cs1.setName(cols
);<br />
cs1.setExpression("dataSetRow[\"" + cols
+ "\"]");<br />
computedSet.addItem(cs1);<br />
}<br />
<br />
// Computed Column<br />
cs1 = StructureFactory.createComputedColumn();<br />
cs1.setName("Total Income");<br />
cs1.setExpression("row[\"SALARY\"]+row[\"BONUS\"]+row[\"COMM\"]");<br />
computedSet.addItem(cs1);<br />
<br />
// get the table header<br />
RowHandle tableheader = (RowHandle) table.getHeader( ).get( 0 );<br />
<br />
// associate the columns in the header row.<br />
for( int i=0; i < reportCols.length; i++){<br />
LabelHandle label1 = elementFactory.newLabel( reportCols
[1]);<br />
label1.setStyleName("headerLabel");<br />
label1.setText(reportCols
[1]);<br />
CellHandle cell = (CellHandle) tableheader.getCells( ).get( i );<br />
cell.getContent( ).add( label1 );<br />
}<br />
<br />
// HighlightRules<br />
HighlightRule incomeRule = StructureFactory.createHighlightRule();<br />
incomeRule.setOperator("le");<br />
incomeRule.setProperty("backgroundColor","#FF0000");<br />
incomeRule.setProperty("fontStyle","italic");<br />
<br />
incomeRule.setTestExpression("row[\"Total Income\"]");<br />
incomeRule.setValue1("25000");<br />
<br />
// table detail<br />
RowHandle tabledetail = (RowHandle) table.getDetail( ).get( 0 );<br />
for( int i=0; i < reportCols.length; i++){<br />
CellHandle cell = (CellHandle) tabledetail.getCells( ).get( i );<br />
DataItemHandle data = elementFactory.newDataItem( "data_"+reportCols
[0] );<br />
data.setResultSetColumn(reportCols
[0]);<br />
if(reportCols
[0].equalsIgnoreCase("LASTNAME") ||<br />
reportCols
[0].equalsIgnoreCase("Total Income") )<br />
{<br />
cell.getPropertyHandle("highlightRules").addItem(incomeRule);<br />
<br />
}<br />
if(reportCols
[0].equalsIgnoreCase("HIREDATE"))<br />
{<br />
data.setStyleName("dateStyle");<br />
cell.setStyleName("dateStyle");<br />
}<br />
<br />
cell.getContent( ).add( data );<br />
}<br />
<br />
tabledetail.setStyleName("detailStyle");<br />
<br />
<br />
// format the date element , ie the fourth column.<br />
<br />
// Create a label<br />
LabelHandle label = reportDesignHandle.getElementFactory().newLabel(null);<br />
<br />
// Set the properties for the heading<br />
label.setStringProperty("fontSize", "24pt");<br />
label.setStringProperty("fontWeight", "bold");<br />
label.setStringProperty("marginTop", "2pt");<br />
label.setStringProperty("marginBottom", "5pt");<br />
label.setStringProperty("textAlign", "center");<br />
label.setStringProperty("color","blue");<br />
// The text property<br />
label.setText("Employee Report 2");<br />
<br />
// get the body of the report<br />
SlotHandle body = reportDesignHandle.getBody();<br />
<br />
// add the report caption label to the body of the report<br />
body.add(label);<br />
<br />
// add the table <br />
reportDesignHandle.getBody( ).add( table );<br />
reportDesignHandle.saveAs( "c:/techstack/addons/apache/webapps/BIRT/report/sampledeapi.rptdesign" ); //$NON-NLS-1$<br />
reportDesignHandle.close( );<br />
<br />
}<br />
catch ( IOException e )<br />
{<br />
e.printStackTrace();<br />
}<br />
catch ( SemanticException e )<br />
{<br />
e.printStackTrace();<br />
}<br />
}<br />
<br />
/**<br />
* Build data source. <br />
*
@throws
SemanticException<br />
*/<br />
public static void addDataSource(ReportDesignHandle hdl,String dsName,String driver,String url,String user, String pwd) <br />
throws SemanticException<br />
{<br />
OdaDataSourceHandle dsHdl = (OdaDataSourceHandle)hdl.findDataSource(dsName);<br />
if (dsHdl == null )<br />
{<br />
dsHdl = hdl.getElementFactory().newOdaDataSource(<br />
dsName, "org.eclipse.birt.report.data.oda.jdbc" );<br />
// add the newly created data source<br />
hdl.getDataSources().add(dsHdl);<br />
}<br />
<br />
// update the properties of the datasource<br />
dsHdl.setProperty( "odaDriverClass",driver);<br />
dsHdl.setProperty( "odaURL", url);<br />
dsHdl.setProperty( "odaUser", user);<br />
dsHdl.setProperty( "odaPassword", pwd );<br />
<br />
}<br />
<br />
void print(String msg)<br />
{<br />
System.out.println(msg);<br />
}<br />
<br />
/**<br />
* Build the query ( data set to use in the report).<br />
*/<br />
static void buildDataSet(ReportDesignHandle hdl,String dataSetName,String dataSourceName,String qry) <br />
throws SemanticException<br />
{<br />
OdaDataSetHandle dataSetHandle = hdl.getElementFactory().newOdaDataSet( dataSetName,"org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet" );<br />
dataSetHandle.setDataSource( dataSourceName );<br />
dataSetHandle.setQueryText( qry );<br />
<br />
PropertyHandle computedSet = dataSetHandle.getPropertyHandle( OdaDataSetHandle.COMPUTED_COLUMNS_PROP );<br />
// Structure of the computed Column.<br />
ComputedColumn computedCol = StructureFactory.createComputedColumn();//"ComputedColumns");<br />
computedCol.setName("Total Income");<br />
computedCol.setExpression("row[\"SALARY\"]+row[\"BONUS\"]+row[\"COMM\"]");<br />
computedCol.setDataType("decimal");<br />
computedSet.addItem( computedCol );<br />
<br />
hdl.getDataSets( ).add( dataSetHandle );<br />
}<br />
<br />
}
JasonW
Do you have the derby jar in the web-inf/lib? If you are using 3.7 or higher of birt you do not need to set a birt home.
//only for osgi runtime. The default for 3.7 > is a POJO runtime
//config.setProperty("BIRT_HOME", System.getProperty("BIRT_HOME"));
Jason
hamsa
Thanks for help. I will check that jar. In Tomcat server i need to check right.
Thanks
Hamsa