Jasperserver PostgreSQL on CentOS error

Hi,

I'm trying to install jasperserver and have run into this problem, i have no idea why, I can connect to the postgresql database with the username in the config files but I get the following error.

I don't have much experience with java so I'm a bit stumped as to what the problem is.

 


 

Code:
03:17:33,485 ERROR [/jasperserver],main:3768 - Exception sending context initialized event to listener instance of class com.jaspersoft.jasperserver.war.util.SpringBeanServletContextPlublisher
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in ServletContext resource [/WEB-INF/applicationContext-datasource.xml]: Invocation of init method failed; nested exception is javax.naming.NamingException: Could not create resource factory instance [Root exception is java.lang.ClassNotFoundException: org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory]
Caused by: 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in ServletContext resource [/WEB-INF/applicationContext-datasource.xml]: Invocation of init method failed; nested exception is javax.naming.NamingException: Could not create resource factory instance [Root exception is java.lang.ClassNotFoundException: org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory]
Caused by: 
javax.naming.NamingException: Could not create resource factory instance [Root exception is java.lang.ClassNotFoundException: org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory]
        at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:118)
        at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:793)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:781)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:781)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:781)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
        at org.apache.naming.SelectorContext.lookup(SelectorContext.java:137)
        at javax.naming.InitialContext.lookup(InitialContext.java:351)
        at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:124)
        at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:86)
        at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:122)
        at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:147)
        at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:91)
        at org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:101)
        at org.springframework.jndi.JndiObjectFactoryBean.lookupWithFallback(JndiObjectFactoryBean.java:164)
        at org.springframework.jndi.JndiObjectFactoryBean.afterPropertiesSet(JndiObjectFactoryBean.java:151)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1118)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1085)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:429)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:250)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:141)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:247)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:161)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:245)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:124)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1019)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:809)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:425)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:250)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:141)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:247)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:161)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:270)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:346)
        at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:156)
        at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246)
        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184)
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3764)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4216)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)
        at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)
        at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
        at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022)
        at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
        at org.apache.catalina.core.StandardService.start(StandardService.java:448)
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
        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.startup.Bootstrap.start(Bootstrap.java:295)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
Caused by: java.lang.ClassNotFoundException: org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:164)
        at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:115)
        ... 65 more
May 12, 2009 3:17:33 AM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
May 12, 2009 3:17:33 AM org.apache.catalina.core.StandardContext start
SEVERE: Context [/jasperserver] startup failed due to previous errors
May 12, 2009 3:17:34 AM org.apache.coyote.http11.Http11BaseProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
May 12, 2009 3:17:34 AM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
May 12, 2009 3:17:34 AM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/121  config=null
May 12, 2009 3:17:34 AM org.apache.catalina.storeconfig.StoreLoader load
INFO: Find registry server-registry.xml at classpath resource
May 12, 2009 3:17:34 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 6888 ms
 
 
my context file is this 
<Context path="/jasperserver" antiJARLocking="true"
            debug="5" reloadable="true" crossContext="true">
 
        <!-- maxActive: Maximum number of dB connections in pool. Make sure you
             configure your mysqld max_connections large enough to handle
             all of your db connections. Set to 0 for no limit.
        -->
        <!-- maxIdle: Maximum number of idle dB connections to retain in pool.
             Set to -1 for no limit.  See also the DBCP documentation on this
             and the minEvictableIdleTimeMillis configuration parameter.
         -->
        <!-- maxWait: Maximum time to wait for a dB connection to become available
             in ms, in this example 10 seconds. An Exception is thrown if
             this timeout is exceeded.  Set to -1 to wait indefinitely.
        -->
 
 
    <Resource name="jdbc/jasperserver" auth="Container" type="javax.sql.DataSource"
        maxActive="100" maxIdle="30" maxWait="10000"
        username="jasperadmin" password="password"
        driverClassName="org.postgresql.Driver"
        url="jdbc:postgresql://localhost:5432/prd_jasperserver?useUnicode=true&characterEncoding=UTF-8"
        defaultAutoCommit="false"/>
 
</Context>
</td></tr></tbody></table>
topnob's picture
14
Joined: May 12 2009 - 12:08am
Last seen: 14 years 4 months ago

17 Answers:

This is related to Tomcat, perhaps permission issue. Do you install using JS bundled? or JS WAR file? I would suggest to install Tomcat separatly and install the JS using WAR file.

You might follow the instruction on my blog http://www.raj2u.net/jasperserver-35-with-postgresql-83-on-linux.html

anandharaj's picture
7945
Joined: Oct 18 2006 - 5:02pm
Last seen: 9 years 11 months ago

I am using the community edition, please kindly point out where I can find the following scripts.  BTW, i have both bin and war files unzipped.

