Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Accessing the DAO layer without http requests

 
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have written scriplet to get the recent topics in JForum to show on the index page. I added the method getForumForApps(t.getForumId()) and I was successful in getting the recent topics, however there are some problems with the database connection. the index page works only after accessing some link of JForum, also after some time the database connection is lost I suppose. What will be the correct way to do what I am trying.



[originally posted on jforum.net by judekm]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First, I'm assuming that this code is running in the same web app as jForum and not a different one..

If so, the problem with the initial call to a Jforum page may be because the CacheEngine and database engine are initialized in the JForum Servlet init method. This servlet processes all *.page requests.

If I remember correctly, the J2EE Specs are kind of vague on when application engines are required to call the init method. There is a load-on-startup web.xml parameter but this may not be honored or the container may be letting requests come through before everything is initialized. Or worse, not calling the init method until the first call to the jForum servlet is made.

The DB problem (and maybe the init problem) may be due to the fact that the JForum servlet service method does a check to see if the DB is initialized and re-initializes it if it isn't. I'm not sure, but I guess that code is being called every time to fix similar problems.
[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
Thank You for the response.
If so how can I initialize the cache engine and database engine from the scriplet.
[originally posted on jforum.net by judekm]
 
Grow your own food... or this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic