File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JForum and the fly likes Upgrading to version 2.1 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Products » JForum
Bookmark "Upgrading to version 2.1" Watch "Upgrading to version 2.1" New topic
Author

Upgrading to version 2.1

Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Upgrading from JForum version 2.0.2 to version 2.1 is quite simple. First, make a backup of the database and the current directoy where JForum is installed. Backup everything (templates, images etc). The suggested approach to use is to unpack JForum 2.1 into some directory, made the changes there and then, when all is finished, copy it over the directory where JForum 2.0.2 is located.
Now follow these steps, in the order they're shown:

:arrow: New configuration options
The file WEB-INF/config/SystemGlobals.properties has some new keys. To make the task easier, you should update the new file instead of trying to change the current (from 2.0.2). Compare both files and look for differences, updating the keys as necessary. Note that if your current version of SystemGlobals does not have some of the keys present in version 2.1, just leave with the defaults.

Important: You should not forget to change the value of the key "installation.config" to "${config.dir}/jforum-custom.conf".

Open jforum-custom.conf. If there is a key named "database.connection.string", remove it.

Good programs to help finding differences are WinMerge - http://winmerge.sf.net -, for the Windows Plataform, and diff, for Unix like machines. Good candidates for updating are "user.hash.sequence", "database.driver.name" and the mail settings.

:arrow: Database settings
Open the file WEB-INF/config/<dbname>/<dbname>.properties and check the username, password and host to connect. If you're going to use MySQL 4.1 or more recent, please set the value of the keys mysql.encoding and mysql.unicode to empty, as shown below:



Just make sure that there isn't any blank space after the "=" signal.

Also for MySQL 4.1+ users, go to WEB-INF/config/database/mysql and rename the file "mysql_41.sql" to "mysql.sql" (delete the existing mysql.sql file, which does not work for MySQL 4.1+)

:arrow: Renaming files
Next, go to WEB-INF/config and rename the file "<username>.conf" - where "<username" is the login account which is running the webserver, like "root.conf", "somehost.conf", "blah.con" etc - to "jforum-custom.conf". >Dont't forget this step. If the <username>.conf file does not exist, then ignore.

:arrow: Checking jforum-custom.conf
Now, open jforum-custom.conf and make sure that the configuration options are as expected. It may sound like an unnecessary step, since your forum is working already, but even that, just to be sure that none of the keys you changes in SystemGlobals.properties are being overwritten by this file.

Also in this file, search for a key named "database.connection.string". If you find, remove it.

:arrow: Upgrading the database
Now, import the SQL file named "<database>_2.0.2_to_2.1.sql" (like "mysql_2.0.2_to_2.1.sql") to your database. This script will convert the tables and create the new ones.

:arrow: About permissions
The security model in JForum 2.1 changed a little bit, so much probably you'll have to re-save the permissions from all groups again. The step is simple: just to to the Admin Control Panel -> Groups -> Permissions, check the options and then click "Save".