prd_jasperserver<span style="color: rgb(0, 0, 0); font-weight: bold;">></span> \\i js<span style="color: rgb(0, 0, 0);">-3.5</span>-create-schema.sql
prd_jasperserver<span style="color: rgb(0, 0, 0); font-weight: bold;">></span> \\i js<span style="color: rgb(0, 0, 0);">-3.5</span>-create-default-security.sql
huw@trimet.org's picture
Joined: Feb 8 2007 - 9:24am
Last seen: 5 years 5 months ago

Two different answers ;-)

 

1) Regarding the very first post. I looked at the Java Exception stack trace that you posted. The error is about creating the datasource that is needed in the jasperserver war file:  /WEB-INF/applicationContext-datasource.xml.

 

The datasource needs to be provided by Tomcat. So, please take a look at Section 6.6 "Notes on Database Connection for Tomcat" in the <js-install>/docs/JasperServer-Install-Guide.pdf.

 

Also, please take a look at Section 5.0 "Installing from the WAR File Distribution". There are a new set of scripts (known as "buildomatic") that will automatically configure and update all the files that the Application Server needs. The scripts support Tomcat and JBoss, and they support MySQL and PostgreSQL.

 

2) The second question was about locations of files. For MySQL, you would run the following files:

<js-install>/buildomatic/install_resources/sql/mysql/create.ddl

<js-install>/buildomatic/install_resources/sql/mysql/quartz.ddl 

<js-install>/scripts/mysql/jasperserverCreateDefaultSecurity-mysql.sql

 

For PostgreSQL... I just noticed that there is no "create.ddl" for postgresql. This file is automatically built when you do the source code build. I meant to check it in for the 3.5.0 release.... I will check that in later today. And I can attach it to this forum post.

For PostgreSQL, there is no jasperserverCreateDefaultSecurity.sql. In the past, users have been creating them (based on the mysql version) and then making it available to all the postgresql users.

 

tkavanagh's picture
16386
Joined: Jul 7 2006 - 8:54am
Last seen: 9 years 4 weeks ago
@hu97224 Refer to attachment section, after "References"
anandharaj's picture
7945
Joined: Oct 18 2006 - 5:02pm
Last seen: 9 years 11 months ago

I followed that install guide, and used the war file.

topnob's picture
14
Joined: May 12 2009 - 12:08am
Last seen: 14 years 4 months ago

Yes, I followed your instruction and downloaded your postgresql scripts, my JS is up running.

 

I wanted to install the sugarcrm and foodmart example, I was able to install the database.  How do I make the examples show up in the report reposity.  I recall there were scripts in version 2.1 to do that.  Is there such scripts for postgresql for JS CE 3.5?

Thanks in advance.

huw@trimet.org's picture
Joined: Feb 8 2007 - 9:24am
Last seen: 5 years 5 months ago
I believe its not available in JS 3.5
anandharaj's picture
7945
Joined: Oct 18 2006 - 5:02pm
Last seen: 9 years 11 months ago

There are postgresql scripts available to create - sugarcrm and foodmart DB These are in directory -

C:\\jasperserver-3.5.0-bin\\buildomatic\\install_resources\\sql\\postgresql

hope this helps!

 

 

 

ramnik's picture
3249
Joined: Mar 16 2007 - 9:10am
Last seen: 16 years 6 months ago

What would I have to do to the tomcat to fix it? its a really perplexing issue for me.  If theres any more details you want I can provide them.

topnob's picture
14
Joined: May 12 2009 - 12:08am
Last seen: 14 years 4 months ago

Yes, I did create the sugarcrm and foodmart databases, but all the sample reports are not loaded in postgresql install of the JS3.5 CE version.  When I install mysql, it was all there, why is the difference?  Are there scripts in mysql may be I can convert them to postgresql?

huw@trimet.org's picture
Joined: Feb 8 2007 - 9:24am
Last seen: 5 years 5 months ago

Hi, I realized I made a mistake in not including the postgresql db create script in the directory:

 

    <js-install>/buildomatic/install_resources/sql/posgresql

 

So, I uploaded it an added it the the Downloads area. So, please look for a zip file named:

 

    postgresql-js-create-ddl.zip 

 

It contains a single file named "js-create.ddl". You should take this file and drop it into the buildomatic tree at the following location:

 

    <js-install>/buildomatic/install_resources/sql/posgresql  
   

Once you put this create script in this location, you can follow the steps in the <js-install>/docs/JasperServer-Install-Guide.pdf ton install jasperserver for postgresql.

 

The installation steps begin in Section 5 "Installing from the WAR File Distribution". It uses the buildomatic scripts in order to configure the datasource and other config files.
 

tkavanagh's picture
16386
Joined: Jul 7 2006 - 8:54am
Last seen: 9 years 4 weeks ago

I fixed this problem myself after a lot of googleing....

