dev@glassfish.java.net

[gf-dev] Re: EJB pool

From: Janario Oliveira <janarioliver_at_gmail.com>
Date: Wed, 1 Apr 2015 14:07:00 -0300

Just to see if ejb-ref would do any difference I've tried adding ejb-local-ref
in my web.xml. I've tried with FQN and SimpleName but both follow with the
same result
<ejb-local-ref>
     <ejb-ref-name>AsyncService</ejb-ref-name>
</ejb-local-ref>

But It doesn't work and throws an exception:
[2015-04-01T12:32:08.350-0300] [glassfish 4.1] [SEVERE] [NCLS-CORE-00026]
[javax.enterprise.system.core] [tid: _ThreadID=46
_ThreadName=admin-listener(1)] [timeMillis: 1427902328350] [levelValue:
1000] [[
  Exception during lifecycle processing
java.lang.IllegalArgumentException: Cannot resolve reference [Local ejb-ref
name=AsyncService,Local 3.x interface
=null,ejb-link=null,lookup=,mappedName=,jndi-name=,refType=Session] because
it does not declare a remote interface or remote home interface of target
bean


On Tue, Feb 10, 2015 at 9:45 AM, Ceyhun Erturk <erturk.ceyhun_at_yandex.com>
wrote:

> If any configuration information for an enterprise bean is not specified
> in the glassfish-ejb-jar.xml file, it defaults to a corresponding setting
> in the EJB container if an equivalency exists.
> Try on web.xml to add ejb-ref AsyncService element and deploy.
>
> 09.02.2015, 19:33, "Janario Oliveira" <janarioliver_at_gmail.com>:
> > Hi guys,
> >
> > I am trying to configure an ejb bean pool. But it is not working.
> >
> > I have one stateless (AsyncService) and I have added
> glassfish-ejb-jar.xml in WEB-INF
> >
> > glassfish-ejb-jar.xml:
> > <sun-ejb-jar>
> > <enterprise-beans>
> > <ejb>
> > <ejb-name>AsyncService</ejb-name>
> > <bean-pool>
> > <steady-pool-size>2</steady-pool-size>
> > <resize-quantity>1</resize-quantity>
> > <max-pool-size>5</max-pool-size>
> >
> <pool-idle-timeout-in-seconds>300</pool-idle-timeout-in-seconds>
> > </bean-pool>
> > </ejb>
> > </enterprise-beans>
> > </sun-ejb-jar>
> >
> > It should limit AsyncService in maximum 5 instances. I've added a
> PostConstruct method to log creations.
> >
> > AsyncService:
> > @Stateless
> > public class AsyncService {
> > @PostConstruct
> > private void init() { System.out.println("Contruct AsyncService"); }
> > @Asynchronous
> > public Future<LocalDateTime> asyncTest() {...}
> > }
> >
> > Calling the asyncTest in a loop of 15 times it creates more the maximum
> configured.
> >
> > Is there another way to configure that or are my configurations wrong?
>