You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by pram <pr...@yahoo.com> on 2008/11/07 23:54:10 UTC

Important: java.lang.IllegalAccessError while using HSSFFormulaEvaluator

Hi all,

I downloaded the latest version of Apache POI : poi-bin-3.2-FINAL-20081019.

I am trying to use HSSFFormulaEvaluator to evaluate a couple of formula
cells. But I am getting java.lang.IllegalAccessError while trying to create
a new HSSFFormulaEvaluator instance.

Here is a part of my code:
public POIFSFileSystem fs = null;
public HSSFWorkbook wb = null;
try {
   fs = new POIFSFileSystem(is); // is is InputStream, I made sure it is not
null
   wb = new HSSFWorkbook(fs);	
   HSSFSheet sheet = wb.getSheetAt(0);
   try {
         evaluator = new
org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator(wb);
    }catch(java.lang.IllegalAccessError er) {
	System.out.println("Error in creating the evaluator:");
	er.printStackTrace();
   }
    System.out.println("Evaluator created!");
}catch(Exception e){
   e.printStackTrace();
}

I hit the IllegealAccessError in the inner try/catch block, where I try do:
new HSSFFormulaEvaluator(wb).
The error trace is something like this:
Error in creating the evaluator:
08/11/07 14:27:25 java.lang.IllegalAccessError: tried to access method
org.apache.poi.hssf.usermodel.HSSFWorkbook.getWorkbook()Lorg/apache/poi/hssf/model/Workbook;
from class org.apache.poi.hssf.usermodel.HSSFEvaluationWorkbook
08/11/07 14:27:25 	at
org.apache.poi.hssf.usermodel.HSSFEvaluationWorkbook.<init>(HSSFEvaluationWorkbook.java:54)
08/11/07 14:27:25 	at
org.apache.poi.hssf.usermodel.HSSFEvaluationWorkbook.create(HSSFEvaluationWorkbook.java:49)
08/11/07 14:27:25 	at
org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator.<init>(HSSFFormulaEvaluator.java:54)
08/11/07 14:27:25 	at
pxexamples.PopulatePageThree.doAction(PopulatePageThree.java:43)
08/11/07 14:27:25 	at
com.agile.px.Extensions2$PXCustomActionNode.invoke(Extensions2.java:482)

Can this be a bug in this version?

Thanks,
Pram
-- 
View this message in context: http://www.nabble.com/Important%3A-java.lang.IllegalAccessError-while-using-HSSFFormulaEvaluator-tp20389724p20389724.html
Sent from the POI - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: Important: java.lang.IllegalAccessError while using HSSFFormulaEvaluator

Posted by pram <pr...@yahoo.com>.
Please ignore this email.
I had an old version of the POI jar in the classpath. I removed it and it
worked.


pram wrote:
> 
> Hi all,
> 
> I downloaded the latest version of Apache POI :
> poi-bin-3.2-FINAL-20081019.
> 
> I am trying to use HSSFFormulaEvaluator to evaluate a couple of formula
> cells. But I am getting java.lang.IllegalAccessError while trying to
> create a new HSSFFormulaEvaluator instance.
> 
> Here is a part of my code:
> public POIFSFileSystem fs = null;
> public HSSFWorkbook wb = null;
> try {
>    fs = new POIFSFileSystem(is); // is is InputStream, I made sure it is
> not null
>    wb = new HSSFWorkbook(fs);	
>    HSSFSheet sheet = wb.getSheetAt(0);
>    try {
>          evaluator = new
> org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator(wb);
>     }catch(java.lang.IllegalAccessError er) {
> 	System.out.println("Error in creating the evaluator:");
> 	er.printStackTrace();
>    }
>     System.out.println("Evaluator created!");
> }catch(Exception e){
>    e.printStackTrace();
> }
> 
> I hit the IllegealAccessError in the inner try/catch block, where I try
> do: new HSSFFormulaEvaluator(wb).
> The error trace is something like this:
> Error in creating the evaluator:
> 08/11/07 14:27:25 java.lang.IllegalAccessError: tried to access method
> org.apache.poi.hssf.usermodel.HSSFWorkbook.getWorkbook()Lorg/apache/poi/hssf/model/Workbook;
> from class org.apache.poi.hssf.usermodel.HSSFEvaluationWorkbook
> 08/11/07 14:27:25 	at
> org.apache.poi.hssf.usermodel.HSSFEvaluationWorkbook.<init>(HSSFEvaluationWorkbook.java:54)
> 08/11/07 14:27:25 	at
> org.apache.poi.hssf.usermodel.HSSFEvaluationWorkbook.create(HSSFEvaluationWorkbook.java:49)
> 08/11/07 14:27:25 	at
> org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator.<init>(HSSFFormulaEvaluator.java:54)
> 08/11/07 14:27:25 	at
> pxexamples.PopulatePageThree.doAction(PopulatePageThree.java:43)
> 08/11/07 14:27:25 	at
> com.agile.px.Extensions2$PXCustomActionNode.invoke(Extensions2.java:482)
> 
> Can this be a bug in this version?
> 
> Thanks,
> Pram
> 

-- 
View this message in context: http://www.nabble.com/Important%3A-java.lang.IllegalAccessError-while-using-HSSFFormulaEvaluator-tp20389724p20389926.html
Sent from the POI - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org