Re: [ openjms-Bugs-949270 ] JmsServer(config) throws NPE
J Aaron Farr <[email protected]> Sat, 08 May 2004 19:25:32 -0400
| Newsgroups | gmane.comp.java.openjms.devel |
|---|---|
| Message-ID | <[email protected]> |
SourceForge.net wrote:
> Bugs item #949270, was opened at 2004-05-07 01:24
> Message generated for change (Comment added) made by tanderson
>
>>Comment By: Tim Anderson (tanderson)
>
> Date: 2004-05-07 17:32
>
> Message:
> Logged In: YES
> user_id=557161
>
> The patch file only contains a patch for
> ConfigurationManager, which I don't quite agree with - the
> Configuration instance should be completely populated
> before being passed to the JmsServer constructor.
> I've applied a change to JmsServer to correct the NPE, on the
> openjms_0_7_6_maint branch.
Sorry about the patch being messed up. Not sure what happened.
I was trying to make sure that if you started with the same
configuration file that you would get the same results regardless of
which constructor you choose. This is only the case if you change the
ConfigurationManager since the ConfigurationLoader adds certain
defaults. Otherwise, embedded uses of JmsServer which unmarshal the XML
configuration file themselves will have to add those defaults on their own.
Example 1:
public static final void main(String args[]){
try{
FileReader reader = new FileReader(args[0]);
Unmarshaller stream = new Unmarshaller(Configuration.class);
AttributeExpander handler = new AttributeExpander(reader);
Configuration config = (Configuration) stream.unmarshal(handler);
JmsServer server = new JmsServer(config);
server.init();
}
catch (Exception ex) {
ex.printStackTrace();
}
while(true){
try {
Thread.sleep(100);
}
catch (InterruptedException ex1) {
ex1.printStackTrace();
System.exit(1);
}
}
}
Example 2:
public static final void main(String args[]){
try{
JmsServer server = new JmsServer(args[0]);
server.init();
}
catch (Exception ex) {
ex.printStackTrace();
}
while(true){
try {
Thread.sleep(100);
}
catch (InterruptedException ex1) {
ex1.printStackTrace();
System.exit(1);
}
}
}
If you give the same default openjms.xml file (ie- the one included with
the default install) to either of these programs you will get different
results unless ConfigurationManager is patched. In fact, the first one
will throw errors. I was trying to resolve that inconsistency.
--
jaaron <http://jadetower.org>
-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to deliver
higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3