Results 1 to 2 of 2

Thread: Bizzare ClassLoader issue in Java WebStart?

  1. #1

    Default Bizzare ClassLoader issue in Java WebStart?

    Hello - I've been trying to advocate the use of Spring in our project. Another developer has written the following class to adapt us to the Spring world:

    public class MatrixValueSupplierProvider
    {
    private static final String REFERENCE_FACTORY = "com/allustra/application/common/refFactory.xml";
    private static final String MATRX_VALUE_SUPPLIER_FACTORY = "matrixValueSupplierBeans";

    private static BeanFactoryReference ms_factoryReference;


    static
    {
    ms_factoryReference = SingletonBeanFactoryLocator.getInstance(REFERENCE_ FACTORY).useBeanFactory(MATRX_VALUE_SUPPLIER_FACTO RY);
    }

    private MatrixValueSupplierProvider()
    {
    }

    public static final MatrixValueSupplier getInstance(String id)
    {
    MatrixValueSupplier result = (MatrixValueSupplier)ms_factoryReference.getFactor y().getBean(id);

    return result;
    }
    }

    Which references refFactory.xml:

    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

    <beans>
    <bean id="matrixValueSupplierBeans" lazy-init="true" class="org.springframework.context.support.ClassPa thXmlApplicationContext">
    <constructor-arg>
    <value>classpath*:com/allustra/business/matrix/common/valuesupplier/MatrixValueSupplierBeans.xml</value>
    </constructor-arg>
    </bean>
    </beans>

    The motivation here is that MatrixValueSupplierBeans.xml appears a few times in the classpath as it is defined in multiple locations in the classpath and then combined by Spring at runtime.

    Now this all works fine and realiably when running from a client invoked using the java command line.

    However, when we use Java WebStart, every once in a while we get the following error:

    2005-07-28 14:09:41.359|Error |CCOMM.90 |STDERR: Caused by: org.springframework.beans.FatalBeanException: Unable to find resource for specified definition. Group resource name [classpath*:com/allustra/application/common/refFactory.xml], factory key [matrixValueSupplierBeans]
    2005-07-28 14:09:41.359|Error |CCOMM.90 |STDERR: at org.springframework.beans.factory.access.Singleton BeanFactoryLocator.createDefinition(SingletonBeanF actoryLocator.java:477)
    2005-07-28 14:09:41.359|Error |CCOMM.90 |STDERR: at org.springframework.beans.factory.access.Singleton BeanFactoryLocator.useBeanFactory(SingletonBeanFac toryLocator.java:372)
    2005-07-28 14:09:41.359|Error |CCOMM.90 |STDERR: at com.allustra.business.matrix.common.valuesupplier. MatrixValueSupplierProvider.<clinit>(MatrixValueSu pplierProvider.java:22)
    2005-07-28 14:09:41.359|Error |CCOMM.90 |STDERR: ... 45 more
    2005-07-28 14:09:47.468|Error |CCOMM.90 |STDERR: java.lang.NoClassDefFoundError
    2005-07-28 14:09:47.468|Error |CCOMM.90 |STDERR: at com.allustra.business.matrix.common.MatrixKeyAdapt erPE.getValueSupplier(MatrixKeyAdapterPE.java:117)

    Where MatrixKeyAdapterPE.getValueSupplier() line 117 is the line which calls MatrixValueSupplierProvider.getInstance().

    This has got me stumped. I've had problems with Java WebStart before, where the classloader it uses can load all the jars it needs and then fails with NoClassDefFoundError before. Usually addressed by setting the context classloader of the current thread to be the same as the classloader for the current class, but looking at the Spring code - it already does something like this.

    Any ideas?

  2. #2
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    Definitelly the problem lies in Java WebStart - I guess you can turn some logging on or do some profilling to see what happens. I had a LOT of problems with JBoss classloader when we were deploying more then one instance of an application on a server and the CL had huge concurrency problems. I had to restart the server serveral times until the application was deployed without any CCE.
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

Similar Threads

  1. Replies: 6
    Last Post: Jan 11th, 2008, 07:36 AM
  2. Replies: 5
    Last Post: Aug 11th, 2005, 02:38 AM
  3. ClassLoader issue ! - Need Help
    By pkkishore in forum Container
    Replies: 11
    Last Post: Jun 3rd, 2005, 05:57 AM
  4. Replies: 1
    Last Post: Mar 8th, 2005, 10:10 AM
  5. Replies: 1
    Last Post: Oct 1st, 2004, 10:04 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •