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 I can't make it work ! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » JForum
Bookmark "I can Watch "I can New topic
Author

I can't make it work !

Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Hello
I can't make JForum work. Maybe due to the fact I'm a newbie or I'm using Tomcat 5 ?
Here's the error trace appearing when I type http://localhost:8080/jForum/forums/list.page


It may help you to know I also have this strange message in the tomcat stdout log :

Could someone help me please ?
[originally posted on jforum.net by Anonymous]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
I've seen this error too, don't know what's the problem.

As for servlet-api.jar, you can remove it.
[originally posted on jforum.net by Daniil]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
I saw this error when using cyrillic chars as username. Is that your sittuation? And which jforum version are you using?

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

Joined: Apr 22, 2012
Posts: 17424
hello guys,

Thanks a lot for your great job and your answers, but none resolved my problem
Daniil, I removed servlet-api.jar and that solved the message in tomcat log, but still have the same error message when trying to use jForum.
Rafael, I'm not using cyrillic chars in username or password, and Running :
JForum RC3-1
windows XP pro
MySQL 4.0.18
Tomcat 5.0.19
java SDK 1.5 (could it be the problem ?)

Please help me ! JForum is exactly what I need fo my upcoming site !!!
[originally posted on jforum.net by Anonymous]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Well,

the servlet-api.jar warning you can just ignore, is doesn't make a difference.

To workaround the problem, you can't do that: open the file "templates/default/forum.base.htm", and go to the line 56. There you will find the "isAdmin()" call, that is like



you can then just remove this piece of code for now. I'm not sure if it is fixed in the CVS version ( I guess it is ), so am going to take another look.

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

Joined: Apr 22, 2012
Posts: 17424
Rafael Steil wrote:I'm not sure if it is fixed in the CVS version ( I guess it is ), so am going to take another look.

Rafael, what did you change so you think this bug might be gone?
[originally posted on jforum.net by Daniil]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
ok, I removed the infamous line from forum_base.htm.
This time it still doesn't work, but the error message changed, and it's shorter :


But if I display the source code from my browser, I can see at the bottom of the page :

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

Joined: Apr 22, 2012
Posts: 17424
hmm... I have seen this error once, but was a long time ago.

How did it happened? I mean, what steps did you do until this error came up? have you registered an user? which username?
Try recreating the database struct ( eg, running the script again ).

Do you have JDK < 1.5? if you do, could you please try jforum with it? ( but must be 1.4.x ).

I'll try to take a look tonight.

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

Joined: Apr 22, 2012
Posts: 17424
BTW, I'm running Tomcat on 1.5 too.
[originally posted on jforum.net by Daniil]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
I extracted the zip file in a directory named jForum under Tomcat/webapps/
then I modified the connection string in WEB-INF\config\database.properties :

"admin" is a user I created by cloning the "root" user in MySQL.

Then I start Tomcat, jForum appears in the applications list, in the Tomcat manager. Everytime I type http://localhost:8080/jForum in my browser, I'm redirected to http://localhost:8080/jForum/forums/list.page, and have the same error message.
Here is what I'm seeing (and all links are broken) :

Thank you very much for your help

Hugo

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

Joined: Apr 22, 2012
Posts: 17424
Oooooooops !!!
I didn't run mysql_data_dump.sql ops:
I'm so sorry I made you both waste your time....
Thanks a lot for your support, and excuse me for my so silly thread !

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

Joined: Apr 22, 2012
Posts: 17424
Anonymous wrote:Here is what I'm seeing (and all links are broken) :


Hugo, did you modified the "forumLink" property to something like



? ( note the trailing slash ).

If you are getting broken links or images, is because the value this property contains. Sometimes, like when you dont' have a contex ( eg, the forum is the default context ) you don't need the trailing slash, so it is just a matter of testing.

I'll check the code for the another exception asap.

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

Joined: Apr 22, 2012
Posts: 17424
Anonymous wrote:Oooooooops !!!
I didn't run mysql_data_dump.sql ops:
I'm so sorry I made you both waste your time....
Thanks a lot for your support, and excuse me for my so silly thread !

Hugo



aahhhh ..

Some day this site will have a decent documentation

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

Joined: Apr 22, 2012
Posts: 17424
I'm running into the exact same problem but:

1. Upgrading from RC2
2. Ran db_rc3_update.sql
3. Start Tomcat 4
4. got isAdmin() problem
5. proceed to remove the line in template as instructed
6. got invocation exception

now, if i dump the existing db and start over again with mysql_db_struct.sql and mysql_data_dump.sql, that issue goes away.

you may wanna look into db_rc3_update.sql



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

Joined: Apr 22, 2012
Posts: 17424
Hi,

When I came upon JForum, I got very excited. I need precsisely what JForum offers for the jCVS user and developer forums at jcvs.org. For the moment I am using jGossip, but I find it is seriously lacking in features.

However, I am now unable to properly deploy JForum, and I am concerned about its design.

The first problem I ran into was the "http://localhost:18080/" bug. The fact that there is a configuration for the prefix to the forum's URL's suggests to me that the author does not know how to properly code for struts or for webapps in general. The base of a URL should never be "configured". Is there some technical reason for this? I have never seen it before.

Ok. So I configured the URL forumLink, and that got me past the broken links.

However, now I am simply not able to get the logo or icons to appear. It appears that all of the "IMG" urls are open, for example "template/detault/images/logo.gif". This causes the browser to construct the URL of the image from the server's "http://host/" base, NOT from the webapp's base URL of "http://host/jforum/". Thus, none of the images are displayed. I believe those links should start with "./", to get the proper context.

Moving the template folder to the root level of the server is not an option. Those images must be located under the webapp, or I cannot use JForum as it is currently coded. Why are these links not coded properly to exist under the webapp's base url?

Is there any chance that I can easily fix this bug with the images?

Is there any chance that the code will be updated to properly use webapp URLs and eliminate the forumLink config and properly place the templates under the webapp base?

Thank you.
Tim.

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

Joined: Apr 22, 2012
Posts: 17424
Hi,

Ok. Maybe I am confused. It appeared earlier in the post that you said "not" to have the trailling slash on the forumLink property. Yet, that is what my problem was. When I put the trailling slash on the path, all the icons work.

However, I still belive that this design is broken.

What happens when I need to place your webapp "behind" Apache? I will define some "proxy" settings in Apache to "pass" URLs that look like "http://host.domain/forum" to the URL "http://localhost:8080/forum".

Now I have two ways of access to JForum. The first uses an external URL sceme, say "https://outside.domain.com/", while the second uses an internal addressing scheme, say "http://inside.domain.com/". Both of these map to the localhost, but security and firewall treatments are different.

Given this setup, how should I configure forumLink?

You see? It should not exist! All paths should be relative to the webapp context, which may vary by access.

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

Joined: Apr 22, 2012
Posts: 17424
Just registered and wanted to be sure I was notified of any replies to this post... I posted the two anonymous posts above.
[originally posted on jforum.net by time]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Why don't you just use mod_jk to redirect the servlet calls to Tomcat? This way, you could run Apache on port 80, and have Tomcat running on localhost, port 8080, as usual. jforum.net works this way.

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

Joined: Apr 22, 2012
Posts: 17424
Rafael Steil wrote:Why don't you just use mod_jk to redirect the servlet calls to Tomcat? This way, you could run Apache on port 80, and have Tomcat running on localhost, port 8080, as usual. jforum.net works this way.

Rafael


Rafael,

Thank you for the response. This is precisely what I do. However, I have two "views" of the URL space. One is internal, and points to the standard Apache address: "http://host/forum/...". The other is external, and points to the HTTPS Apache address: "https://host/forum".

How do you suggest I resolve the two seperate addresses into the single forum?

I just do not understand why the forumLink exists. Is it required by FreeMarker?

I am not saying that I am any smarter about this issue than the next developer. I believe there continues to be strong debates of "absolute" versus "relative" URLs. But my experience has always been that "relative" URLs solve many problems that absolute URLs create.

I will admit that your design at least works with most configurations, and I admit that our setup is unusual. I had a real problem with TrackPlus, which used <html:base> on every page, which caused all of my URLs to turn into the "http://localhost:8080/" address from the "http://host/" that was being proxied by Apache. Ultimately, they removed all <html:base> tags and this solved the issue. So I am grateful that you appear capable of accomodating jcvs.org.

