users@glassfish.java.net

Re: No RESPONSE in 10 days???

From: Daniel Cavalcanti <dhcavalcanti_at_gmail.com>
Date: Thu, 11 Sep 2008 19:51:04 -0400

Thanks Alex.

I knew the IMQ command. However, I have Glassfish JMS service set as LOCAL.
So I needed to set the JMS service to pass these arguments to the IMQ
broker. I received another response that shows how to do that from
Glassfish's CLI. Here it is for your reference:

asadmin set
cluster-config.jms-service.start-args="-Dimq.autocreate.queue=false
-Dimq.autocreate.topic=false"


On Thu, Sep 11, 2008 at 11:08 AM, Alex Sherwin
<alex.sherwin_at_acadiasoft.com>wrote:

> I don't know about your second question, but to disable auto-creation of
> your topics and queues you must use the IMQ CLI located at
> ~/glassfish-install-dir/imq/bin/imqcmd
>
>
>
> If you're not familiar with this tool, you can run it with no args and it
> will print usage. You have to supply it with information that will identify
> which IMQ instance to query/update etc, with the –b flag (i.e. –b
> localhost:6076).
>
>
>
> An example command of what you want to do is the following (default
> user/pass for imq is admin/admin if you haven't changed it. This is
> separate from the domain user/pass. Also note that port is not the admin
> port, or http port, it is the IMQ broker port for your domain(s)):
>
>
>
> imqcmd update bkr -b HOST:PORT -u USER -o imq.autocreate.queue=false
>
> imqcmd update bkr -b HOST:PORT -u USER -o imq.autocreate.topic=false
>
>
>
>
>
> Alex Sherwin
>
> alex.sherwin_at_acadiasoft.com
>
>
>
> *From:* Daniel Cavalcanti [mailto:dhcavalcanti_at_gmail.com]
> *Sent:* Thursday, September 11, 2008 10:42 AM
> *To:* users_at_glassfish.dev.java.net
> *Subject:* No RESPONSE in 10 days???
>
>
>
> Hi,
>
> I posted a couple of questions more than 10 days ago and I am still waiting
> for a response.
> I used to post questions in this mailing list before and would get answers
> within a day.
> I'd be nice to get a response for this question...
>
> Here are the original messages:
>
>
> Hi...
>
>
> I want to disable the JMS queue/topic auto creation in the broker.
>
> I know I can accomplish this by setting the following in the
>
> Configuration -> {cluster}-config -> Java Message Service -> Start
>
> Arguments field: -Dimq.autocreate.queue=false -Dimq.autocreate.topic=false
>
>
> But I want to be able to do this in a different way: CLI and AMX/JMX.
>
> What is the equivalent command for CLI. How about the MBean?
>
>
> AND
>
> Hi...
>
>
> I have something very strange happening.
>
> In an enterprise application that contains an ejb module and a war
>
> module (JSF), a managed bean calls a business method from the ejb
>
> module. However, the returned object is always null.
>
>
>
> When I put some printout statements inside the managed bean method and
>
> the session bean business method, I get that in the session bean, the
>
> object being returned is not null. But the object assigned in the
>
> managed bean is null.
>
>
> This seems like a bug, or am I doing something wrong?
>
>
> Here are the classes...
>
>
> Session Bean (with its local interface):
>
>
> @Local
>
> public interface AdvertisingLocal {
>
>
> public byte[] getAdvertising();
>
>
> }
>
>
>
> @Stateless
>
> public class AdvertisingBean
>
> implements AdvertisingLocal {
>
>
> private static final long HOUR = 3600000L;
>
>
> private static Object lock = new Object();
>
>
>
> @Resource
>
> private TimerService timerService;
>
>
> @Resource(name="timer-interval")
>
> private int interval;
>
>
> private Timer timer;
>
>
> @EJB
>
> private AdsFacadeLocal adsFacade;
>
>
>
> private Iterator<Ads> iterator;
>
>
> public AdvertisingBean() {
>
> }
>
>
> @PostConstruct
>
> private void construct() {
>
>
> int count = 0;
>
> List<Ads> results = adsFacade.findAll();
>
> for (Ads ad : results)
>
> count += ad.getTokens();
>
>
> List<Ads> rotation = new ArrayList<Ads>(count);
>
> for (Ads ad : results)
>
> for (int i = 0 ; i < ad.getTokens() ; i++)
>
> rotation.add(ad);
>
>
> synchronized (lock) {
>
> iterator = rotation.iterator();
>
> }
>
>
> }
>
>
> @PreDestroy
>
> private void destroy() {
>
> if (timer != null)
>
> timer.cancel();
>
> }
>
>
> @Timeout
>
> private void timeout(Timer timer) {
>
> construct();
>
> }
>
>
> @AroundInvoke
>
> private void createTimer(InvocationContext context) {
>
>
>
> try {
>
> if (timer == null) {
>
>
> // set expire for the next hour turn
>
> Calendar calendar = Calendar.getInstance();
>
> calendar.setTimeInMillis(System.currentTimeMillis() +
>
> HOUR);
>
> calendar.set(Calendar.MINUTE, 0);
>
> calendar.set(Calendar.SECOND, 0);
>
>
> timer = timerService.createTimer(calendar.getTime(),
>
> interval, null);
>
>
> }
>
> } catch (Exception ex) {
>
> ex.printStackTrace();
>
> } finally {
>
> try {
>
> context.proceed();
>
> } catch (Exception ex) {
>
> ex.printStackTrace();
>
> }
>
> }
>
> }
>
>
> public byte[] getAdvertising() {
>
>
> synchronized (lock) {
>
>
> if (!iterator.hasNext())
>
> construct();
>
>
> byte[] buffer = iterator.hasNext()
>
> ? iterator.next().getContent()
>
> : "Advertising...".getBytes();
>
>
> System.out.println("buffer: " + buffer);
>
>
> return buffer;
>
>
> }
>
>
> }
>
>
> }
>
>
> Here the "buffer" printout is NOT null.
>
>
>
> Managed Bean:
>
>
> public class AdvertisingBean {
>
>
> @EJB
>
> private AdvertisingLocal advertisingService;
>
>
>
> public AdvertisingBean() {
>
> }
>
>
> public String getContent() {
>
> System.out.println("service: " + advertisingService);
>
> System.out.println("content: " +
>
> advertisingService.getAdvertising());
>
> return String.valueOf(advertisingService.getAdvertising());
>
> }
>
>
> }
>
>
> Here "service" is NOT null, and "content" IS null.
>
>
> Any help is greatly appreciated.
>
>
>
> I'm using glassfish version Sun Java System Application Server 9.1.1
>
> (build b24c-fcs). This is from the admin GUI.
>
>
> thanks,
>
> Daniel.
>
>
>