Are sample config files available for confluence EAR/WAR?
Asked by Jens Goerke:

Trawling through the online documentaion to gather all the required fragments has proved to be too error-prone. Are sample config files available for download?


Answers:
author: Nic Brough -Adaptavist-
body: The problem with "sample" files is that you can guarantee that they will be wrong for your system, and the corrections you'd need to make are probably significantly more complex than trying to "gather all the required fragments". (In fact, the "sample" files I'd start with are in the distribution)

Could you explain where you are stuck on the config though?

comments: author: Jens Goerke
body: I can read from the database (different server) but I can't write, and I get error messages about the session being no longer valid.

A well-commented sample configuration file can be adapted in a day; trying to find answers in the documentation has already taken months.


author: Nic Brough -Adaptavist-
body: I could give you my config files. They would be utterly useless to you until you converted them.

The steps you need to take to make my files work for you are exactly the same as the steps involved in taking the files in the EAR/WAR distribution and adapting them to work for you. In fact, adapting mine would be MORE work, because we've got stuff in ours that you probably do not need and could break stuff.

Again, could you explain where you are stuck? What documentation are you following? I've never had any significant problems following the baseline installation from Atlassian, the problems have always been trying to do the odd things the current client wants added.

(Oh, and "can read/can't write" usually implies your database has been set up incorrectly - nothing to do with the application)


author: Jens Goerke
body: The database setup is identical to the one on another Confluence instance, albeit a different version on a different linux distribution. Permissions are set correctly, and I think I missed something somewhere in the database client configuration or set some variable to a wrong value.

As for documentation I'm looking at [confluence.atlassian.com](http://confluence.atlassian.com) under Confluence Configuration Guide for EAR/WAR, picking up fragments of sample configuration files (sometimes without any reference as to which file the current fragment should go in and unclear descriptions).

The other Confluence instance isn't much help either, since that configuration has been through several interations plus updates and upgrades, so there are several instances of config files all over several directories, some of which supersede others.

My task is to build a new instance with a clean configuration, which is easier to maintain (and upgrade).


author: Nic Brough -Adaptavist-
body: Um. Which document? Where are you stuck? Because the doc I'm reading tells you exactly which files need modifying, and how to do it.

I can see why you might say "fragments" in the doc I'm reading, but the whole point of the doc is to take a standard starting point and modify only the bits you need to, to make it work. Giving you the whole file is pointless, confusing and distracting because you might miss the important bits, and often, a lot of it is utterly irrelevant (and for most EAR/WAR users, it's different, so parroting irrelevant standards is going to make even more of a mess).

"Change the line that says X to Y" is far more clear than "Here's 600 lines, of which you need to change line 384, but then merge the rest of it with stuff that's specific for your installation and Confluence doesn't actually care about"

I'm starting to think you've picked up the wrong documentation, but I can't tell because you've only given part of the information needed to find it.


author: Jens Goerke
body: It's for version 3.2.x - sorry, I should have mentioned that earlier. That's the version of the more or less mangled Confluence instance I'm trying to replace and upgrade.

"Change the line that says X to Y" isn't helpful if there is no line that says X, because the file where that line should be isn't included in the distribution, so I'm asking if there are any sample configuration files. That's my whole point. I am piecing together a configuration from the bits in the documentation - connection to MySQL goes via the JDBC-Connector, configuration works partly, two dozen clicks further on in the documentation I find out that there needs to be another parameter as well to enable a graceful reconnect in case of connection problems.

Take a look at a default Apache or Tomcat installation - it won't work out of the box, but at least you get basic sample configuration files as a starting point.


author: Nic Brough -Adaptavist-
body: Yes, but which 3.2 document are you following?

I'd agree a "change x to y" line isn't of use if the line isn't there, but the problem is, when I follow the documentation, the line IS there. I have no idea what you're looking at, or why it's missing.

