Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » IllegalAccessError when using JNDI Url on Birt 2.5.1(If the DB driver is loaded on the same classpath as Birt, we are getting IllegalAccessError when Birt is preparing the Statement)
IllegalAccessError when using JNDI Url on Birt 2.5.1 [message #635549] Wed, 27 October 2010 06:19 Go to next message
Hector Moneo is currently offline Hector Moneo
Messages: 5
Registered: October 2010
Junior Member
Hi,

Our application is relying on Birt 2.5.1 runtime for the report generation. We are in the process of moving from JDBC to JNDI
as the connection method for the Birt datasource. The JNDI url is set on run time using the reportContext.
We have come across the DB drivers cannot be loaded into the same classpath as Birt runtime, since we are getting IllegalAccessError when BIRT is internally preparing the sql Statement. The problem does not happen if the DB driver is loader in a higher classpath, i.e.
at the Application Server level.

This behaviour seems neither DB ( with Oracle, SQL Server and DB2 we are always getting IllegalAccessException) nor Application
Server related (we get the same results on Tomcat 6.0 and WAS 7.0) Our application is using App. Server pooling and we have never come across this problem, so it does not either seem to be an application issue.

So basically I would like to understand why it is happenning and if there is a better way of fixing the issue than loading
the drivers at the application server classpath.

I attach an stack trace of the problem when testing on tomcat 6 and SQL Server.

If you need further information, plese let me know. Best regards,

Hector

--------------------------------- Stack trace ---------------------------------
Caused by: java.lang.IllegalAccessError: tried to access method com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.<init > (Lcom/microsoft/sqlserver/jdbc/SQLServerConnection;Ljava/lan g/String;II)V from class com.microsoft.sqlserver.jdbc.SQLServerConnection
at com.microsoft.sqlserver.jdbc.SQLServerConnection.prepareStat ement(SQLServerConnection.java:1864)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.prepareStat ement(SQLServerConnection.java:1566)
at org.apache.tomcat.dbcp.dbcp.DelegatingConnection.prepareStat ement(DelegatingConnection.java:248)
at org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConne ctionWrapper.prepareStatement(PoolingDataSource.java:302)
at org.eclipse.birt.report.data.oda.jdbc.Statement.prepare(Stat ement.java:142)
at org.eclipse.datatools.connectivity.oda.consumer.helper.OdaQu ery.doPrepare(OdaQuery.java:229)
at org.eclipse.datatools.connectivity.oda.consumer.helper.OdaQu ery.prepare(OdaQuery.java:186)
at org.eclipse.birt.data.engine.odaconsumer.Connection.prepareO daQuery(Connection.java:281)
at org.eclipse.birt.data.engine.odaconsumer.Connection.prepareS tatement(Connection.java:181)
at org.eclipse.birt.data.engine.executor.DataSource.prepareStat ement(DataSource.java:269)
at org.eclipse.birt.data.engine.executor.DataSourceQuery.prepar e(DataSourceQuery.java:270)
at org.eclipse.birt.data.engine.impl.PreparedOdaDSQuery$OdaDSQu eryExecutor.prepareOdiQuery(PreparedOdaDSQuery.java:350)
at org.eclipse.birt.data.engine.impl.QueryExecutor.prepareExecu tion(QueryExecutor.java:337)
at org.eclipse.birt.data.engine.impl.PreparedQuery.doPrepare(Pr eparedQuery.java:448)
at org.eclipse.birt.data.engine.impl.PreparedDataSourceQuery.pr oduceQueryResults(PreparedDataSourceQuery.java:190)
at org.eclipse.birt.data.engine.impl.PreparedDataSourceQuery.ex ecute(PreparedDataSourceQuery.java:178)
at org.eclipse.birt.data.engine.impl.PreparedOdaDSQuery.execute (PreparedOdaDSQuery.java:144)
at org.eclipse.birt.report.data.adapter.impl.DataRequestSession Impl.execute(DataRequestSessionImpl.java:511)
at org.eclipse.birt.report.engine.data.dte.DteDataEngine.doExec uteQuery(DteDataEngine.java:145)
at org.eclipse.birt.report.engine.data.dte.DataGenerationEngine .doExecuteQuery(DataGenerationEngine.java:71)
at org.eclipse.birt.report.engine.data.dte.AbstractDataEngine.e xecute(AbstractDataEngine.java:254)
at org.eclipse.birt.report.engine.executor.ExecutionContext.exe cuteQuery(ExecutionContext.java:1818)
at org.eclipse.birt.report.engine.executor.QueryItemExecutor.ex ecuteQuery(QueryItemExecutor.java:80)
at org.eclipse.birt.report.engine.executor.TableItemExecutor.ex ecute(TableItemExecutor.java:62)
at org.eclipse.birt.report.engine.internal.executor.wrap.Wrappe dReportItemExecutor.execute(WrappedReportItemExecutor.java:4 6)
at org.eclipse.birt.report.engine.internal.executor.emitter.Rep ortItemEmitterExecutor.execute(ReportItemEmitterExecutor.jav a:46)
at org.eclipse.birt.report.engine.internal.executor.dup.Suppres sDuplicateItemExecutor.execute(SuppressDuplicateItemExecutor .java:43)
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStacking LM.layoutNodes(HTMLBlockStackingLM.java:65)
at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.la youtChildren(HTMLStackingLM.java:26)
at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.la yout(HTMLAbstractLM.java:137)
at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackin gLM.resumeLayout(HTMLInlineStackingLM.java:111)
at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackin gLM.layoutNodes(HTMLInlineStackingLM.java:160)
at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.la youtChildren(HTMLStackingLM.java:26)
at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.la yout(HTMLAbstractLM.java:137)
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStacking LM.layoutNodes(HTMLBlockStackingLM.java:70)
at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.la youtChildren(HTMLStackingLM.java:26)
at org.eclipse.birt.report.engine.layout.html.HTMLTableLM.layou tChildren(HTMLTableLM.java:132)
at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.la yout(HTMLAbstractLM.java:137)
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStacking LM.layoutNodes(HTMLBlockStackingLM.java:70)
at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout (HTMLPageLM.java:90)
at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutE ngine.layout(HTMLReportLayoutEngine.java:99)
at org.eclipse.birt.report.engine.presentation.ReportDocumentBu ilder.build(ReportDocumentBuilder.java:258)
at org.eclipse.birt.report.engine.api.impl.RunTask.doRun(RunTas k.java:243)
... 24 more




Re: IllegalAccessError when using JNDI Url on Birt 2.5.1 [message #635693 is a reply to message #635549] Wed, 27 October 2010 13:55 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Hector,

Where is the driver when you have the issue? In the drivers directory
of the JDBC plugin?

Jason

On 10/27/2010 6:19 AM, Hector Moneo wrote:
> Hi,
> Our application is relying on Birt 2.5.1 runtime for the report
> generation. We are in the process of moving from JDBC to JNDI
> as the connection method for the Birt datasource. The JNDI url is set on
> run time using the reportContext. We have come across the DB drivers
> cannot be loaded into the same classpath as Birt runtime, since we are
> getting IllegalAccessError when BIRT is internally preparing the sql
> Statement. The problem does not happen if the DB driver is loader in a
> higher classpath, i.e.
> at the Application Server level.
>
> This behaviour seems neither DB ( with Oracle, SQL Server and DB2 we are
> always getting IllegalAccessException) nor Application
> Server related (we get the same results on Tomcat 6.0 and WAS 7.0) Our
> application is using App. Server pooling and we have never come across
> this problem, so it does not either seem to be an application issue.
> So basically I would like to understand why it is happenning and if
> there is a better way of fixing the issue than loading the drivers at
> the application server classpath.
>
> I attach an stack trace of the problem when testing on tomcat 6 and SQL
> Server.
>
> If you need further information, plese let me know. Best regards,
> Hector
>
> --------------------------------- Stack trace
> ---------------------------------
> Caused by: java.lang.IllegalAccessError: tried to access method
> com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.<init >
> (Lcom/microsoft/sqlserver/jdbc/SQLServerConnection;Ljava/lan
> g/String;II)V from class com.microsoft.sqlserver.jdbc.SQLServerConnection
> at com.microsoft.sqlserver.jdbc.SQLServerConnection.prepareStat
> ement(SQLServerConnection.java:1864)
> at com.microsoft.sqlserver.jdbc.SQLServerConnection.prepareStat
> ement(SQLServerConnection.java:1566)
> at org.apache.tomcat.dbcp.dbcp.DelegatingConnection.prepareStat
> ement(DelegatingConnection.java:248)
> at org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConne
> ctionWrapper.prepareStatement(PoolingDataSource.java:302)
> at org.eclipse.birt.report.data.oda.jdbc.Statement.prepare(Stat
> ement.java:142)
> at org.eclipse.datatools.connectivity.oda.consumer.helper.OdaQu
> ery.doPrepare(OdaQuery.java:229)
> at org.eclipse.datatools.connectivity.oda.consumer.helper.OdaQu
> ery.prepare(OdaQuery.java:186)
> at org.eclipse.birt.data.engine.odaconsumer.Connection.prepareO
> daQuery(Connection.java:281)
> at org.eclipse.birt.data.engine.odaconsumer.Connection.prepareS
> tatement(Connection.java:181)
> at org.eclipse.birt.data.engine.executor.DataSource.prepareStat
> ement(DataSource.java:269)
> at org.eclipse.birt.data.engine.executor.DataSourceQuery.prepar
> e(DataSourceQuery.java:270)
> at org.eclipse.birt.data.engine.impl.PreparedOdaDSQuery$OdaDSQu
> eryExecutor.prepareOdiQuery(PreparedOdaDSQuery.java:350)
> at org.eclipse.birt.data.engine.impl.QueryExecutor.prepareExecu
> tion(QueryExecutor.java:337)
> at org.eclipse.birt.data.engine.impl.PreparedQuery.doPrepare(Pr
> eparedQuery.java:448)
> at org.eclipse.birt.data.engine.impl.PreparedDataSourceQuery.pr
> oduceQueryResults(PreparedDataSourceQuery.java:190)
> at org.eclipse.birt.data.engine.impl.PreparedDataSourceQuery.ex
> ecute(PreparedDataSourceQuery.java:178)
> at org.eclipse.birt.data.engine.impl.PreparedOdaDSQuery.execute
> (PreparedOdaDSQuery.java:144)
> at org.eclipse.birt.report.data.adapter.impl.DataRequestSession
> Impl.execute(DataRequestSessionImpl.java:511)
> at org.eclipse.birt.report.engine.data.dte.DteDataEngine.doExec
> uteQuery(DteDataEngine.java:145)
> at org.eclipse.birt.report.engine.data.dte.DataGenerationEngine
> .doExecuteQuery(DataGenerationEngine.java:71)
> at org.eclipse.birt.report.engine.data.dte.AbstractDataEngine.e
> xecute(AbstractDataEngine.java:254)
> at org.eclipse.birt.report.engine.executor.ExecutionContext.exe
> cuteQuery(ExecutionContext.java:1818)
> at org.eclipse.birt.report.engine.executor.QueryItemExecutor.ex
> ecuteQuery(QueryItemExecutor.java:80)
> at org.eclipse.birt.report.engine.executor.TableItemExecutor.ex
> ecute(TableItemExecutor.java:62)
> at org.eclipse.birt.report.engine.internal.executor.wrap.Wrappe
> dReportItemExecutor.execute(WrappedReportItemExecutor.java:4 6)
> at org.eclipse.birt.report.engine.internal.executor.emitter.Rep
> ortItemEmitterExecutor.execute(ReportItemEmitterExecutor.jav a:46)
> at org.eclipse.birt.report.engine.internal.executor.dup.Suppres
> sDuplicateItemExecutor.execute(SuppressDuplicateItemExecutor .java:43)
> at org.eclipse.birt.report.engine.layout.html.HTMLBlockStacking
> LM.layoutNodes(HTMLBlockStackingLM.java:65)
> at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.la
> youtChildren(HTMLStackingLM.java:26)
> at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.la
> yout(HTMLAbstractLM.java:137)
> at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackin
> gLM.resumeLayout(HTMLInlineStackingLM.java:111)
> at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackin
> gLM.layoutNodes(HTMLInlineStackingLM.java:160)
> at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.la
> youtChildren(HTMLStackingLM.java:26)
> at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.la
> yout(HTMLAbstractLM.java:137)
> at org.eclipse.birt.report.engine.layout.html.HTMLBlockStacking
> LM.layoutNodes(HTMLBlockStackingLM.java:70)
> at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.la
> youtChildren(HTMLStackingLM.java:26)
> at org.eclipse.birt.report.engine.layout.html.HTMLTableLM.layou
> tChildren(HTMLTableLM.java:132)
> at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.la
> yout(HTMLAbstractLM.java:137)
> at org.eclipse.birt.report.engine.layout.html.HTMLBlockStacking
> LM.layoutNodes(HTMLBlockStackingLM.java:70)
> at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout
> (HTMLPageLM.java:90)
> at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutE
> ngine.layout(HTMLReportLayoutEngine.java:99)
> at org.eclipse.birt.report.engine.presentation.ReportDocumentBu
> ilder.build(ReportDocumentBuilder.java:258)
> at org.eclipse.birt.report.engine.api.impl.RunTask.doRun(RunTas k.java:243)
> ... 24 more
>
>
>
>
>
Re: IllegalAccessError when using JNDI Url on Birt 2.5.1 [message #635811 is a reply to message #635693] Thu, 28 October 2010 04:26 Go to previous messageGo to next message
Hector Moneo is currently offline Hector Moneo
Messages: 5
Registered: October 2010
Junior Member
We tested with different scenarios:

* Placing the driver in the plugin directory and we got the the IllegalAccessError

* Placing the driver on the application WAR lib directory (WEB-INF\lib) and we got the same error

* Placing the driver on an external location, and loading it to the app server classpath on the startup server script (This is the solution which worked).

i.e. for Tomcat we modified the "setclasspath.bat" so we added the following line:

SET CLASSPATH=%CLASSPATH%;D:\lib\SQLServerDriver.jar;

The "setclasspath.bat" is executed when starting the server

Regards,

Hector
Re: IllegalAccessError when using JNDI Url on Birt 2.5.1 [message #635910 is a reply to message #635811] Thu, 28 October 2010 10:48 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Hector,

Can you try setting the jdbc driver classpath in the application context
config.getAppContext().put("OdaJDBCDriverClassPath",
"c:/birt/mysql/mysql-connector-java-5.0.4-bin.jar");

Jason


On 10/28/2010 4:26 AM, Hector Moneo wrote:
> We tested with different scenarios:
>
> * Placing the driver in the plugin directory and we got the the
> IllegalAccessError
>
> * Placing the driver on the application WAR lib directory (WEB-INF\lib)
> and we got the same error
>
> * Placing the driver on an external location, and loading it to the app
> server classpath on the startup server script (This is the solution
> which worked).
> i.e. for Tomcat we modified the "setclasspath.bat" so we added the
> following line:
>
> SET CLASSPATH=%CLASSPATH%;D:\lib\SQLServerDriver.jar;
>
> The "setclasspath.bat" is executed when starting the server
>
> Regards,
> Hector
Re: IllegalAccessError when using JNDI Url on Birt 2.5.1 [message #635932 is a reply to message #635910] Thu, 28 October 2010 11:54 Go to previous messageGo to next message
Hector Moneo is currently offline Hector Moneo
Messages: 5
Registered: October 2010
Junior Member
Hi Jason,

I tried setting the jdbc driver classpath in the application context , and got the same result.

Regards,

Hector

Re: IllegalAccessError when using JNDI Url on Birt 2.5.1 [message #635953 is a reply to message #635932] Thu, 28 October 2010 12:50 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Hector,

Are you using the re api or the viewer?

Jason

On 10/28/2010 11:54 AM, Hector Moneo wrote:
> Hi Jason,
> I tried setting the jdbc driver classpath in the application context ,
> and got the same result.
>
> Regards,
> Hector
>
>
Re: IllegalAccessError when using JNDI Url on Birt 2.5.1 [message #636058 is a reply to message #635953] Fri, 29 October 2010 04:21 Go to previous messageGo to next message
Hector Moneo is currently offline Hector Moneo
Messages: 5
Registered: October 2010
Junior Member
I am using the API
Re: IllegalAccessError when using JNDI Url on Birt 2.5.1 [message #636206 is a reply to message #636058] Fri, 29 October 2010 11:56 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Are you setting
config.getAppContext().put(EngineConstants.APPCONTEXT_CLASSL OADER_KEY,
YourClassThatLoadsTheEngine.class.getClassLoader());


Jason

On 10/29/2010 4:21 AM, Hector Moneo wrote:
> I am using the API
Re: IllegalAccessError when using JNDI Url on Birt 2.5.1 [message #636899 is a reply to message #636206] Wed, 03 November 2010 05:29 Go to previous messageGo to next message
Hector Moneo is currently offline Hector Moneo
Messages: 5
Registered: October 2010
Junior Member
Hi Jason,

I tried

config.getAppContext().put(EngineConstants.APPCONTEXT_CLASSL OADER_KEY,
YourClassThatLoadsTheEngine.class.getClassLoader());

but got the same IllegalAccessError

Regards,

Hector

Re: IllegalAccessError when using JNDI Url on Birt 2.5.1 [message #636995 is a reply to message #636899] Wed, 03 November 2010 12:52 Go to previous message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Hector,

I can not reproduce the error. Any chance you can open a bug for this?

Jason

On 11/3/2010 5:29 AM, Hector Moneo wrote:
> Hi Jason,
> I tried
> config.getAppContext().put(EngineConstants.APPCONTEXT_CLASSL OADER_KEY,
> YourClassThatLoadsTheEngine.class.getClassLoader());
>
> but got the same IllegalAccessError
> Regards,
> Hector
>
>
Previous Topic:Fetching values of list at runtime
Next Topic:Data source URL
Goto Forum:
  


Current Time: Wed Jul 30 07:12:27 EDT 2014

Powered by FUDForum. Page generated in 0.03822 seconds