Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

To configure database connection I can not find file: org.objectledge.database.XaPoolDataSource.xml #1

Open
mehdimir opened this issue May 28, 2013 · 19 comments

Comments

@mehdimir
Copy link

I am trying to setup Cyklotron on my computer but I do not know how to configure database connection, since I can not find file org.objectledge.database.XaPoolDataSource.xml mentioned in "configure database connection" section of installation guide (http://objectledge.org/confluence/display/CYKLO/Installation+overview)

@rkrzewski
Copy link
Member

Oh, that documentation is really outdated. You should set up the connection using org.objectledge.btm.BitronixTransactionManager.xml instead.

@mehdimir
Copy link
Author

Thanks, I am already using org.objectledge.btm.BitronixTransactionManager.xml however I am getting error running the application. Is there anything I installed in wrong way?
error_in_project

@mklew
Copy link
Member

mklew commented May 28, 2013

Yup these docs are completely outdated. Here you have example configuration of postgres database. In case of postgres I guess you also need patched driver from our Nexus or maybe it's not necessary any longer, is it @rkrzewski ?

<?xml version="1.0"?>
<config xmlns="http://objectledge.org/btm/1.0">
  <tm>
    <serverId>node0</serverId>
    <disableJmx>true</disableJmx>
    <journal>
      <disk>
        <!-- use absolute paths on production system -->
        <logPart1Filename>btm/btm1.tlog</logPart1Filename>
        <logPart2Filename>btm/btm2.tlog</logPart2Filename>
      </disk>
    </journal>
    <timer>
      <defaultTransactionTimeout>300</defaultTransactionTimeout>
    </timer>
  </tm>
  <tracing>
    <disabled />
    <statementLog>org.objectledge.database.SQL</statementLog>
  </tracing>
  <jdbc>
    <connectionPool uniqueName="pg">
      <className>org.postgresql.xa.PGXADataSource</className>
      <maxPoolSize>20</maxPoolSize>
      <allowLocalTransactions>true</allowLocalTransactions>
      <enableJdbc4ConnectionTest>true</enableJdbc4ConnectionTest>
      <preparedStatementCacheSize>20</preparedStatementCacheSize>
      <driverProperties>
        <property name="serverName">localhost</property>
        <property name="databaseName">21_v3</property>
        <property name="user">cyklotron</property>
        <property name="password">cyklotron</property>
        <property name="prepareThreshold">100</property>
      </driverProperties>
    </connectionPool>
  </jdbc>
</config>

@mklew
Copy link
Member

mklew commented May 28, 2013

@maghaei that stack trace has no use. Check for log messages, scroll up and see what caused LedgeServletContextListener to fail.

@mehdimir
Copy link
Author

I only get these info in the log:
May 28, 2013 3:24:57 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Allocate exception for servlet ledge
javax.servlet.ServletException: org.objectledge.container is missing from SerlvetContext
at org.objectledge.web.LedgeServlet.init(LedgeServlet.java:142)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1266)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1185)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:857)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:136)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)

@rkrzewski
Copy link
Member

You should keep an eye on WORKDIR/logs/ledge.log and also on Tomcat log files: CATALINA_BASE/logs/catalina.out and CATALINA_BASE/logs/localhost_DATE.log

My blind guess is that you database schema is not initialized yet. You need to use cyklotron-installer for that.

@mehdimir
Copy link
Author

the log that I sent you is tomcat log. I take a look at ledge.log/search.log/sql.log files but they were all empty.

I already initialized the data base schema, I can even see the database "lcms" in pgAdmin III.

@mehdimir
Copy link
Author

I think your guess is kind of correct, I can not run this command:
createdb -U -E UNICODE

postgre does not accept the password shown in file: org.objectledge.btm.BitronixTransactionManager.xml
I even tried to create a username and password with same information, but it still does not work.

@rkrzewski
Copy link
Member

that error means thas org.objectledge.web.LedgeServletContextListener failed to initialize the container. You should see the line below followed by a stack trace in TOMCAT_HOME/logs/localhost.DATE.log

SEVERE: Exception sending context initialized event to listener instance of class org.objectledge.web.LedgeServletContextListener

@rkrzewski
Copy link
Member

creating a database schema is a necessary first step, but then you must use cyklotron-installer to create necessary tables and load initial data.

@mehdimir
Copy link
Author

How would you create database schema and load initial data? with "mvn init" in cyklotron-installer (I tried it, no init is defined in pom.xml of installer)?

@rkrzewski
Copy link
Member

you need to run mvn install in the installer module to generate the installer jar. then you should edit etc/installer.properties as necessary for your setup and finally launch the installer with
java -jar target/installer-2.24-SNAPSHOT.jar