:arrow: Removing installation files
Now, do this:

  • rename the file "new_rename.htm" to "index.htm" (you can remove the existing index.htm)
  • delete the directory "install"
  • Open SystemGlobals.properties and add the following line:



  • Open WEB-INF/config/modulesMapping.properties and remove from it the following line:



    :arrow: Testing
    Now, if possible, test JForum 2.1 before copying it over 2.0.2. The easier way is to put it under some another Context. If the system started without problems, then you can proceed to the final step. As mentioned in the previous section, you may experience some issues with access rights. If the user you use in JForum 2.0.2 does for the administrative tasks does not have access to the control panel in JForum 2.1, please do this:

  • Find the user id of your user by executing the query



  • Go to your database console (or any administration tool use may use) and run the following SQL query:



    and then restart the servlet container.

    :arrow: Final Step
    Before copying the new files over the old ones, remove the following files from the directory WEB-INF/lib: "commons-fileupload-1.0-cvs.jar", "pgsql_driver74.213.jar", "mysql-connector-java-3.0.15-ga-bin.jar" and "hsqldb-1.7.2.6.jar".

    Now, the last step: copy all files and directories from JForum 2.1 over the files from version 2.0.2. Make sure you have backup of all 2.0.2 data before you do this. Restart the servlet container, and start using JForum 2.1.

    Now, re-save ALL permissions for ALL groups. Improvements to the permission model were made, so it is necessary that you save again the roles.

    That's all. For a complete list of new features and improvements, please access http://www.jforum.net/release-notes.htm

    Rafael
    [originally posted on jforum.net by Rafael Steil]
  • Migrated From Jforum.net
    Ranch Hand

    Joined: Apr 22, 2012
    Posts: 17424
    there are no .conf files in the 2.1 zip file.. ??
    [originally posted on jforum.net by Anonymous]
    Migrated From Jforum.net
    Ranch Hand

    Joined: Apr 22, 2012
    Posts: 17424
    .conf files? By default there is no .conf files. The only one is jforum-custom.conf, which is 1) dinamically created or 2) created by you

    Rafael
    [originally posted on jforum.net by Rafael Steil]
    Migrated From Jforum.net
    Ranch Hand

    Joined: Apr 22, 2012
    Posts: 17424
    getting this when clicking on 'categories" in admin:



    Expression repository.getCategory(category.id) is undefined on line 20, column 35 in default/admin/forum_list.htm. The problematic instruction: ---------- ==> assignment: forums=repository.getCategory(category.id).getForums() [on line 20, column 17 in default/admin/forum_list.htm] in include moduleAction [on line 1, column 1 in default/admin/empty.htm] ---------- Java backtrace for programmers: ---------- freemarker.core.InvalidReferenceException: Expression repository.getCategory(category.id) is undefined on line 20, column 35 in default/admin/forum_list.htm. at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124) at freemarker.core.TemplateObject.invalidTypeException(TemplateObject.java:134) at freemarker.core.Dot._getAsTemplateModel(Dot.java:78) at freemarker.core.Expression.getAsTemplateModel(Expression.java:89) at freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:86) at freemarker.core.Expression.getAsTemplateModel(Expression.java:89) at freemarker.core.Assignment.accept(Assignment.java:91) at freemarker.core.Environment.visit(Environment.java:171) at freemarker.core.MixedContent.accept(MixedContent.java:92) at freemarker.core.Environment.visit(Environment.java:171) at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:160) at freemarker.core.Environment.visit(Environment.java:284) at freemarker.core.IteratorBlock.accept(IteratorBlock.java:95) at freemarker.core.Environment.visit(Environment.java:171) at freemarker.core.MixedContent.accept(MixedContent.java:92) at freemarker.core.Environment.visit(Environment.java:171) at freemarker.core.Environment.include(Environment.java:1256) at freemarker.core.Include.accept(Include.java:156) at freemarker.core.Environment.visit(Environment.java:171) at freemarker.core.Environment.process(Environment.java:156) at freemarker.template.Template.process(Template.java:219) at net.jforum.JForum.service(JForum.java:314) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) 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:825) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:743) 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(Unknown Source)
    [originally posted on jforum.net by Anonymous]
    Migrated From Jforum.net
    Ranch Hand

    Joined: Apr 22, 2012
    Posts: 17424
    Did you re-saved all permissions? (groups / users )

    Rafael
    [originally posted on jforum.net by Rafael Steil]
    Migrated From Jforum.net
    Ranch Hand

    Joined: Apr 22, 2012
    Posts: 17424
    Rafael Steil wrote:Did you re-saved all permissions? (groups / users )

    Rafael


    sorry that's when i click "forums" in admin.

    in categories page, there's none. but when I click "insert new" in categories, I can see all the groups i had before.

    So I need to re-add my categories?
    [originally posted on jforum.net by Anonymous]
    Migrated From Jforum.net
    Ranch Hand

    Joined: Apr 22, 2012
    Posts: 17424
    Anonymous wrote:
    Rafael Steil wrote:Did you re-saved all permissions? (groups / users )

    Rafael


    sorry that's when i click "forums" in admin.

    in categories page, there's none. but when I click "insert new" in categories, I can see all the groups i had before.

    So I need to re-add my categories?


    should i name the categories exactly the same as before?
    [originally posted on jforum.net by Anonymous]
    Migrated From Jforum.net
    Ranch Hand

    Joined: Apr 22, 2012
    Posts: 17424
    Anonymous wrote:
    Rafael Steil wrote:Did you re-saved all permissions? (groups / users )

    Rafael


    sorry that's when i click "forums" in admin.

    in categories page, there's none. but when I click "insert new" in categories, I can see all the groups i had before.

    So I need to re-add my categories?


    HHmm.. the categories were supposed to be there. They aren't deleted. Try saving again the permissions for the groups you have

    Rafael
    [originally posted on jforum.net by Rafael Steil]
    Migrated From Jforum.net
    Ranch Hand

    Joined: Apr 22, 2012
    Posts: 17424
    Rafael Steil wrote:

    HHmm.. the categories were supposed to be there. They aren't deleted. Try saving again the permissions for the groups you have

    Rafael


    ahh, i think i got it, yea, i just had to go into each group and save it again.

    thank raf!
    [originally posted on jforum.net by Anonymous]
    Migrated From Jforum.net
    Ranch Hand

    Joined: Apr 22, 2012
    Posts: 17424
    question:

    where do they attachments get saved?

    is it into DB?
    [originally posted on jforum.net by Anonymous]
    Migrated From Jforum.net
    Ranch Hand

    Joined: Apr 22, 2012
    Posts: 17424
    Anonymous wrote:question:

    where do they attachments get saved?

    is it into DB?


    file system. Default directory is "upload". You can change it using the keys "attachments.upload.dir" and "attachments.store.dir" in the file SystemGlobals.properties.

    Rafael
    [originally posted on jforum.net by Rafael Steil]
    Migrated From Jforum.net
    Ranch Hand

    Joined: Apr 22, 2012
    Posts: 17424
    When I upgraded from 2.0.2 to 2.1 I could see list of topics in forum, but couldn't view posts within old topics. (Posts in new topics were visible).
    I could solve this problem executing such query

    (this fields were null for old topics and 0 for newly created)

    I use PostgreSQL.
    Did I miss something in upgrade procedure? Or it is just little mistake in upgrade script for PostgreSQL?

    Thanks alot. New version is wonderful.
    [originally posted on jforum.net by Anton]
    Migrated From Jforum.net
    Ranch Hand

    Joined: Apr 22, 2012
    Posts: 17424
    Well, I guess it's my fault. I didn't tested the migration scripts for postgresql in a "real" database. I'll add this query and update the package.

    Thanks.

    Rafael
    [originally posted on jforum.net by Rafael Steil]
    Migrated From Jforum.net
    Ranch Hand

    Joined: Apr 22, 2012
    Posts: 17424
    Aach. I got the upgraded forum up, but when I went to the groups, edited the permissions for the admin gorup and saved it, I get this:

    java.lang.reflect.InvocationTargetException
    <snip>
    Caused by: java.sql.SQLException: java.nio.BufferUnderflowException
    at com.mysql.jdbc.ServerPreparedStatement.<init>(ServerPreparedStatement.java:155)
    at com.mysql.jdbc.Connection.prepareStatement(Connection.java:1280)
    at com.mysql.jdbc.Connection.prepareStatement(Connection.java:1252)
    at com.mysql.jdbc.Connection.prepareStatement(Connection.java:1314)
    at net.jforum.drivers.generic.security.SecurityCommon.executeAddRole(SecurityCommon.java:89)
    at net.jforum.drivers.generic.security.GroupSecurityModel.addRole(GroupSecurityModel.java:99)
    at net.jforum.security.PermissionControl.addRole(PermissionControl.java:81)
    at net.jforum.view.admin.PermissionProcessHelper.processData(PermissionProcessHelper.java:146)
    at net.jforum.view.admin.GroupAction.permissionsSave(GroupAction.java:195)
    ... 36 more

    [originally posted on jforum.net by TheDruidXpawX]
    Migrated From Jforum.net
    Ranch Hand

    Joined: Apr 22, 2012
    Posts: 17424
    Which database, container, jdk and jdbc driver verions are you using?

    Rafael
    [originally posted on jforum.net by Rafael Steil]
    Migrated From Jforum.net
    Ranch Hand

    Joined: Apr 22, 2012
    Posts: 17424
    Maybe I should issustrate the steps I used to get it up.

    I extracted the new forum, edited the new properties files, changing the properties in the new files to match my old ones, following the instructions.

    Then I copied the contents of my old images directory over the current images directory.

    I added a line to the top of the script "use dcforum;" and then
    mysql -u root -p < mysql_2.0.2_to_2.1.sql

    then I changed the permissions on the directory to tomcat and fired it up
    [originally posted on jforum.net by TheDruidXpawX]
    Migrated From Jforum.net
    Ranch Hand

    Joined: Apr 22, 2012
    Posts: 17424
    Rafael Steil wrote:Which database, container, jdk and jdbc driver verions are you using?

    Rafael


    Database is mysql 4.1.9

    Contianer is jakarta-tomcat-5.0.27

    JDK is 1.5.0_01 x86_64

    jdbc driver is the one that's included in the jforum distro. Perhaps that's the issue. I'll try and upgrade that next
    [originally posted on jforum.net by TheDruidXpawX]
    Migrated From Jforum.net
    Ranch Hand

    Joined: Apr 22, 2012
    Posts: 17424
    TheDruidXpawX wrote:
    jdbc driver is the one that's included in the jforum distro. Perhaps that's the issue. I'll try and upgrade that next


    I updated the mysql driver to 3.1.7 instead of the 3.1.4-beta that's included in jforum and now I'm seeing:

    java.lang.reflect.InvocationTargetException
    <snip>
    Caused by: java.sql.SQLException: Illegal operation on empty result set.
    at com.mysql.jdbc.ResultSet.checkRowPos(ResultSet.java:4341)
    at com.mysql.jdbc.ResultSet.getInt(ResultSet.java:1208)
    at net.jforum.drivers.generic.security.SecurityCommon.executeAddRole(SecurityCommon.java:107)
    at net.jforum.drivers.generic.security.GroupSecurityModel.addRole(GroupSecurityModel.java:99)
    at net.jforum.security.PermissionControl.addRole(PermissionControl.java:81)
    at net.jforum.view.admin.PermissionProcessHelper.processData(PermissionProcessHelper.java:146)
    at net.jforum.view.admin.GroupAction.permissionsSave(GroupAction.java:195)
    [originally posted on jforum.net by TheDruidXpawX]
    Migrated From Jforum.net
    Ranch Hand

    Joined: Apr 22, 2012
    Posts: 17424
    Well, the connector/j shoulb be 3.1.4-beta. The newer versions will not work correctly. Also, I guess the BufferXXXException is because JDK 1.5. Can you try with 1.4, please? ( and connector/j 3.1.4-beta)

    Rafael
    [originally posted on jforum.net by Rafael Steil]
    Migrated From Jforum.net
    Ranch Hand

    Joined: Apr 22, 2012
    Posts: 17424
    Rafael Steil wrote:Well, the connector/j shoulb be 3.1.4-beta. The newer versions will not work correctly. Also, I guess the BufferXXXException is because JDK 1.5. Can you try with 1.4, please? ( and connector/j 3.1.4-beta)

    Rafael


    Got it. It's not JDK specific, but rather, my existing jforum-custom.conf (on my system previously called tomcat.conf) contained a database.connection.string which is different than the SystemGlobals.properties connection string. Once I updated the jforum-custom.conf's to be identical, the forums fired up no problem (with the 3.1.4-beta driver, and the 1.5.0_01 jdk).

    Thanks for your help Rafael!
    [originally posted on jforum.net by TheDruidXpawX]
    Migrated From Jforum.net
    Ranch Hand

    Joined: Apr 22, 2012
    Posts: 17424
    Here's another upgrade gotcha. You cant use your old templates/mail/activateAccount.txt file

    If you do the activate new acount email will blow out the sender like:
    Caused by: freemarker.core.InvalidReferenceException: Expression username is undefined on line 1, column 6 in mail/activateAccount.txt.
    at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124)

    at freemarker.core.Expression.getStringValue(Expression.java:118)
    at freemarker.core.Expression.getStringValue(Expression.java:93)
    at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
    at freemarker.core.Environment.visit(Environment.java:171)
    at freemarker.core.MixedContent.accept(MixedContent.java:92)
    at freemarker.core.Environment.visit(Environment.java:171)
    at freemarker.core.Environment.process(Environment.java:156)
    at freemarker.template.Template.process(Template.java:219)
    at net.jforum.util.mail.Spammer.prepareMessage(Spammer.java:161)

    Is there any way to recover these jobs so that the people who tried to create accounts in the last couple of days will work?

    Thanks!
    [originally posted on jforum.net by TheDruidXpawX]
    Migrated From Jforum.net
    Ranch Hand

    Joined: Apr 22, 2012
    Posts: 17424
    Nevermind. I just edited the users by hand and activated their accounts. Hopefully they'll just notice
    [originally posted on jforum.net by TheDruidXpawX]
    Migrated From Jforum.net
    Ranch Hand

    Joined: Apr 22, 2012
    Posts: 17424
    The old will not work because the username is set as ${username }, but in 2.1 it changed to ${user.username}.

    Rafael
    [originally posted on jforum.net by Rafael Steil]
    Migrated From Jforum.net
    Ranch Hand

    Joined: Apr 22, 2012
    Posts: 17424
    Maybe a stupid question,

    But I use the integrated hsqldb for JForum.
    The Forum is deployed on a windows machine.

    How do I import the upgrade sql script? How do I execute it on the db of the previous version?

    Thanks
    [originally posted on jforum.net by Anonymous]
    Migrated From Jforum.net
    Ranch Hand

    Joined: Apr 22, 2012
    Posts: 17424
    Hi,

    I wonder if there will be some sort of upgrading installer or script.
    Because I did the manual interventions, and ended up with nothing

    Everything was gone
    [originally posted on jforum.net by Anonymous]
    Migrated From Jforum.net
    Ranch Hand

    Joined: Apr 22, 2012
    Posts: 17424
    After you install, you should to go Admin Panel -> Groups -> Permissions and resave permissions for all groups.

    Rafael
    [originally posted on jforum.net by Rafael Steil]
    Migrated From Jforum.net
    Ranch Hand

    Joined: Apr 22, 2012
    Posts: 17424
    I'm still using 2.02 and I would like to go to the next version...
    I didn't find any patch for 2.04 -> 2.1

    What can I do because previous patch are not available on the site?
    [originally posted on jforum.net by Blackwings]
    Migrated From Jforum.net
    Ranch Hand

    Joined: Apr 22, 2012
    Posts: 17424
    Get version 2.1.3, run the migration scripts, and then migrate to 2.1.4

    Rafael
    [originally posted on jforum.net by Rafael Steil]
    Migrated From Jforum.net
    Ranch Hand

    Joined: Apr 22, 2012
    Posts: 17424
    Where is the version 2.1.3? I didn't find it on the download page (it's why I ask how to do from 2.02 ;))
    [originally posted on jforum.net by Blackwings]
    Migrated From Jforum.net
    Ranch Hand

    Joined: Apr 22, 2012
    Posts: 17424
    Ops :P

    http://sourceforge.net/project/showfiles.php?group_id=15940

    Rafael
    [originally posted on jforum.net by Rafael Steil]
    Migrated From Jforum.net
    Ranch Hand

    Joined: Apr 22, 2012
    Posts: 17424
    It won't work correctly. The existing sql server code was a partial contribution made by someone else. You can get it and try to finish, to fit into your needs.

    Rafael
    [originally posted on jforum.net by Rafael Steil]
    Migrated From Jforum.net
    Ranch Hand

    Joined: Apr 22, 2012
    Posts: 17424
    Does upgrade from 2.1 to 2.1.4 require database (sqlserver) data changes?
    [originally posted on jforum.net by Anonymous]
    Migrated From Jforum.net
    Ranch Hand

    Joined: Apr 22, 2012
    Posts: 17424
    No - sqlserver is not well supported in any version.

    Rafael
    [originally posted on jforum.net by Rafael Steil]
    Migrated From Jforum.net
    Ranch Hand

    Joined: Apr 22, 2012
    Posts: 17424
    Is it okay to use sqlserver as database or does code have fatal problems? Do you have plans for supporting sqlserver?
    [originally posted on jforum.net by Anonymous]
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Upgrading to version 2.1
     
    Similar Threads
    The chinese words could not display correctly.They looks more like ????.
    Where is the display of Time/date coming from?
    Shouldn't jforum-custom.conf override mysql.properties?
    MySQL error during config
    2.1.5 When ?