[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Curious Problem, Any Suggestions



Hi All,

	I wrote some code to use the ozone database for testing, and potentially
long term use. When I ran the code I got an interesting error:
"java.lang.RuntimeException: Object is not (yet) associated to a database
container"

	Needless to say, I was a bit puzzled.... Although I probably would have
wasted less time if I had paid attention the to the error the first time. I
ended up getting the same error regardless of which database class I used:
LocalDatabase or RemoteDatabase.

	I think I know what the problem is, but how do I fix it.

	Let me give everyone a little background so we'll all be on the same page.
I have developed four interfaces and the respective classes:

	Interface			Implementation class
	-------------------	---------------------
	SnmpConfigData		SnmpConfigDataImpl
	IPSpecificSnmpData	IPSpecificSnmpDataImpl
	IPRangeSnmpData		IPRangeSnmpDataImpl
	SnmpConfDB			SnmpConfDBImpl

The IP* interfaces and classes inheriet from SnmpConfigData &
SnmpConfigDataImpl respectively. The trick I'm trying to accomplish is that
the SnmpConfDBImpl is an object class that hold a single SnmpConfigData
reference, and a two vectors, one each that contains a list of
IPRangeSnmpData and IPSpecificSnmpData. The SnmpConfDB interface defines
methods for looking up SnmpConfigData based on specific IP addresses.

	To this end, when the SnmpConfDBImpl is being created with the constructor
in the server it attempts to create the SnmpConfigData object from within
the server (using this.database().createObject(...)). However, when the
SnmpConfDBImpl constructor executes it causes the above runtime exception.
The apparent solution would be to create the single SnmpConfigData first and
pass that into the constructor. What I would like to know is if it is only
possible to create database object from within a database object before it's
finished being constructed, or is that just a limitation of ozone?

	If this has been addressed in the list before I appoligize, just trying to
get up to speed.

	Thanks

	Weave
	mailto:weave@opennms.org