And, actually, Apache and Tomcat can work out of the box, but their docs all contain "change X to Y" pointers to get you up and running.

What I'm getting at is that the sample configuration IS there, you make minimal changes to get the basics running, and it works. The 3.4 EAR/WAR Confluence at my main client is actually deployed with a process that downloads the distribution, makes two standard out-of-the-documentation changes to files in the download, rebuilds it and installs it on the test system.

I can only assume that you are working from documentation that isn't what I'm looking at, or that your setup is so far from "standard", the documentation and standard files in the downloads aren't going to help. In the second case, nor are "sample config files", because they'll be based on what you get in the download.


author: Jens Goerke
body: I'm going through <https://confluence.atlassian.com/display/CONF32/Confluence+Configuration+Guide>

The basic setup from "Confluence 101" worked, the "Confluence Setup Wizard" completed somehow successfully, the MySQL-dump could be imported into the database, the attachments could be copied, but when I try to do anything that requires writing to the database I get the aforementioned error. The errors in atlassian-confluence.log also point towards problems with hibernate and jackson - I know the problem is very probably caused by something I missed and/or misconfigured, so a clean set of sample config files with a standard starting configuration would be extremely helpful in tracking down that problem.


author: Nic Brough -Adaptavist-
body: Right, so the docs are ok to get you through the basics, but I think you've drifted off the path somewhere.

If you can't read/write the database, then that almost always causes Hibernate errors, and other failures will manifest as well, probably including Jackson, session closures and the like.

You wouldn't find sample configurations of any help to you here, because the ones you've got are probably absolutely fine (especially if you've followed the docs), and what you need to fix is the database access.

Generally, to get a clean log of the problem, I'd stop Confluence, clear out the existing logs and restart it. Then look at the first block of errors you get to see if you can interpret them - would it be possible to paste the initial errors here? Ideally along with their "caused by" lines following.

Also, can you check the Confluence machine can connect to the database with enough rights? Easiest way is to run the mysql client, ideally from the confluence machine so it's using the same route, and use it to log into the database using the same url you are feeding to Confluence. Then check the user has full rights inside that database.


author: Jens Goerke
body: You're right, it looks like I missed something in the configuration for hibernate:

2013-04-10 14:57:16,643 FATAL \[main\] \[sf.hibernate.connection.DatasourceConnectionProvider\] configure Could not find datasource: java:comp/env/jdbc/ConfluenceDS

javax.naming.NameNotFoundException: Name ConfluenceDS is not bound in this Context  
at org.apache.naming.NamingContext.lookup(NamingContext.java:770)  
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultTransactionInterceptor' defined in class path resource\[applicationContext.xml\]: Cannot resolve reference to bean 'transactionManager'while setting bean property 'transactionManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in class path resource \[databaseSubsystemContext.xml\]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource \[productionDatabaseContext.xml\]: Invocation of init method failed; nested exception is net.sf.hibernate.HibernateException: Could not find datasource


author: Nic Brough -Adaptavist-
body: Nothing to do with hibernate, as I said, that's a compounded error caused by your configuration.

Your datasource settings are wrong. You need to correct them, as per docs.


author: Jens Goerke
body: One configuration file had the wrong password, and the permissions for the database user were too tight. After fixing those problems it still doesn't work, albeit with different error messages. I'll try a clean install next.


author: Nic Brough -Adaptavist-
body: Ah, that's good. I've lost count of the number of times I've got passwords wrong in settings files - I think I'm averaging about twice per install (I'm not a good typist, I'm not great at spelling and my memory is appalling).

Let us know if the new error messages are unhelpful. Although, I'm commenting because I had a case the other day where I'd done exactly this, and after correcting the password, still had problems - it seemed Confluence had cached or stored something in temporary files in the Tomcat install and wasn't clearing/reloading that. So, before you try a complete re-install, it might be worth a quick housekeep - kill the files in the tomcat working directory (not the directories, just the files) and see if that clears any errors.