Jasperreports + JBoss Seam

Olá a todos…

Estou tentando exibir um relatório pdf no browser, segui as instruções deste link http://www.guj.com.br/posts/list/76720.java
Sendo assim, a estrutura do meu projeto é como demonstrado abaixo:

[quote]+src
+resources
+target
+view
&nbsp&nbsp&nbsp&nbsp+reports
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp relatorio.jrxml[/quote]

Quando eu faço o deploy, é gerado .ear certinho, com o .jar e .war contidos nele, e dentro do .war tem a seguinte estrutura:

[quote]+META-INF
+WEB-INF
+reports
&nbsp&nbsp&nbsp&nbsp relatorio.jrxml
…[/quote]

Então eu uso o código abaixo pra chegar até o arquivo do meu relatório

FacesContext facesContext = FacesContext.getCurrentInstance(); ExternalContext extCtx = facesContext.getExternalContext(); ServletContext serCtx = (ServletContext) extCtx.getContext(); System.out.println(serCtx.getRealPath("/reports/relatorio.jrxml"));
só que esse println ai, imprime a seguinte linha:

seria esse mesmo o caminho correto pra eu passar para o jasper no comando abaixo ??? ou isso está completamente errado? bem, errado está, pq se eu passar isso pro jasper, ele diz que nao encontra o arquivo ( No such file or directory )

Onde será q tah o erro ? Estou colocando o relatorio.jrxml no lugar errado? estou tentando acessa-lo de forma errada ?

Desde já grato t+

Bem, eu consegui fazer o jasper chegar até o arquivo, a linha abaixo de certa forma está correta, a única coisa q eu fiz foi um replace na string para remover o “./” no meio do path, q eu nao intendi neim o pq e pra q está ali…

[quote]/home/cleitonash/java/jboss-4.2.3.GA/server/default/./tmp/deploy/tmp5188328237153226693jboss-seam-itext.ear-contents/jboss-seam-itext-exp.war/reports/relatorio.jrxml
ficou assim
/home/cleitonash/java/jboss-4.2.3.GA/server/default/tmp/deploy/tmp5188328237153226693jboss-seam-itext.ear-contents/jboss-seam-itext-exp.war/reports/relatorio.jrxml[/quote]

a unica coisa q muda é o número dessa pasta tmp, que é onde o jboss descompacta o arquivo .war…

só q agora a seguinte excessao está sendo lançada: nao sei pq

os jars do jasperreports existem em 2 locais, no aplicacao.ear/lib e no aplicacao.war/WEB-INF/lib, qual é o lugar correto pra deixar os jars do jasper ?

Att.

bom, consegui resolver esse problema tbem, agora nao passa da linha que compila o relatorio

e na página de debud do jboss seam (JBoss Seam Debug Page) aparece a seguinte excessao

[quote]Exception during request processing: Caused by javax.el.ELException with message: "java.lang.reflect.InvocationTargetException"
org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:339)
org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:348)
org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
org.jboss.seam.core.Expressions$2.invoke(Expressions.java:175)
org.jboss.seam.navigation.Pages.callAction(Pages.java:692)
org.jboss.seam.navigation.Pages.preRender(Pages.java:330)
org.jboss.seam.jsf.SeamPhaseListener.preRenderPage(SeamPhaseListener.java:561)
org.jboss.seam.jsf.SeamPhaseListener.beforeRenderResponse(SeamPhaseListener.java:472)
org.jboss.seam.jsf.SeamPhaseListener.beforeServletPhase(SeamPhaseListener.java:148)
org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:118)
com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:214)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:96)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:368)
org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)
org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
java.lang.Thread.run(Thread.java:619)

Caused by java.lang.reflect.InvocationTargetException with message: “”

sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:32)
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28)
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:77)
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
org.jboss.seam.core.SynchronizationInterceptor.aroundInvoke(SynchronizationInterceptor.java:32)
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185)
org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103)
org.jboss.seam.example.pdf.GeraDanfeAction_$$javassist_seam_2.gerar(GeraDanfeAction$$_javassist_seam_2.java)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:335)
org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:348)
org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
org.jboss.seam.core.Expressions$2.invoke(Expressions.java:175)
org.jboss.seam.navigation.Pages.callAction(Pages.java:692)
org.jboss.seam.navigation.Pages.preRender(Pages.java:330)
org.jboss.seam.jsf.SeamPhaseListener.preRenderPage(SeamPhaseListener.java:561)
org.jboss.seam.jsf.SeamPhaseListener.beforeRenderResponse(SeamPhaseListener.java:472)
org.jboss.seam.jsf.SeamPhaseListener.beforeServletPhase(SeamPhaseListener.java:148)
org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:118)
com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:214)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:96)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:368)
org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)
org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
java.lang.Thread.run(Thread.java:619)[/quote]
a unica linha referente a minha aplicacao é a que esta em negrito

Att

último post

http://seamframework.org/Community/SeamWithJSFAndJasperReports

é só colocar os Jar dentro da pasta lib do servidor

cleiton herrmann Bom Dia !

Que parto do caralho para fazer um relatório meu amigo !

Cara deu certo ? e como ficou ?