You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by Ron Gavlin <rg...@yahoo.com> on 2006/08/31 16:08:04 UTC

Help...NPE at o.a.t.sdo.impl.ClassImpl.getProperty(ClassImpl.java:192) w/multiple threads

Hi,
 
I receive the following NPE when using Tuscany SDO in a multi-threaded environment. Here is the stack trace:
 
java.lang.NullPointerException
at org.apache.tuscany.sdo.impl.ClassImpl.getProperty(ClassImpl.java:192)
at org.apache.tuscany.sdo.util.DataObjectUtil.getProperty(DataObjectUtil.java:2342)
at org.apache.tuscany.sdo.util.DataObjectUtil.getProperty(DataObjectUtil.java:1284)
at org.apache.tuscany.sdo.util.DataObjectUtil$Accessor.setFeatureName(DataObjectUtil.java:2032)
at org.apache.tuscany.sdo.util.DataObjectUtil$Accessor.process(DataObjectUtil.java:2139)
at org.apache.tuscany.sdo.util.DataObjectUtil$Accessor.init(DataObjectUtil.java:1918)
at org.apache.tuscany.sdo.util.DataObjectUtil$Accessor.create(DataObjectUtil.java:1838)
at org.apache.tuscany.sdo.util.DataObjectUtil.get(DataObjectUtil.java:739)
at org.apache.tuscany.sdo.util.DataObjectUtil.get(DataObjectUtil.java:213)
...
 
I suspect the NPE is due to synchronization problems with the ClassImpl.propertyNameToPropertyMap. This problem occurs during load testing of our application. Thanks in advance for your assistance. This is a show-stopper for us.
 
- Ron

---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org


Re: Help...NPE at o.a.t.sdo.impl.ClassImpl.getProperty(ClassImpl.java:192) w/multiple threads

Posted by Ron Gavlin <rg...@yahoo.com>.
Hi Frank, 
 
I applied your patch and it had no affect. 
 
However, I did discover some interesting info during troubleshooting. The machine we are using to load test is a Wintel dual-core PC running WinXP. This machine gets the NPE with or without your patch. 
 
Just for kicks, I tried running the test on a single-processor Wintel PC running Win2K. This machine DOES NOT get the NPE with or without your patch. 
 
We are using Sun JDK 1.4.2_11 in both environments. Any suggestions where to go from here? 
 
- Ron 

----- Original Message ----
From: Ron Gavlin <rg...@yahoo.com>
To: tuscany-user@ws.apache.org
Sent: Thursday, August 31, 2006 10:56:28 AM
Subject: Re: Help...NPE at o.a.t.sdo.impl.ClassImpl.getProperty(ClassImpl.java:192) w/multiple threads


Frank,

I'll try your suggestion and get back to you. FYI, I opened JIRA TUSCANY-682 to track the problem. Thanks for the quick reply.

- Ron

----- Original Message ----
From: Frank Budinsky <fr...@ca.ibm.com>
To: tuscany-user@ws.apache.org
Sent: Thursday, August 31, 2006 10:47:14 AM
Subject: Re: Help...NPE at o.a.t.sdo.impl.ClassImpl.getProperty(ClassImpl.java:192) w/multiple threads


Hi Ron,

