Announcement Announcement Module
Collapse
No announcement yet.
GlassFishWorkManagerTaskExecutor spring and glassfish v3 exception Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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, 01:33 AM.

    Comment


    • #3
      Spring 2.5.6. Where did you verify the glassfish api?

      Comment


      • #4
        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.

        Comment


        • #5
          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.

          Comment


          • #6
            No but the the default WorkManagerTaskExecutor does...

            Comment


            • #7
              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.

              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, 01:46 PM. Reason: clarification

              Comment


              • #8
                The api has changed in glassfish v3:

                https://glassfish-svn.dev.java.net/s...annotate=35635

                Comment

                Working...
                X