You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Luis Colorado <Lu...@fmssolutions.com> on 2007/01/05 20:36:39 UTC

Probably a caching problem, but, why is ojb ignoring my jcd?

Hello, everybody!

I have been searching for help for this one, but looks like nobody has had this problem before... is it only me?

I am using Tomcat 5.5, and I have two web-apps using OJB (I'm using Jetspeed-1) to host two portals. The problem started when I placed the ojb-1.0.1.jar on shared/lib. Both web-apps use similar, but separate databases (essential1 and essential2), but my second web-app is totally ignoring the java-connection-descriptor file, so it keeps using essential1 instead of essential2. Apparently the jcd for essential1 got cached, and further requests to generate more PB's reuse the cached instance of essential1, instead of creating a new instance for the other web-app essential2. Both web-apps have a similar jcd, like the following:

   <jdbc-connection-descriptor 
   	  jcd-alias="essential"
   	  default-connection="false"
   	  platform="MySQL"
   	  jdbc-level="2.0" 
   	  driver="org.gjt.mm.mysql.Driver" 
   	  protocol="jdbc" 
   	  subprotocol="mysql" 
   	  dbalias="//localhost/essential2?zeroDateTimeBehavior=convertToNull" 
	  username="xxxxx" 
   	  password="xxxxx"
   	>
   	   	<connection-pool
            maxActive="21"
            validationQuery="" />
        
        <sequence-manager className="org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl">
            <attribute attribute-name="grabSize" attribute-value="20"/>
            <attribute attribute-name="autoNaming" attribute-value="true"/>
            <attribute attribute-name="globalSequenceId" attribute-value="false"/>
            <attribute attribute-name="globalSequenceStart" attribute-value="10000"/>
        </sequence-manager>
   </jdbc-connection-descriptor>

I know that the easy answer is just to put a copy of ojb-1.0.1.jar on each web-app lib directory, but it just doesn't sound right. Besides the waste of space, if sounds like Tomcat (or Jetspeed) is caching the PB object, so the second application is using the same PB object of the first app, and that seems to be just wrong.

This is obviously a caching problem, but, whose to blame? Tomcat? Jetspeed? OJB? What configuration/properties file should change to fix this problem?

Thank you so much for your help!

Luis