Multiple threads eh .... The only way I can see this happing is when 
propertyNameToProperyMap is set back to null in getProperty(String). Could 
you try changing a couple of ClassImpl methods to the following and see if 
it fixes the problem?

  private void initAliasNames(boolean force) {
    if (propertyNameToPropertyMap == null || force)
    {
      Map result = new HashMap();
      for (Iterator i = getProperties().iterator(); i.hasNext(); )
      {
        Property property = (Property)i.next();
        result.put(property.getName(), property);

        List aliasNames = property.getAliasNames();
        for (int count = aliasNames.size(); count > 0; )
        {
          result.put(aliasNames.get(--count), property);
        }
      }
      propertyNameToPropertyMap = result;
    }
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated NOT
   */
  public Property getProperty(String propertyName)
  {
    initAliasNames(false);
    Property property = 
(Property)propertyNameToPropertyMap.get(propertyName);
    if (property == null && !isOpen()) {
      //propertyNameToPropertyMap = null;
      initAliasNames(true);
      property = (Property)propertyNameToPropertyMap.get(propertyName);
    }
    return property;
  }

Thanks,
Frank.

Ron Gavlin <rg...@yahoo.com> wrote on 08/31/2006 10:08:04 AM:

> Hi,
> 
> I receive the following NPE when using Tuscany SDO in a multi-
> threaded environment. Here is the stack trace:
> 
> java.lang.NullPointerException
> at org.apache.tuscany.sdo.impl.ClassImpl.getProperty(ClassImpl.java:192)
> at org.apache.tuscany.sdo.util.DataObjectUtil.
> getProperty(DataObjectUtil.java:2342)
> at org.apache.tuscany.sdo.util.DataObjectUtil.
> getProperty(DataObjectUtil.java:1284)
> at org.apache.tuscany.sdo.util.DataObjectUtil$Accessor.
> setFeatureName(DataObjectUtil.java:2032)
> at org.apache.tuscany.sdo.util.DataObjectUtil$Accessor.
> process(DataObjectUtil.java:2139)
> at org.apache.tuscany.sdo.util.DataObjectUtil$Accessor.
> init(DataObjectUtil.java:1918)
> at org.apache.tuscany.sdo.util.DataObjectUtil$Accessor.
> create(DataObjectUtil.java:1838)
> at 
org.apache.tuscany.sdo.util.DataObjectUtil.get(DataObjectUtil.java:739)
> at 
org.apache.tuscany.sdo.util.DataObjectUtil.get(DataObjectUtil.java:213)
> ...
> 
> I suspect the NPE is due to synchronization problems with the 
> ClassImpl.propertyNameToPropertyMap. This problem occurs during load
> testing of our application. Thanks in advance for your assistance. 
> This is a show-stopper for us.
> 
> - Ron
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-user-help@ws.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org


Re: Help...NPE at o.a.t.sdo.impl.ClassImpl.getProperty(ClassImpl.java:192) w/multiple threads

Posted by Ron Gavlin <rg...@yahoo.com>.
Frank,
 
I'll try your suggestion and get back to you. FYI, I opened JIRA TUSCANY-682 to track the problem. Thanks for the quick reply.
 
- Ron

----- Original Message ----
From: Frank Budinsky <fr...@ca.ibm.com>
To: tuscany-user@ws.apache.org
Sent: Thursday, August 31, 2006 10:47:14 AM
Subject: Re: Help...NPE at o.a.t.sdo.impl.ClassImpl.getProperty(ClassImpl.java:192) w/multiple threads


Hi Ron,

Multiple threads eh .... The only way I can see this happing is when 
propertyNameToProperyMap is set back to null in getProperty(String). Could 
you try changing a couple of ClassImpl methods to the following and see if 
it fixes the problem?

  private void initAliasNames(boolean force) {
    if (propertyNameToPropertyMap == null || force)
    {
      Map result = new HashMap();
      for (Iterator i = getProperties().iterator(); i.hasNext(); )
      {
        Property property = (Property)i.next();
        result.put(property.getName(), property);

        List aliasNames = property.getAliasNames();
        for (int count = aliasNames.size(); count > 0; )
        {
          result.put(aliasNames.get(--count), property);
        }
      }
      propertyNameToPropertyMap = result;
    }
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated NOT
   */
  public Property getProperty(String propertyName)
  {
    initAliasNames(false);
    Property property = 
(Property)propertyNameToPropertyMap.get(propertyName);
    if (property == null && !isOpen()) {
      //propertyNameToPropertyMap = null;
      initAliasNames(true);
      property = (Property)propertyNameToPropertyMap.get(propertyName);
    }
    return property;
  }

Thanks,
Frank.

Ron Gavlin <rg...@yahoo.com> wrote on 08/31/2006 10:08:04 AM:

> Hi,
> 
> I receive the following NPE when using Tuscany SDO in a multi-
> threaded environment. Here is the stack trace:
> 
> java.lang.NullPointerException
> at org.apache.tuscany.sdo.impl.ClassImpl.getProperty(ClassImpl.java:192)
> at org.apache.tuscany.sdo.util.DataObjectUtil.
> getProperty(DataObjectUtil.java:2342)
> at org.apache.tuscany.sdo.util.DataObjectUtil.
> getProperty(DataObjectUtil.java:1284)
> at org.apache.tuscany.sdo.util.DataObjectUtil$Accessor.
> setFeatureName(DataObjectUtil.java:2032)
> at org.apache.tuscany.sdo.util.DataObjectUtil$Accessor.
> process(DataObjectUtil.java:2139)
> at org.apache.tuscany.sdo.util.DataObjectUtil$Accessor.
> init(DataObjectUtil.java:1918)
> at org.apache.tuscany.sdo.util.DataObjectUtil$Accessor.
> create(DataObjectUtil.java:1838)
> at 
org.apache.tuscany.sdo.util.DataObjectUtil.get(DataObjectUtil.java:739)
> at 
org.apache.tuscany.sdo.util.DataObjectUtil.get(DataObjectUtil.java:213)
> ...
> 
> I suspect the NPE is due to synchronization problems with the 
> ClassImpl.propertyNameToPropertyMap. This problem occurs during load
> testing of our application. Thanks in advance for your assistance. 
> This is a show-stopper for us.
> 
> - Ron
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-user-help@ws.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org


Re: Help...NPE at o.a.t.sdo.impl.ClassImpl.getProperty(ClassImpl.java:192) w/multiple threads

Posted by Frank Budinsky <fr...@ca.ibm.com>.
Hi Ron,

Multiple threads eh .... The only way I can see this happing is when 
propertyNameToProperyMap is set back to null in getProperty(String). Could 
you try changing a couple of ClassImpl methods to the following and see if 
it fixes the problem?

  private void initAliasNames(boolean force) {
    if (propertyNameToPropertyMap == null || force)
    {
      Map result = new HashMap();
      for (Iterator i = getProperties().iterator(); i.hasNext(); )
      {
        Property property = (Property)i.next();
        result.put(property.getName(), property);

        List aliasNames = property.getAliasNames();
        for (int count = aliasNames.size(); count > 0; )
        {
          result.put(aliasNames.get(--count), property);
        }
      }
      propertyNameToPropertyMap = result;
    }
  }
 
  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated NOT
   */
  public Property getProperty(String propertyName)
  {
    initAliasNames(false);
    Property property = 
(Property)propertyNameToPropertyMap.get(propertyName);
    if (property == null && !isOpen()) {
      //propertyNameToPropertyMap = null;
      initAliasNames(true);
      property = (Property)propertyNameToPropertyMap.get(propertyName);
    }
    return property;
  }

Thanks,
Frank.

Ron Gavlin <rg...@yahoo.com> wrote on 08/31/2006 10:08:04 AM:

> Hi,
> 
> I receive the following NPE when using Tuscany SDO in a multi-
> threaded environment. Here is the stack trace:
> 
> java.lang.NullPointerException
> at org.apache.tuscany.sdo.impl.ClassImpl.getProperty(ClassImpl.java:192)
> at org.apache.tuscany.sdo.util.DataObjectUtil.
> getProperty(DataObjectUtil.java:2342)
> at org.apache.tuscany.sdo.util.DataObjectUtil.
> getProperty(DataObjectUtil.java:1284)
> at org.apache.tuscany.sdo.util.DataObjectUtil$Accessor.
> setFeatureName(DataObjectUtil.java:2032)
> at org.apache.tuscany.sdo.util.DataObjectUtil$Accessor.
> process(DataObjectUtil.java:2139)
> at org.apache.tuscany.sdo.util.DataObjectUtil$Accessor.
> init(DataObjectUtil.java:1918)
> at org.apache.tuscany.sdo.util.DataObjectUtil$Accessor.
> create(DataObjectUtil.java:1838)
> at 
org.apache.tuscany.sdo.util.DataObjectUtil.get(DataObjectUtil.java:739)
> at 
org.apache.tuscany.sdo.util.DataObjectUtil.get(DataObjectUtil.java:213)
> ...
> 
> I suspect the NPE is due to synchronization problems with the 
> ClassImpl.propertyNameToPropertyMap. This problem occurs during load
> testing of our application. Thanks in advance for your assistance. 
> This is a show-stopper for us.
> 
> - Ron
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-user-help@ws.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org