You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Subhakar Gummadi <gu...@gmail.com> on 2008/04/02 17:32:56 UTC
HSSFCell.setCellValue() Problem
Hi All,
I am getting a compilation error when I am using the following Code.
HSSFRichTextString hrts1 = new
HSSFRichTextString((String)evtEntity.getEvt_lname());
cell.setCellValue(hrts1);
I was looking around over the Internet and Mailing List Archives in
POI.apache.org, but did not find any solution for this.
Please advise.
Thanks,
Subhakar.
Re: HSSFCell.setCellValue() Problem
Posted by mg...@gmail.com.
Do you have the poi lib in the app server classpath?
Sent via BlackBerry by AT&T
-----Original Message-----
From: "Subhakar Gummadi" <gu...@gmail.com>
Date: Wed, 2 Apr 2008 12:20:26
To:"POI Users List" <us...@poi.apache.org>
Subject: Re: HSSFCell.setCellValue() Problem
Hi,
Here is the Runtime error..................
---------------------------------------------------
java.lang.NoSuchMethodError: setCellValue
at
com.pfizer.ac.service.eventchange.EventCancelSubmitEmail_Service.createExcelFile(EventCancelSubmitEmail_Service.java:378)
at
com.pfizer.ac.service.eventchange.EventCancelSubmitEmail_Service.submitCancelEvent(EventCancelSubmitEmail_Service.java:182)
at
com.pfizer.ac.action.eventchange.EventCancelSubmitEmail_Action.submit(EventCancelSubmitEmail_Action.java:129)
at
jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown
Source)
at
java.lang.reflect.Method.invoke(Ljava.lang.Object;[Ljava.lang.Object;I)Ljava.lang.Object;(Unknown
Source)
at
org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:269)
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:170)
at
org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58)
at
org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67)
at
org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
at
org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
at
org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at
weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:225)
at
weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:127)
at
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)
at
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
at
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3214)
at
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at
weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:1983)
at
weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1890)
at
weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1344)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
------------------------------------------------------------------------------------------------------
Here is the Code Block that is referred in the Error Message
------------------------------------------------------------------------------------------------------
Line 371: cell = row.createCell((short)colCnt);
Line 372: sheet.addMergedRegion(new Region(rowCnt, (short)colCnt,
rowCnt, (short)(colCnt+3)));
Line 374: cell.setCellType(HSSFCell.CELL_TYPE_STRING);
Line 375: cell.setCellStyle(evtDetailsDataCellStyle);
Line 377: HSSFRichTextString hrts1 = new
HSSFRichTextString((String)evtEntity.getEvt_lname());
Line 378: cell.setCellValue(hrts1);
------------------------------------------------------------------------------------------------------
Please let me know if you need more information from me.
Thanks,
Subhakar.
On Wed, Apr 2, 2008 at 12:07 PM, J Keller <jk...@oberonassociates.com>
wrote:
> That code looks fine to me (but I'm no expert).
>
> Can you post what error you are getting? What line causes it?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>
>
Re: HSSFCell.setCellValue() Problem
Posted by Moody Lee <mm...@gmail.com>.
It seems that there are not only one POI in your classpath.
The WebLogic server loaded the other one, which hasn't the method
setCellValue(HSSFRichTextString ...).
The first thing you should do is searching for the *poi*.jar in your
weblogic path.
If there's really another version of POI, then decide which one you should
use, and delete the other one.
But deleting the jar file directly maybe dangerous, maybe you can change the
class that WebLogic used.
HTH.
Moody.
2008/4/3, Subhakar Gummadi <gu...@gmail.com>:
>
> Hi,
>
> Here is the Runtime error..................
> ---------------------------------------------------
>
> java.lang.NoSuchMethodError: setCellValue
> at
>
> com.pfizer.ac.service.eventchange.EventCancelSubmitEmail_Service.createExcelFile
> (EventCancelSubmitEmail_Service.java:378)
>
> at
>
> com.pfizer.ac.service.eventchange.EventCancelSubmitEmail_Service.submitCancelEvent
> (EventCancelSubmitEmail_Service.java:182)
>
> at
> com.pfizer.ac.action.eventchange.EventCancelSubmitEmail_Action.submit
> (EventCancelSubmitEmail_Action.java:129)
>
> at
> jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[
> Ljava.lang.Object;)Ljava.lang.Object;(Unknown
> Source)
> at
> java.lang.reflect.Method.invoke(Ljava.lang.Object;[Ljava.lang.Object
> ;I)Ljava.lang.Object;(Unknown
> Source)
> at
> org.apache.struts.actions.DispatchAction.dispatchMethod(
> DispatchAction.java:269)
>
> at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java
> :170)
>
> at
> org.apache.struts.chain.commands.servlet.ExecuteAction.execute(
> ExecuteAction.java:58)
>
> at
> org.apache.struts.chain.commands.AbstractExecuteAction.execute(
> AbstractExecuteAction.java:67)
>
> at
> org.apache.struts.chain.commands.ActionCommandBase.execute(
> ActionCommandBase.java:51)
>
> at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
> at
> org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java
> :304)
>
> at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
> at
> org.apache.struts.chain.ComposableRequestProcessor.process(
> ComposableRequestProcessor.java:283)
>
> at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
> at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
> at
> weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(
> StubSecurityHelper.java:225)
>
> at
> weblogic.servlet.internal.StubSecurityHelper.invokeServlet(
> StubSecurityHelper.java:127)
>
> at
> weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java
> :283)
> at
> weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java
> :175)
> at
> weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run
> (WebAppServletContext.java:3214)
>
> at
> weblogic.security.acl.internal.AuthenticatedSubject.doAs(
> AuthenticatedSubject.java:321)
>
> at weblogic.security.service.SecurityManager.runAs(SecurityManager.java
> :121)
>
> at
> weblogic.servlet.internal.WebAppServletContext.securedExecute(
> WebAppServletContext.java:1983)
>
> at
> weblogic.servlet.internal.WebAppServletContext.execute(
> WebAppServletContext.java:1890)
>
> at
> weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java
> :1344)
>
> at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
>
>
> ------------------------------------------------------------------------------------------------------
> Here is the Code Block that is referred in the Error Message
>
> ------------------------------------------------------------------------------------------------------
> Line 371: cell = row.createCell((short)colCnt);
> Line 372: sheet.addMergedRegion(new Region(rowCnt, (short)colCnt,
> rowCnt, (short)(colCnt+3)));
>
> Line 374: cell.setCellType(HSSFCell.CELL_TYPE_STRING);
> Line 375: cell.setCellStyle(evtDetailsDataCellStyle);
>
> Line 377: HSSFRichTextString hrts1 = new
> HSSFRichTextString((String)evtEntity.getEvt_lname());
> Line 378: cell.setCellValue(hrts1);
>
> ------------------------------------------------------------------------------------------------------
>
> Please let me know if you need more information from me.
>
> Thanks,
> Subhakar.
>
>
>
> On Wed, Apr 2, 2008 at 12:07 PM, J Keller <jk...@oberonassociates.com>
> wrote:
>
> > That code looks fine to me (but I'm no expert).
> >
> > Can you post what error you are getting? What line causes it?
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> > For additional commands, e-mail: user-help@poi.apache.org
> >
> >
>
Re: HSSFCell.setCellValue() Problem
Posted by Subhakar Gummadi <gu...@gmail.com>.
Hi,
Here is the Runtime error..................
---------------------------------------------------
java.lang.NoSuchMethodError: setCellValue
at
com.pfizer.ac.service.eventchange.EventCancelSubmitEmail_Service.createExcelFile(EventCancelSubmitEmail_Service.java:378)
at
com.pfizer.ac.service.eventchange.EventCancelSubmitEmail_Service.submitCancelEvent(EventCancelSubmitEmail_Service.java:182)
at
com.pfizer.ac.action.eventchange.EventCancelSubmitEmail_Action.submit(EventCancelSubmitEmail_Action.java:129)
at
jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown
Source)
at
java.lang.reflect.Method.invoke(Ljava.lang.Object;[Ljava.lang.Object;I)Ljava.lang.Object;(Unknown
Source)
at
org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:269)
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:170)
at
org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58)
at
org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67)
at
org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
at
org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
at
org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at
weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:225)
at
weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:127)
at
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)
at
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
at
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3214)
at
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at
weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:1983)
at
weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1890)
at
weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1344)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
------------------------------------------------------------------------------------------------------
Here is the Code Block that is referred in the Error Message
------------------------------------------------------------------------------------------------------
Line 371: cell = row.createCell((short)colCnt);
Line 372: sheet.addMergedRegion(new Region(rowCnt, (short)colCnt,
rowCnt, (short)(colCnt+3)));
Line 374: cell.setCellType(HSSFCell.CELL_TYPE_STRING);
Line 375: cell.setCellStyle(evtDetailsDataCellStyle);
Line 377: HSSFRichTextString hrts1 = new
HSSFRichTextString((String)evtEntity.getEvt_lname());
Line 378: cell.setCellValue(hrts1);
------------------------------------------------------------------------------------------------------
Please let me know if you need more information from me.
Thanks,
Subhakar.
On Wed, Apr 2, 2008 at 12:07 PM, J Keller <jk...@oberonassociates.com>
wrote:
> That code looks fine to me (but I'm no expert).
>
> Can you post what error you are getting? What line causes it?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>
>
Re: HSSFCell.setCellValue() Problem
Posted by Subhakar Gummadi <gu...@gmail.com>.
Sure... Give me like 15 minutes.
I am trying to produce the error.
Thanks,
Subhakar.
On Wed, Apr 2, 2008 at 12:07 PM, J Keller <jk...@oberonassociates.com>
wrote:
> That code looks fine to me (but I'm no expert).
>
> Can you post what error you are getting? What line causes it?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>
>
RE: HSSFCell.setCellValue() Problem
Posted by J Keller <jk...@oberonassociates.com>.
That code looks fine to me (but I'm no expert).
Can you post what error you are getting? What line causes it?
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org
Re: HSSFCell.setCellValue() Problem
Posted by Subhakar Gummadi <gu...@gmail.com>.
Hi,
Thank you for replying so quickly.
You are right... I am getting a runtime Error ... not a compilation error.
I have the following Enviroment Details:
Application has been deployed in Weblogic Server. ( JDK 1.5.0_04 )
I have the following two lib files deployed in my application.
poi-3.0.2-FINAL-20080204.jar and poi-contrib-3.0.2-FINAL.jar
I am using Eclipse to develop my code .. I am using the same JDK to compile
my code also.
and My code block which is throwing an exception is as follows:
int rowCnt = 2;
int colCnt = 2;
HSSFCellStyle evtDetailsTitleCellStyle = wb.createCellStyle();
evtDetailsTitleCellStyle.setFillPattern(HSSFCellStyle.NO_FILL);
HSSFFont evtDetailsTitleFont = wb.createFont();
evtDetailsTitleFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
evtDetailsTitleFont.setFontName(HSSFFont.FONT_ARIAL);
evtDetailsTitleFont.setFontHeight((short)180);
evtDetailsTitleFont.setColor(HSSFColor.BLACK.index);
evtDetailsTitleCellStyle.setFont(evtDetailsTitleFont);
row = sheet.createRow((short) rowCnt);
cell = row.createCell((short)colCnt);
sheet.addMergedRegion(new Region(rowCnt, (short)colCnt, rowCnt,
(short)(colCnt+1)));
cell.setCellType(HSSFCell.CELL_TYPE_STRING);
cell.setCellStyle(evtDetailsTitleCellStyle);
HSSFRichTextString hrts = new HSSFRichTextString("Testing");
cell.setCellValue(hrts);
//cell.setCellValue("Event Name:");
Please let me know if you need more details about my problem.
Thanks,
Subhakar.
On Wed, Apr 2, 2008 at 11:41 AM, J Keller <jk...@oberonassociates.com>
wrote:
> What error are you getting?
>
> Is the cell type CELL_TYPE_STRING? You can use cell.getCellType() to
> check. Though a wrong cell type would be a run-time error, not
> compiliation, I think.
>
> -----Original Message-----
> From: Subhakar Gummadi [mailto:gummadiss@gmail.com]
>
> I am getting a compilation error when I am using the following Code.
>
> HSSFRichTextString hrts1 = new
> HSSFRichTextString((String)evtEntity.getEvt_lname());
> cell.setCellValue(hrts1);
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>
>
RE: HSSFCell.setCellValue() Problem
Posted by J Keller <jk...@oberonassociates.com>.
What error are you getting?
Is the cell type CELL_TYPE_STRING? You can use cell.getCellType() to check. Though a wrong cell type would be a run-time error, not compiliation, I think.
-----Original Message-----
From: Subhakar Gummadi [mailto:gummadiss@gmail.com]
I am getting a compilation error when I am using the following Code.
HSSFRichTextString hrts1 = new
HSSFRichTextString((String)evtEntity.getEvt_lname());
cell.setCellValue(hrts1);
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org