I am about to update the code I use to "import" the jCVS mailing list into JForum. Do you have code to do this already? If not, do you want me to contribute my code? It is very nice to be able to move old mailing list arcvhives into JForum forums.

tim.

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

Joined: Apr 22, 2012
Posts: 17424
hhmm.. hhmmm..

JForum uses <base href="xxxx"/> because the "friendly url" feature. I mean, because, say



is virtual, the urls and images path will not work correcly, because the browser will try to find the files in a directory relative to "user", and "user" is not even a directory in the filesystem.

I'm not sure, but I guess that putting the paths in the form



will cause problems too, depending the configuration the context has.

I could not think now in any "portable" and functional piece of code that will work for sure.. I'd to make some tests, if nobody becomes with a solution.

For the momment, I could just suggest a little hack to the code. Basically, you put in the config file 2 forumLinks, one for each host. Then, in the front controller ( JForum.java ), you check the HTTP_REFERER ( or just the url, probably ), and, based upon the start string, you choose forumLink1 or forumLink2.. Something like that..

On your suggestion to migrate the mailing list to forum, every kind of solution is welcome . Will be a pleasure to have your contribution.

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

Joined: Apr 22, 2012
Posts: 17424
Tim, please create a file named "test.jsp" with the following content:



Run this under jforum and see the result. Please try with both internal and external URLs. If this work, then I guess we can drop off "forumLink" and make jforum "discover" the right path.

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

Joined: Apr 22, 2012
Posts: 17424
I am sorry, but that will simply not work. Just to demonstrate, here is what I get when I hit "http://www.jcvs.org/jcvsforum/jftest.jsp":



As you can see, not only do you get the wrong answer for the host, but the port is set improperly. Why? Because this is pointing (via ProxyPass in Apache config) to a local tomcat server running on port 8080.