@rkrzewski
Copy link
Member

If you had trouble connecting to the (empty) postgres database from the web application, chances are it won't work from installer too.
Please consult Postgres documentation on how to configure the access policy
http://www.postgresql.org/docs/current/static/auth-pg-hba-conf.html

@mehdimir
Copy link
Author

I ran mvn install on installer and changed etc/installer.properties to give the right location of jdbc jar file. However, by running java -jar target/installer-2.25.0.jar I get this error:

C:\Users\nainy\NainyBitsDropbox\Dropbox\Automated mobile application navigation
cyklotron-master\cyklotron-master\cyklotron-installer>java -jar target\installer
-2.25.0.jar
0 [main] INFO root - work directory path: C:\Users\nainy\NainyBitsDropbox\Dropb
ox\Automated mobile application navigation\cyklotron-master\cyklotron-master\cyk
lotron-installer\workdir
1 [main] INFO root - connecting to the database
14 [main] INFO root - dataSourceClass: org.postgresql.xa.PGXADataSource
14 [main] INFO root - dataSourceProperty: prepareThreshold = 100
14 [main] INFO root - dataSourceProperty: user = cyklotron
14 [main] INFO root - dataSourceProperty: password = 12345
15 [main] INFO root - dataSourceProperty: databaseName = inst
15 [main] INFO root - dataSourceProperty: serverName = localhost
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further detail
s.
879 [main] INFO root - setting up Coral database schema
failed to execute installation scripts
bitronix.tm.resource.ResourceConfigurationException: cannot create JDBC datasour
ce named coral
at bitronix.tm.resource.jdbc.PoolingDataSource.init(PoolingDataSource.ja
va:92)
at bitronix.tm.resource.jdbc.PoolingDataSource.getConnection(PoolingData
Source.java:250)
at org.objectledge.database.impl.DelegatingDataSource.getConnection(Dele
gatingDataSource.java:74)
at org.objectledge.database.DatabaseType.detect(DatabaseType.java:81)
at org.objectledge.coral.tools.init.InitComponent.(InitComponent.j
ava:55)
at net.cyklotron.cms.installer.Installer.initSchema(Installer.java:202)
at net.cyklotron.cms.installer.Installer.run(Installer.java:82)
at net.cyklotron.cms.installer.Main.main(Main.java:72)
Caused by: java.lang.ClassNotFoundException: org.postgresql.xa.PGXADataSource
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at bitronix.tm.utils.ClassLoaderUtils.loadClass(ClassLoaderUtils.java:63
)
at bitronix.tm.resource.common.XAPool.createXAFactory(XAPool.java:292)
at bitronix.tm.resource.common.XAPool.(XAPool.java:63)
at bitronix.tm.resource.jdbc.PoolingDataSource.buildXAPool(PoolingDataSo
urce.java:101)
at bitronix.tm.resource.jdbc.PoolingDataSource.init(PoolingDataSource.ja
va:88)
... 7 more

@rkrzewski
Copy link
Member

The error message says that Postgres driver class could not be loaded. Apparently the location of the driver jar you entered is not correct. Did you use an absolute path?

@mehdimir
Copy link
Author

Yes, I am using absolute path. However, even if I change the etc/installer.properties (to modify the location of jdbc Jar file), the command " java -jar target/installer-2.25.0.jar " uses the original information of etc/installer.properties.

@rkrzewski
Copy link
Member

oh, right sorry. It uses the file packaged inside the jar by default. In fact, it would be better if you made a copy of etc/installer.properties elsewhere and then pass the path of that modified file as an argument to installer invocation. You can also pass the path of the workdir to be prepared as the second argument.

java -jar java -jar target/installer-2.25.0.jar ~/work/cyklotron/installer.properties ~/work/cyklotron/workdir

installer will generate a bunch of configuration files in the workdir for you. You will need to pass the workdir location to the web application afterwards. You can do that by creating tomcat contax descriptor like the folowing

<Context
  path=""
  docBase="<cyklotron.war location>"
  reloadable="false"
  unpackWAR="false"
  useNaming="false">
  <Parameter
    name="root" 
    value="<workdir location>" 
    override="false" />
</Context>

@mehdimir
Copy link
Author

Thanks, now the installer takes the modified information of installer.properties but still gives me the same error when I run:
java -jar target/installer-2.25.0.jar ~/work/cyklotron/installer.properties

@mehdimir
Copy link
Author

I would really appreciate if you could update the installation document. I promise to complete it If I was able to install the application on my machine :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants