6 Replies Latest reply on Dec 4, 2006 9:42 AM by jahlborn

    external configuration for service beans

    jahlborn

      hi,
      i love the service bean extension added by jboss. i seem to have one problem with it though: i can't figure out how to configure the beans in any sort of external file. i need to create multiple deployments where some of the bean properties are configured differently. for a true mbean service (in jboss), you can set properties when you configure the service in the service.xml file. for a true stateless session bean, you can configure env entries in a partial deployment descriptor. however, the session ejb is a cross between both of these, but does not seem to support either external configuration mechanism. anybody know of a way to do this?
      thanks,
      -james

        • 1. Re: external configuration for service beans
          alrubinger

          You can place a jboss.xml into the META-INF of the JAR in which you're deploying your beans:

          <?xml version="1.0"?>
          <jboss xmlns="http://java.sun.com/xml/ns/javaee"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://www.jboss.org/j2ee/schema
           http://www.jboss.org/j2ee/schema/jboss_5_0.xsd"
           version="5.0">
           <enterprise-beans>
           <service>
           <ejb-name>ServiceMBeanName</ejb-name>
           </service>
           </enterprise-beans>
          </jboss>
          


          ...check the XSD for the full properties it supports. :)

          S,
          ALR

          • 2. Re: external configuration for service beans
            jahlborn

            yes, i am aware of this configuration option. besides the fact that it doesn't seem to support "partial specification" the way a deployment descriptor does, it doesn't seem to support env-entry elements like a stateless session bean. it does have some resource-ref stuff, but i couldn't figure out if that would actually be useful.

            • 3. Re: external configuration for service beans
              jahlborn

              just to clarify on the "partial specification thing". the config that you wrote is not valid (in 4.0.4), although you may not have intended it to be. the parser seems to require all of the management, remote, etc. elements when specifying the service bean, even if all of these are already specified using annotations on the implementation.

              • 4. Re: external configuration for service beans
                alrubinger

                You're right; hadn't intended for this to be a full listing.

                However, I haven't found the "partial' configurations to be a problem, though you might have to update to EJB3 RC9. You can either patch 4.0.4-GA or upgrade to 4.0.5...I'm successfully using partial descriptors with no more than "ejb-name" and "depends" elements defined.

                I am, however, annotating the bean itself w/ @Service and @LocalBinding. It's the @Depends only that I've moved into XML configs.

                Lemme know if an upgrade helps out. If not I can send you code samples to help you figure out why this isn't working.

                S,
                ALR

                • 5. Re: external configuration for service beans
                  jahlborn

                  i'm now running 4.0.5, and i was still required to use the ejb-name, management, ejb-class, and remote elements, even though the bean is fully annotated. however, that doesn't really help, as there is nothing really of use in that descriptor for the service bean anyway (unless i'm missing something). there are no env entries, and there are no properties settings. i'm still trying to figure out if i can make use of the resource-ref and resource-env-ref elements, but they seem convoluted at best.

                  • 6. Re: external configuration for service beans
                    jahlborn

                    At this point, I pretty convinced this is not currently possible, so I've filed a feature request:

                    http://jira.jboss.com/jira/browse/EJBTHREE-801