Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[birt-dev] BIRT + JSF + HIbernate

Hi,

I have a web application for uploading rptdesing BIRT report files to the
server. In addition, I have to save some data (like the path of these
rptdesign files) in a Data Base. The application also allows you to call
BIRT giving them a parameter with the path of the rptdesign file in order to
view the report (I get the path from the Data Base).

My application has a dependency:

<dependency>
  <groupId>birt</groupId>
  <artifactId>birt-webapps</artifactId>
  <version>2.1</version>
  <type>war</type>
</dependency>

I use Hibernate for loading and saving data into Data Base and JSF to create
the web pages with forms for introducing the data. My application server is
JOnAS 4.8.4.

As you can imagine, my final WAR will have an WEB-INF directory with several
files:

- web.xml
- faces-config.xml
- jonas-web.xml
- server-config.wsdd

and the directory classes with compiled classes used in faces and the
classes and the mappings for hibernate.

This application works ok in Tomcat 5.5.17. With no problems. But I have to
use JOnAS and when I try to call BIRT in JOnAS with:

http://localhost:9000/birt-webapp/run?__format=pdf&__report=reports/prueba.rptdesign

The application fails printing this trace:

java.lang.NullPointerException
        at
org.eclipse.birt.report.service.ReportEngineService.setEngineContext(Unknown
Source)
        at
org.eclipse.birt.report.service.BirtViewerReportService.setContext(Unknown
Source)
        at
org.eclipse.birt.report.servlet.BirtEngineServlet.__getContext(Unknown
Source)
        at
org.eclipse.birt.report.servlet.BaseReportEngineServlet.doGet(Unknown
Source)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
        at
org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
        at
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:275)
        at
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:161)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:245)
        at
org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:50)
        at
org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:156)
        at java.security.AccessController.doPrivileged(Native Method)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:152)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
        at
org.objectweb.jonas.web.catalina55.ResetAuthenticationValve.invoke(ResetAuthenticationValve.java:62)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
        at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
        at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
        at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
        at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
        at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
        at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
        at java.lang.Thread.run(Thread.java:595)

I tried several things for guessing what's happening here. 

I tested the application without using faces, deleting faces files in
WEB-INF and faces libraries with NO result.
I tested the application without hibernate, deleting hibernate files in
WEB-INF and hibernate libraries with NO result.

But when I test the application using only BIRT it works!!

I think the problem is that BIRT+JSF+Hibernate cannot work in the same WAR.

Here is my web.xml:

<?xml version="1.0" encoding="utf-8"?>

<!DOCTYPE web-app PUBLIC
  "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
  "http://java.sun.com/dtd/web-app_2_3.dtd";>

<web-app>

	<display-name>Eclipse BIRT Report Viewer</display-name>

	<context-param>
		<param-name>BIRT_VIEWER_LOCALE</param-name>
		<param-value>en-US</param-value>
	</context-param>

	<context-param>
		<param-name>BIRT_VIEWER_WORKING_FOLDER</param-name>
		<param-value></param-value>
	</context-param>

	<!-- If usr can only access the reprot under working folder. Default is
true -->
	<context-param>
		<param-name>WORKING_FOLDER_ACCESS_ONLY</param-name>
		<param-value>false</param-value>
	</context-param>

	<!-- Absolute downloaded image/chart directory. Default to ${birt
home}/report/images -->
	<context-param>
		<param-name>BIRT_VIEWER_IMAGE_DIR</param-name>
		<param-value></param-value>
	</context-param>

	<!-- Absolute engine log directory. Default to ${birt home}/logs -->
	<context-param>
		<param-name>BIRT_VIEWER_LOG_DIR</param-name>
		<param-value></param-value>
	</context-param>

	<!-- Report engine log level -->
	<context-param>
		<param-name>BIRT_VIEWER_LOG_LEVEL</param-name>
		<param-value>OFF</param-value>
	</context-param>

	<!-- Absolute directory to store all birt report script libraries (JARs).
