You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by acooper <AC...@Kronos.com> on 2007/06/11 20:54:53 UTC

ActiveMQ on JBoss -> null system property??

We're trying to use ActiveMQ (4.2-SNAPSHOT 06/07/07) on JBoss 4.0.4 and are
running into an interesting problem - somehow ActiveMQ is managing to set a
null system property. Null system properties are disallowed in Java. The
property in question is org.apache.activemq.kaha.Store and is set in the
following code snippet in org/apache/activemq/kaha/impl/KahaStore.java:

static synchronized private Set<String> getVmLockSet(){
        if(lockSet==null){
            Properties properties=System.getProperties();
            synchronized(properties){
                lockSet=(Set<String>)
properties.get("org.apache.activemq.kaha.impl.KahaStore");
                if(lockSet==null){
                    lockSet=new HashSet<String>();
                }
                properties.put(PROPERTY_PREFIX,lockSet);
            }
        }
        return lockSet;
    }

On the face of it, I can't see anything wrong with this, except that when we
start ActiveMQ it winds up putting a null into system properties. Now, we've
got another application that reads system properties and *assumes* that they
can't be null and blows up because of this. 

Has anyone else seen this null property or have any idea why this is
occurring?

-- 
View this message in context: http://www.nabble.com/ActiveMQ-on-JBoss--%3E-null-system-property---tf3903273s2354.html#a11066328
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: ActiveMQ on JBoss -> null system property??

Posted by acooper <AC...@Kronos.com>.
Ok, so I answered the question: the code is incorrect - it is trying to store
a non-String value in a Properties object - check java.util.Properties and
you will find that you (a) should not use Properties.put() and (b) you
should not store a non-String object in Properties. Then look at
Properties.getProperty() and you'll see the following:

	Object oval = super.get(key);
	String sval = (oval instanceof String) ? (String)oval : null;
	return ((sval == null) && (defaults != null)) ? defaults.getProperty(key) :
sval;

So, this looks like a bug in ActiveMQ ...



acooper wrote:
> 
> We're trying to use ActiveMQ (4.2-SNAPSHOT 06/07/07) on JBoss 4.0.4 and
> are running into an interesting problem - somehow ActiveMQ is managing to
> set a null system property. Null system properties are disallowed in Java.
> The property in question is org.apache.activemq.kaha.Store and is set in
> the following code snippet in
> org/apache/activemq/kaha/impl/KahaStore.java:
> 
> static synchronized private Set<String> getVmLockSet(){
>         if(lockSet==null){
>             Properties properties=System.getProperties();
>             synchronized(properties){
>                 lockSet=(Set<String>)
> properties.get("org.apache.activemq.kaha.impl.KahaStore");
>                 if(lockSet==null){
>                     lockSet=new HashSet<String>();
>                 }
>                 properties.put(PROPERTY_PREFIX,lockSet);
>             }
>         }
>         return lockSet;
>     }
> 
> On the face of it, I can't see anything wrong with this, except that when
> we start ActiveMQ it winds up putting a null into system properties. Now,
> we've got another application that reads system properties and *assumes*
> that they can't be null and blows up because of this. 
> 
> Has anyone else seen this null property or have any idea why this is
> occurring?
> 
> 

-- 
View this message in context: http://www.nabble.com/ActiveMQ-on-JBoss--%3E-null-system-property---tf3903273s2354.html#a11066543
Sent from the ActiveMQ - User mailing list archive at Nabble.com.