[Logo] JForum - Powering Communities
  [Search] 搜尋   [Recent Topics] 最新主題   [Hottest Topics] 熱門主題   [Top Downloads] 熱門下載   [Members] 會員列表   [Groups] 回首頁 
[Moderation Log] 管理日誌   [Register] 會員註冊 /  [Login] 登入 


JForum 2.5.0 released, download it from here.
Error installing JForum2 2.5.0  RSS feed
討論區首頁 » User Forum
發表人 內容
James Bucanek


註冊時間: 2018/9/17
文章: 8
離線
Greetings,

I've been running JForumj 2.1.8 for quite some time now without any difficulty. I'm in the process of revamping my websites and wanted to upgrade to 2.5.0 (mostly because of problems dealing with spammers).

My current forum runs in its own domain, but the new one I plan to run in a subdirectory of a secure (SSL) site. Here's what I've done so far:

  • Set the autoDeploy="true" of the top-level context of my Tomcat site

  • Created a subdirectory "forums"

  • Copied and unpacked the jforums-2.5.0.war file into the subdirectory (delete the .war file after unpacking)

  • Verified that all of the required subdirectories (upload, tmp, ...) are writable by the web server.

  • Verified that my Java is (relatively) up-to-date: Java(TM) SE Runtime Environment (build 1.8.0_144-b01)

  • Loaded the URL https:secure.test.com/forums/


  • But here's what I got:

    type Exception report
    
    message Unable to compile class for JSP:
    
    description The server encountered an internal error that prevented it from fulfilling this request.
    
    exception
    
    org.apache.jasper.JasperException: Unable to compile class for JSP: 
    
    An error occurred at line: 4 in the jsp file: /forums/index.jsp
    SystemGlobals cannot be resolved
    1: <%@page import="net.jforum.util.preferences.*" %>
    2: <%@page import="java.io.File" %>
    3: <%
    4: 	String cfg = SystemGlobals.getValue(ConfigKeys.INSTALLATION_CONFIG);
    5: 	String redirect = "forums/list.page";
    6: 	
    7: 	if (cfg == null || !(new File(cfg).exists()) || !SystemGlobals.getBoolValue(ConfigKeys.INSTALLED)) {	
    
    
    An error occurred at line: 4 in the jsp file: /forums/index.jsp
    ConfigKeys.INSTALLATION_CONFIG cannot be resolved to a type
    1: <%@page import="net.jforum.util.preferences.*" %>
    2: <%@page import="java.io.File" %>
    3: <%
    4: 	String cfg = SystemGlobals.getValue(ConfigKeys.INSTALLATION_CONFIG);
    5: 	String redirect = "forums/list.page";
    6: 	
    7: 	if (cfg == null || !(new File(cfg).exists()) || !SystemGlobals.getBoolValue(ConfigKeys.INSTALLED)) {	
    
    
    An error occurred at line: 7 in the jsp file: /forums/index.jsp
    SystemGlobals cannot be resolved
    4: 	String cfg = SystemGlobals.getValue(ConfigKeys.INSTALLATION_CONFIG);
    5: 	String redirect = "forums/list.page";
    6: 	
    7: 	if (cfg == null || !(new File(cfg).exists()) || !SystemGlobals.getBoolValue(ConfigKeys.INSTALLED)) {	
    8: 		redirect = "install.jsp";    
    9: 	}	
    10: 	response.setStatus(301);
    
    
    An error occurred at line: 7 in the jsp file: /forums/index.jsp
    ConfigKeys.INSTALLED cannot be resolved to a type
    4: 	String cfg = SystemGlobals.getValue(ConfigKeys.INSTALLATION_CONFIG);
    5: 	String redirect = "forums/list.page";
    6: 	
    7: 	if (cfg == null || !(new File(cfg).exists()) || !SystemGlobals.getBoolValue(ConfigKeys.INSTALLED)) {	
    8: 		redirect = "install.jsp";    
    9: 	}	
    10: 	response.setStatus(301);
    
    
    Stacktrace:
    	org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:103)
    	org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:366)
    	org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:468)
    	org.apache.jasper.compiler.Compiler.compile(Compiler.java:378)
    	org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
    	org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
    	org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646)
    	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
    	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
    


    So it looks like the JSP page doesn't understand the SystemGlobals class. Does this mean my web app wasn't deployed, or is this a Java/Tomcat/Apache problem? (I vaguely remember having problems with 2.1.8 finding classes ... and I can't remember what I did to fix it.)

    Any suggestions?
    udittmer


    註冊時間: 2013/2/21
    文章: 193
    That's odd. It sounds as if the jar file containing the actual forum classes is not present, or is damaged. Check that inside the WEB-INF/lib directory is a file called "jforum-2.5.jar", and that it is readable by executing "jar -tf jforum-2.5.jar" from the command line.

    Ping & Net - my free Android app for TCP/IP network diagnostics
    [WWW]
    James Bucanek


    註冊時間: 2018/9/17
    文章: 8
    離線
    udittmer wrote:Check that inside the WEB-INF/lib directory is a file called "jforum-2.5.jar", and that it is readable by executing "jar -tf jforum-2.5.jar" from the command line.

    There's a file named "jforum-2.5.0.jar" in the WEB-INF/lib directory, it's readable (by everyone), and the command
    jar -tf jforum-2.5.0.jar
    lists all of the classes, including net/jforum/util/preferences/SystemGlobals.class.

    It is possible I've messed up something in the Tomcat configuration that's preventing it from seeing these classes?
    udittmer


    註冊時間: 2013/2/21
    文章: 193
    I can't think of what that might be - any JSP page should be able to access all classes in WEB-INF/lib and WEB-INF/classes.

    When Tomcat starts up, are there any error messages in catalina.out or jforum.log?

    Ping & Net - my free Android app for TCP/IP network diagnostics
    [WWW]
    James Bucanek


    註冊時間: 2018/9/17
    文章: 8
    離線
    Thanks, the catalina.out file helped. I don't see any startup errors (still looking), but I did found this in the log just before this error:

    SEVERE: Servlet.service() for servlet [jsp_recall] in context with path [/] threw exception [Unable to compile class for JSP: 


    The servlet should be "jforums" and the context should be "/forums" not "/"; the JForums2 JSP page is loading in the context of my root servlet. So I do have a deployment problem. I'll follow that lead and see where it gets me.
    James Bucanek


    註冊時間: 2018/9/17
    文章: 8
    離線
    OK, I think I made some progress.

    I'm not sure why the app didn't auto-deploy, but I'm sure it's due to my crusty Tomcat installation, which I've been randomly hacking at for almost 10 years.

    Anyway, I set up a new virtual site in Apache and Tomcat (<Host name="jforum2.test.com" appBase="/Users/test/Sites/forum_sandbox") and deployed the web app as the root web app (<Context path="/" docBase="." ...)

    So now the index.jsp loads and asks for the JForum2 installation details. I filled out everything, but the Next Step button link fails with the error "Safari can't open the page 'install/install.page' because Safari can't find the server 'install'"

    I looked that the install.jsp page source, and the link is, indeed, "//install/install.page", which make me think that this expects to run in a subdirectory?

    Maybe the manual installation is the way to go?

    Update: I'll also note that to get JForum 2.1 to run in Apache I had to add a rewrite (RewriteRule ^/(.+\.page)$ ajp://localhost:8009/$1) so that *.page requests get shuttled directly to Tomcat. I'm wondering now if that could be a problem too.

    Update 2: I'm pretty sure the *.page requests are working. I tried loading <http://jforum2.test.com/install/install.page> and got a NullPointer error, probably because none of the parameters were included. I took a peek at templates/default/install.htm and it appears the culprit (and by "culprit" I mean it's not returning a usable value) is
    ${JForumContext.encodeURL("/install/install")}
    udittmer


    註冊時間: 2013/2/21
    文章: 193
    I'm not sure why Safari seems to mangle the URL.

    The full URL for the install page would be http://localhost:8009/install/install.page?module=install&action=welcome (as you can see in the install.jsp file).

    Ping & Net - my free Android app for TCP/IP network diagnostics
    [WWW]
    James Bucanek


    註冊時間: 2018/9/17
    文章: 8
    離線
    Sorry if I didn't explain the problem clearly.

    Safari isn't mangling the URL. The initial URL (http://jforum2.test.com/) loads index.jsp, which discovers it isn't installed and redirects to install.jsp, which redirects to http://jforum2.test.com/install/install.page?module=install&action=welcome.

    That works just fine. But the page generated by install.page has a link in the <form> tag—using ${JForumContext.encodeURL("/install/install")})—that results in an invalid URL:
    <form action="//install/install.page" name="install" method="post" onsubmit="return validateForm();">
        ...
    


    Also note there are other invalid URLs in the page, most notably the CSS reference, undoubtedly generated the same way:
    <link rel="stylesheet" href="//templates/default/styles/style.css" type="text/css" />

    So once I fill in all of the install parameters and click "Next Step" it goes nowhere. I seems like JForum can't figure out where it's running (URL-wise).
    udittmer


    註冊時間: 2013/2/21
    文章: 193
    My guess is that it has something to do with the virtual Tomcat host. I just tried to install JForum as the ROOT web app (no virtual host), and I got correct URLs like "/install/install.page" rather than "//install/install.page" - which is indeed a different URL.

    Ping & Net - my free Android app for TCP/IP network diagnostics
    [WWW]
    James Bucanek


    註冊時間: 2018/9/17
    文章: 8
    離線
    I've finally back to working on this again.

    I seemed to have gotten things working. It appears that the fundamental problem is this installation of Tomcat runs behind an Apache web server. The *.jsp pages get redirected to Tomcat, but the static resources are served by Apache. (This was set up nigh on 15 years ago when, rightly or wrongly, there was performance considerations with having Tomcat serve all of the content.)

    The next thing I tried was short-circuiting Apache and redirecting all requests to Tomcat. I did this with a RewriteRule:

    	RewriteEngine On
    	RewriteRule ^/(.*)$ ajp://localhost:8009/$1 [P]
    


    That definitely helped. The initial installation page loaded correctly (including all relative links, CSS, and images). The first "Continue" button took me to the installation confirmation page, where everything looked correct.

    Then it died again. When I clicked the "Install" button, I just got an "/error.html not found" error. Thinking about that later, I suspect that's an Apache configuration error. Nonetheless, something was still going wrong.

    So I bypassed Apache and tried again. I enabled Tomcat's port 8080 service and ran the install at http://jforum2.test.com:8080/ and everything worked! The install pages loaded, ran, the database got created, and the forum pages appeared. Even better, I went back to the Apache site at http://jforum2.test.com/ and that seemed to be working too.

    So now I have a working JForum2 installation, I need to work on two more things:

  • Start working on getting the user sign-in to use my customer database

  • Wipe this installation and try migrating my existing JForum (2.1.6) to JForum2


  • So how do I zap the installation I have now and start over? Can I simply drop the database and create an empty one?

    Or can I do both at the same time by dropping the newly created database, copying the old database into the new one, and then running the various upgrade scripts?

    udittmer


    註冊時間: 2013/2/21
    文章: 193
    "copying the old database into the new one" could be tricky due to foreign key constraints and such. There are no scripts to facilitate this, so you'd be on your own.

    Upgrading the old DB sounds easier, although slightly laborious. You'd successively apply the DB upgrade scripts from https://sourceforge.net/p/jforum2/code/HEAD/tree/trunk/upgrade/ starting with 2.1.7 all the way to 2.5.0.

    Ping & Net - my free Android app for TCP/IP network diagnostics
    [WWW]
    James Bucanek


    註冊時間: 2018/9/17
    文章: 8
    離線
    It turned out that migrating my database wasn't a big deal.

    I'm no DB expert, so it's fortunate that my MySQL GUI client has a "Duplicate Database" command, which worked perfectly. I then applied all of the upgrade script from 2.2 through 2.5, which was astonishingly simple.

    Finally, I copied the contents of the ./images/avatars and ./uploads from the old site to the new one and voila!

    There's still some settings that didn't get moved over, but I'm confident that when the time comes to go live I won't have any problems getting 10 years of content migrated.
    udittmer


    註冊時間: 2013/2/21
    文章: 193
    Don't forget the WEB-INF/config/jforum-custom.conf file - it has a lot of important settings.

    Ping & Net - my free Android app for TCP/IP network diagnostics
    [WWW]
     
    討論區首頁 » User Forum
    前往:   
    行動版
    Powered by JForum 2.5.0 © 2018 JForum Team • Maintained by Andowson Chang and Ulf Dittmer