Default to ${birt home}/scriptlib -->
	<context-param>
		<param-name>BIRT_VIEWER_SCRIPTLIB_DIR</param-name>
		<param-value></param-value>
	</context-param>
	
	<!-- Absolute resource location directory. -->
	<context-param>
		<param-name>BIRT_RESOURCE_PATH</param-name>
		<param-value></param-value>
	</context-param>

	<!-- Preview report max rows limited. -->
	<context-param>
		<param-name>BIRT_VIEWER_MAX_ROWS</param-name>
		<param-value></param-value>
	</context-param>

	<context-param>
		<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
		<param-value>server</param-value>
	</context-param>

	<context-param>
		<param-name>org.apache.myfaces.COMPRESS_STATE_IN_SESSION</param-name>
		<param-value>false</param-value>
	</context-param>

	<context-param>
		<param-name>org.apache.myfaces.SERIALIZE_STATE_IN_SESSION</param-name>
		<param-value>false</param-value>
	</context-param>

	<context-param>
		<param-name>com.sun.faces.validateXml</param-name>
		<param-value>true</param-value>
	</context-param>

	<context-param>
		<param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
		<param-value>true</param-value>
		<description>
			If true, a javascript function will be rendered that is able
			to restore the former vertical scroll on every request.
			Convenient feature if you have pages with long lists and you
			do not want the browser page to always jump to the top if
			you trigger a link or button action that stays on the same
			page. Default: "false"
		</description>
	</context-param>

	<context-param>		
		<param-name>org.apache.myfaces.VALIDATE</param-name>
		<param-value>true</param-value>
		<description>
			Validate managed beans, navigation rules and ensure that
			forms are not nested.
		</description>
	</context-param>

	<!-- Extensions Filter -->
	<filter>
		<filter-name>extensionsFilter</filter-name>
		<filter-class>
			org.apache.myfaces.webapp.filter.ExtensionsFilter
		</filter-class>
	</filter>

	<filter-mapping>
		<filter-name>extensionsFilter</filter-name>
		<url-pattern>*.jsf</url-pattern>
	</filter-mapping>

	<filter-mapping>
		<filter-name>extensionsFilter</filter-name>
		<url-pattern>/faces/*</url-pattern>
	</filter-mapping>
	

	
	<!-- Viewer Servlet Context Listener -->
	<listener>
	
<listener-class>org.eclipse.birt.report.listener.ViewerServletContextListener</listener-class>		
	</listener>

	<!-- Listener, that does all the startup work (configuration, init). -->
	<listener>
		<listener-class>
			org.apache.myfaces.webapp.StartupServletContextListener
		</listener-class>
	</listener>

	<listener>
		<listener-class>
			com.example.core.InitServletContextListener
		</listener-class>
	</listener>

	<servlet>
		<servlet-name>ViewerServlet</servlet-name>
	
<servlet-class>org.eclipse.birt.report.servlet.ViewerServlet</servlet-class>
	</servlet>

	<servlet>
		<servlet-name>EngineServlet</servlet-name>
	
<servlet-class>org.eclipse.birt.report.servlet.BirtEngineServlet</servlet-class>
	</servlet>

	<!-- Faces Servlet -->  
	<servlet>
		<servlet-name>Faces Servlet</servlet-name>
		<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
	</servlet>

	<servlet-mapping>
		<servlet-name>ViewerServlet</servlet-name>
		<url-pattern>/frameset</url-pattern>
	</servlet-mapping>
	
	<servlet-mapping>
		<servlet-name>EngineServlet</servlet-name>
		<url-pattern>/run</url-pattern>
	</servlet-mapping>

	<servlet-mapping>
		<servlet-name>EngineServlet</servlet-name>
		<url-pattern>/download</url-pattern>
	</servlet-mapping>

	<servlet-mapping>
		<servlet-name>EngineServlet</servlet-name>
		<url-pattern>/parameter</url-pattern>
	</servlet-mapping>

	<!-- Faces Servlet Mapping -->
	<servlet-mapping>
		<servlet-name>Faces Servlet</servlet-name>
		<url-pattern>*.faces</url-pattern>
	</servlet-mapping>

	<servlet-mapping>
		<servlet-name>Faces Servlet</servlet-name>
		<url-pattern>*.jsf</url-pattern>
	</servlet-mapping>

    <resource-ref> 
	   <description>Connection to database</description> 
       <res-ref-name>jdbc/DS</res-ref-name> 
       <res-type>javax.sql.DataSource</res-type> 
       <res-auth>Container</res-auth> 
    </resource-ref>
		
</web-app>


Have you any idea about why is happening this? 

Thanks for reading.



-- 
View this message in context: http://www.nabble.com/BIRT-%2B-JSF-%2B-HIbernate-tf3765329.html#a10644253
Sent from the Eclipse BIRT - Dev mailing list archive at Nabble.com.



Back to the top