The bottom line is this: all URLs must be relative to the context, and no URLs can be "absolute" (containing http://server:port/context").

Otherwise, you end up with spaghetti for URL construction.

I now see that you use the <base> tag in your templates. This is also a problem. the only reason that it works is because you set the base to "forumLink". However, as I have indicated in previous posts, this only works for the most simple setups.

I still contend that <base> is evil, and all URLs must be relative to the context or the current page. Otherwise, you are stuck. To this date, TrackPlus cannot display attachments to issues behind a ProxyPass, and it is quite embarassing that it does not work. Fortunately, so far, I have not found anything that does not work in JForum, except for the case I explained earlier.

What is the best thing to do?

I guess I would just try to slowly rework all URLs to be relative, and at the same time eliminate <base> elements. You may decide that this is not worth the effort, or that you have much higher priorities, and I would not disagree with you.

Again, thanks for the discussion. I would really like to see the JForum get much better. It is already great!

tim.

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

Joined: Apr 22, 2012
Posts: 17424
I call "frienly urls" this:



where the regular way from most webapps way is something like



The first one is much simple to read and to remember.

I'll try to handle this situation. Please keep an eye in JForum

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

Joined: Apr 22, 2012
Posts: 17424
:roll: ...

....


.... hhhmmm....

... well ....

If there is any way to keep using the "virtual" urls and do not use <base>, please tell me. Any suggestion is welcome.

In the beginning, I intended to make Friendly URL an optional, enabled by default, feature. The fact is that I "forgot" to make jforum handle any kind of url.
One possible solution is to write the code to use - or not - Friendly URLs, but this would require some work, and I don't think I can make it for the next relase, RC4, which will be released in the next few days. But we could go working in the CVS version.

I don't have access to any proxied server, so I can't make any real tests. There exists any kind of "emulator", or even there is a way I could run a proxy server on my local machine, to be possible to have an environment like yours?

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

Joined: Apr 22, 2012
Posts: 17424
I am not quite sure what you mean by "friendly" urls, and I am still not clear on how the MVC works in JForum, since it is not normal struts. It also appears that you do not normalize the URLs either, so I suspect that JForum will only work with cookies enabled.

What I see most webapps do is normalize all "actions" to the top level, no path to the action. So, JForum's "/user/edit/id.page", would instead be something more like "/UserEdit.do?id=id". These URLs are then always output using the <html:link> tag, which performs any necessary session URL re-writing. This is what allows these webapps to operate without cookies.

Also, the URL is always rooted at the webapp context. Therefore, when I use <html:link action="/Action.do">, the URL is always constructed relative to my current webapp context, so you do not need to know anything about the host, or port, or context, because that is all handled for you.

At this point, redoing all of your URL scheme and rewrite all of the pages, I think it might be too much to do. No matter what release. Plus, it invalidates all links in all existing forums, which may be too much to ask.

Honestly, having seen the MVC model you are using, and the templates, and the work involved in reworking it, I would probably just leave it alone for now and re-evaluate it again later. I think there are more pressing things to apply your precious time to. As it stands, I think the design right now will accomodate more than 90% of all possible installations.
[originally posted on jforum.net by time]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
I registered this as bug:

http://www.jforum.net/jira/browse/JF-27

Rafael


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

Joined: Apr 22, 2012
Posts: 17424
Ok. I used the exact same URL format for jCVS, for more technical reasons. URL's constructed by "path info" are better handled by proxies and cachers than are the "query string" paths (the ones with ?). As you say, they are easier to remember.

However, they do have their limitations as well, and to this day I am divided on the two approaches.

Regardless of your URL format, I believe it is still possible to contruct your pages such that you do not need to specify "absolute" paths (those beginning with "http://host:port/context/". And I believe that you can ultimately do it without changing the URLs, which I think is critical.

I will try to post more info on this topic when I get a chance.
[originally posted on jforum.net by time]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
time wrote:
The bottom line is this: all URLs must be relative to the context, and no URLs can be "absolute" (containing http://server:port/context").


you mean, something like



and



is that? If 'yes', this "solution" will still require to the path from Apache to be named 'myContext", no?...

Anyway, I have no background on handling this kind of situation, so please be free to give ideas, as you have been doing so far

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

Joined: Apr 22, 2012
Posts: 17424
No, unfortunately, context is not implied in "/path" absolute path names, as I am sure you are aware.

Thus, you are left with putting the context into your paths, as in "/context/path", or using all "relative" names as in "./path" and "../path".

Using "/context/path" is not as bad as it sounds. It does require that you provide the context to your pages, but you just put it into your model, which is no more than you are already doing. With this scheme, you handle the case I mentioned (internal and external accesses), since the URL protocol, host, and port are all implied by the current page and handled properly by the client browser.

Using "../path" is also not too bad, but it requires that each page set its "level" (as in ".." or "../.." or "../../..") and that all links prefix this level. Pretty much the same as above, but it puts the variable into the page, as opposed to the action (View as opposed to Model).

The fact is that you should probably be using tags to produce all links. In struts I use <html:link>, which does a lot of things for me, including allowing me to define "action aliases". Then I just say <html:link action="alias"> and whatever link I have defined for the alias it output for me with all the necessary munging for session url re-writing, etc.

Whatever you decide to do, I think that getting rid of the "http://host:port/" from all URLs is the most important thing.

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

Joined: Apr 22, 2012
Posts: 17424
That precvious "anonymous" post was from me. ops:

If you decide to go with the "/context/path" option, you can make a simple call to the servlet API to ask what your context name is. Then you can provide this property in your model data, and prefix all of your links with that property. So, you do not need to know what the context name is.

Better still, if you used a tag, the tag could prefix the context for you and the pages (View) would never even know what was happening.
[originally posted on jforum.net by time]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Ok, so the /context thing will work.

But how about the topic's link in the email messages sent to users to tell them that the topic got a reply? I mean, how should we decide which url to use, considering that you have 2+ domains whose point to a single tomcat context?

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

Joined: Apr 22, 2012
Posts: 17424
This is, I am afraid, an intractable problem. Therefore, in the case of generating email, you should default to computing the "absolute" URL (http://host:port/) from the methods provided to you by the API. However, this default should be overidable by a setting, since many sites will need the override.
[originally posted on jforum.net by Anonymous]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: I can't make it work !