The Centos version of tomcat5 is borked, you need to download "naming-factory-dbcp.jar" as its not inlcuded in the rpm.

 

I put it in /var/lib/tomcat5/common/lib/ directory and restarted

 

I also had to copy postgresql-8.1-407.jdbc3.jar from the jasperserver-3.5.0-bin/scripts/lib/ directory to the /var/lib/tomcat5/common/lib/.

 
see this site for details http://deployer.astrogrid.org/software/vospace-2008.2.02/webapp/install/tomcat/tomcat-config.html

Code:
 wget http://www.astrogrid.org/maven/tomcat/jars/naming-factory-dbcp.jar \\
        -O /var/lib/tomcat5/common/lib/naming-factory-dbcp.jar 
 
cp ~/jasperserver-3.5.0-bin/scripts/lib/postgresql-8.1-407.jdbc3.jar /var/lib/tomcat5/common/lib/
</td></tr></tbody></table>
topnob's picture
14
Joined: May 12 2009 - 12:08am
Last seen: 14 years 4 months ago

Thanks, it Worked for me with Centos 5 / tomcat5 / jasperserver 5.6

mcabrera - 9 years 2 months ago

I seem to be having a similar issue. I have current Centos, PostgreSQL 8.3 and current JasperServer Community installed. I am using MySQL as the repository but want to use postgresql as a data source.

I copied the postgresql-8.3 jar file to apache-tomcat\\common\\lib and to the jasperserver driver directory.

When I try to setup the data source in jasperserver t, the test failes.

I have the Pro version on anther server (same configuration) and the connection works.

I have not changed the files in tomcat.

Is there an error log to look at? I am stumpted at the moment.

Any suggestions?

evalentine's picture
Joined: May 7 2009 - 1:37pm
Last seen: 7 years 3 months ago

Hi,

 

I came to the same conclusion as topnov in message #57000.

 

There is a known bug in RHEL that they haven't fixed after two years
of reporting!  The file naming-factory-dbcp.jar is missing
in the RPM for tomcat5-common-lib (Note you will need this jar IN ADDITION to
naming-factory.jar).



Adding the jar file naming-factory-dbcp.jar will fix this SEVERE error when RHEL's tomcat5
starts


Could not create resource factory instance [Root exception is
java.lang.ClassNotFoundException:
org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory]
 

Check out this thread:
https://bugzilla.redhat.com/show_bug.cgi?id=217630#c7
 

Please also note there are two "dbcp" classes with different names
 

org.apache.tomcat.dbcp.BasicDataSourceFactory
org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory
 

c.f.
http://www.mail-archive.com/users@tomcat.apache.org/msg27485.html
 

<quote>
Tomcat does not use commons-dbcp-x.x.x.jar (it's not in the Tomcat
distribution).  To avoid potential naming conflicts with webapps, the
DBCP classes are repackaged in common/lib/naming-factory-dbcp.jar,
adding the extra dbcp to the package name.  This allows webapps to use
commons-dbcp indepently of Tomcat's DBCP mechanism, if they desire.
</quote>
 

leeyuiwah's picture
1050
Joined: Oct 21 2008 - 4:52pm
Last seen: 9 years 6 months ago

I am still trying to get JasperServer community version to work with a PostgreSQL DB as the data source (not the Jasperserver database).

I can create a report in iReport but after transfering to the server, it fails with the following;

 

ERROR [jasperserver],http-8090-Processor21:253 - Servlet.service() for servlet jasperserver threw exception
java.lang.UnsupportedClassVersionError: Bad version number in .class file
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:620)

.......

The Java version in Jasperserver in 1.5.0. The current version available for Centos is 1.6.0 and is on the machine.

Is it possible this is the source of the version error?

Any suggestions / answers?

Thanks.

evalentine's picture
Joined: May 7 2009 - 1:37pm
Last seen: 7 years 3 months ago

This looks to be a Java compiled vs runtime issue. If there is a class compiled with java 1.6, and this class is attempted to be used with java 1.5 - then a class version error will result.

 

This can't be one of the included JasperServer classes because those are all compiled under java 1.5. Perhaps there is an additional jdbc driver you have added (or another jar or class to support some customizations that you have made)?

 

Also, you should double-check whether 1.6 is really getting used at runtime (maybe a couple different javas are hanging around).

tkavanagh's picture
16386
Joined: Jul 7 2006 - 8:54am
Last seen: 9 years 4 weeks ago

Thanks for the help.

Problem solved!

I was using a recent Postgresql for 8.3 but it was compiled with Java 1.6. Found a new driver @ http://jdbc.postgresql.org/download.html for new databases and Java 1.5 used with JasperServer.

This works.

Thanks again.

 

evalentine's picture
Joined: May 7 2009 - 1:37pm
Last seen: 7 years 3 months ago
Feedback
randomness