• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Categories set returned null

 
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have this problem:


2006-08-11 12:07:49,879 INFO [STDOUT] 12:07:49,879 WARN [ForumRepository ] Categories set returned null from the cache. Trying to reload
2006-08-11 12:07:49,879 INFO [STDOUT] 12:07:49,879 WARN [ForumRepository] Categories set returned null from the cache. Trying to reload
2006-08-11 12:07:49,894 INFO [STDOUT] 12:07:49,894 ERROR [ExceptionWriter ] java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)



How can I fix this problem?
[originally posted on jforum.net by norba]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which JForum version?

Rafael
[originally posted on jforum.net by Rafael Steil]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am seeing this error with JForum version 2.1.6 using Postgres.
[originally posted on jforum.net by laz]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I migrated to 2.1.7 beta and had a similar problem with the most users ever being cached. I made a quick code change to eliminate the NullPointerException and it seems to work well now.
[originally posted on jforum.net by laz]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Would you post the quick changes?
[originally posted on jforum.net by brunogm]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
These patches are for the lasted development beta as of today:

--- jforum-2007-02-05/src/net/jforum/repository/ForumRepository.java
+++ jforum-patched/src/net/jforum/repository/ForumRepository.java
@@ -606,10 +606,14 @@
{
cache.remove(FQN_MODERATORS);
}
-
- public static User lastRegisteredUser()
- {
- return (User)cache.get(FQN, LAST_USER);
+
+ public static User lastRegisteredUser() throws Exception
+ {
+ User user = (User)cache.get(FQN, LAST_USER);
+ if (user == null) {
+ user = DataAccessDriver.getInstance().newUserDAO().getLastUserInfo();
+ }
+ return user;
}

public static void setLastRegisteredUser(User user)
@@ -678,7 +682,13 @@
*/
public static MostUsersEverOnline getMostUsersEverOnline()
{
- return (MostUsersEverOnline)cache.get(FQN, MOST_USERS_ONLINE);
+ MostUsersEverOnline mostUsersEverOnline = (MostUsersEverOnline)cache.get(FQN, MOST_USERS_ONLINE);
+ if (mostUsersEverOnline == null) {
+ mostUsersEverOnline = new MostUsersEverOnline();
+ mostUsersEverOnline.setTotal(0);
+ mostUsersEverOnline.setTimeInMillis(0);
+ }
+ return mostUsersEverOnline;
}

/**

--- jforum-2007-02-05/src/net/jforum/repository/SmiliesRepository.java
+++ jforum-patched/src/net/jforum/repository/SmiliesRepository.java
@@ -86,6 +86,10 @@
public static List getSmilies()
{
List list = (List)cache.get(FQN, ENTRIES);
+ if (list == null) {
+ loadSmilies();
+ list = (List)cache.get(FQN, ENTRIES);
+ }
if (!contexted) {
String forumLink = SystemGlobals.getValue(ConfigKeys.FORUM_LINK);


[originally posted on jforum.net by laz]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is another one I just found:

--- jforum-2007-02-05/src/net/jforum/repository/RankingRepository.java
+++ jforum-patched/src/net/jforum/repository/RankingRepository.java
@@ -97,7 +97,10 @@
Ranking lastRank = new Ranking();

List entries = (List)cache.get(FQN, ENTRIES);
-
+ if (entries == null) {
+ loadRanks();
+ entries = (List)cache.get(FQN, ENTRIES);
+ }
for (Iterator iter = entries.iterator(); iter.hasNext(); ) {
Ranking r = (Ranking)iter.next();



[originally posted on jforum.net by laz]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmm, this sound similar to the issues I found when jForum's cache engine was re-initialized by the Install servlet being initialized after the jForum servlet.

You might want to try this:

http://www.coderanch.com/t/576919

before modifying the code.

[originally posted on jforum.net by monroe]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks very much for leading me to your other post. I guess I didn't search hard enough. I'll give your suggestion a try and hopefully the NullPointerExceptions will be a thing of the past.
[originally posted on jforum.net by laz]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!