[jboss-user] [JBoss Seam] - java.io.ByteArrayInputStream.<init>(ByteArrayInputStream.jav
hager
do-not-reply at jboss.com
Fri Nov 23 10:49:46 EST 2007
Hello,
I'm using seam 2.0.0.GA and JBoss server 4.2.0.GA
I'm trying an example with <pdf:image>, but i have java.io.ByteArrayInputStream.(ByteArrayInputStream.java:89) Exception.
Page.xhtml :
<p:image image="#{exportPDF.image}" spacingAfter="20" />
ExportPDF.java :
| public BufferedImage getImage() {
| BufferedImage image = null;
| try {
| String repertoireLogo = this.gestionConfiguration.getValue(typeConfigurationValeur);
| this.pathImage = this.societeHome.getInstance().getLogoSociete();
| if(this.pathImage != null)
| {
| System.out.println("pathImage "+pathImage);
| StringTokenizer st = new StringTokenizer(this.pathImage,"/");
| String nomFichier ="";
| while(st.hasMoreElements())
| {
| nomFichier = st.nextToken();
| }
| byte[] pixels;
| //Reading every byte from file
| File logo = new File(repertoireLogo+File.separator+nomFichier);
| if(logo.exists())
| {
| FileInputStream fis = new FileInputStream(logo);
|
| pixels = new byte[fis.available()];
| fis.read(pixels);
| System.out.println("Pixels "+pixels.length);
| image = ImageIO.read ( new ByteArrayInputStream ( pixels ) );
| }
| }
| }
| catch (IOException e) {
| System.out.println("Exception Image "+e.toString());
| }
| return image;
| }
when I execute my method, I have this exception :
java.lang.NullPointerException
| at java.io.ByteArrayInputStream.<init>(ByteArrayInputStream.java:89)
| at com.lowagie.text.Image.getInstance(Unknown Source)
| at org.jboss.seam.pdf.ui.UIImage.createITextObject(UIImage.java:140)
| at org.jboss.seam.pdf.ui.ITextComponent.encodeBegin(ITextComponent.java:181)
| at org.jboss.seam.pdf.ui.ITextComponent.encode(ITextComponent.java:244)
| at org.jboss.seam.pdf.ui.ITextComponent.encodeChildren(ITextComponent.java:213)
| at javax.faces.component.UIComponent.encodeAll(UIComponent.java:886)
| at javax.faces.component.UIComponent.encodeAll(UIComponent.java:892)
| at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:592)
| at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
| at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:216)
| at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
| at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
| at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
| at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| at com.fitnetapplication.resources.pdf.RendererFilter.doFilter(RendererFilter.java:79)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
| at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:44)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
| at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
| at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
| at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
| at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
| at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
| at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
| at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
| at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
| at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
| at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
| at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
| at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
| at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
| at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
| at java.lang.Thread.run(Thread.java:595)
How can I fix that?
thanks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4107382#4107382
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4107382
More information about the jboss-user
mailing list