Results 1 to 8 of 8

Thread: GlassFishWorkManagerTaskExecutor spring and glassfish v3 exception

  1. #1
    Join Date
    Jun 2007
    Posts
    26

    Default GlassFishWorkManagerTaskExecutor spring and glassfish v3 exception

    This previously worked in glassfish v2.1:

    Code:
    <bean id="threadPool" class="org.springframework.jca.work.glassfish.GlassFishWorkManagerTaskExecutor">
    	<property name="threadPoolName" value="mediaSourceTasks" />
    </bean>
    However in glassfish v3 I get this exception

    Code:
    Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.jca.work.glassfish.GlassFishWorkManagerTaskExecutor]: Constructor threw exception; nested exception is java.lang.IllegalStateException: Could not initialize GlassFishWorkManagerTaskExecutor because GlassFish API is not available: java.lang.NoSuchMethodException: com.sun.enterprise.connectors.work.WorkManagerFactory.getWorkManager(java.lang.String)
    	at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:115)
    	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:61)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:877)
    	... 77 more
    Caused by: java.lang.IllegalStateException: Could not initialize GlassFishWorkManagerTaskExecutor because GlassFish API is not available: java.lang.NoSuchMethodException: com.sun.enterprise.connectors.work.WorkManagerFactory.getWorkManager(java.lang.String)
    	at org.springframework.jca.work.glassfish.GlassFishWorkManagerTaskExecutor.<init>(GlassFishWorkManagerTaskExecutor.java:52)
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    	at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    	at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:100)
    	... 79 more

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,629

    Default

    Which version of Spring are you using?

    Checking the API of GlassFish V3 this class isn't present anymore, so there must be another way of obtaining the workmanager. If I'm not mistaken you can use the normal WorkManagerTaskExecutor and supply the JNDI name of the WorkManager so it can be obtained from JNDI.
    Last edited by Marten Deinum; Feb 25th, 2010 at 01:33 AM.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3
    Join Date
    Jun 2007
    Posts
    26

    Default

    Spring 2.5.6. Where did you verify the glassfish api?

  4. #4
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,629

    Default

    a bit of googling led me to the api of glassfish and this isn't present in V3 it is in V2. You could also check the jars and search for that file.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  5. #5
    Join Date
    Jun 2007
    Posts
    26

    Default

    The problem is that this call is missing now in the runtime jar:

    WorkManagerFactory.getWorkManager(java.lang.String )

    So perhaps they want a proper jndi lookup. The create-thread-pool command doesn't allow me to specify a jndi name for lookup.

  6. #6
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,629

    Default

    No but the the default WorkManagerTaskExecutor does...
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  7. #7
    Join Date
    Jun 2007
    Posts
    26

    Default

    The javadocs point to using the glassfish version. I'm not sure how I would get this one to be managed.

    On JBoss and GlassFish, a similar facility is available through the JCA WorkManager. See the JBossWorkManagerTaskExecutor GlassFishWorkManagerTaskExecutor classes which are the direct equivalent of this CommonJ adapter class.

    Quote Originally Posted by Marten Deinum View Post
    No but the the default WorkManagerTaskExecutor does...

    EDIT: removed incorrect text about work-manager.jar. It now appears that work-management.jar no longer has a getWorkManager(String), there is now a getWorkManagerProxy(string, string):

    javap -classpath glassfish/modules/work-management.jar com/sun/enterprise/connectors/work/WorkManagerFactory | grep getWorkManager
    public javax.resource.spi.work.WorkManager getWorkManagerProxy(java.lang.String, java.lang.String) throws com.sun.appserv.connectors.internal.api.ConnectorR untimeException;
    bash-3.2#
    Last edited by drfence; Feb 25th, 2010 at 01:46 PM. Reason: clarification

  8. #8
    Join Date
    Jun 2007
    Posts
    26

Posting Permissions

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