Hi friends,
With new release of Geronimo-1.0, my code
is working correctly.
Rakesh Ranjan
From: Ranjan, Rakesh (Cognizant)
[mailto:[EMAIL PROTECTED]
Sent: Thursday, January 05, 2006
10:01 AM
To: dev@geronimo.apache.org
Subject: Re: problem with
Geronimo-1.0
Thanks Aaron for GMail account invitation. I will setup a
gmail account.
Sorry for posting the wrong code. The correct code is
Kernel kernel=KernelRegistry.getSingleKernel();
ObjectName gbQuery =
JMXUtil.getObjectName("*:j2eeType=TransactionManager,*");
Set gbeanNames = kernel.listGBeans(gbQuery);
for (Iterator i = gbeanNames.iterator(); i.hasNext();) {
ObjectName gbeanName = (ObjectName)
i.next();
System.out.println(gbeanName);
/* The above print statement is giving
geronimo.server:J2EEApplication=null,J2EEModule=org/apache/geronimo/Server,J2EEServer=geronimo,j2eeType=TransactionManager,
name=TransactionManaer
*/
}
TransactionManager tm = (TransactionManager)
kernel.getProxyManager().createProxy(gbeanName,TransactionManager.class);
Hey I have just written web aaplication. I have put the
above code in a java class. Then calling the above class from the JSP page.
I am just getting the following Exception trace :
java.lang.IllegalArgumentException:
Could not get GBeanInfo for target object:
geronimo.server:J2EEApplication=null,J2EEModule=org/apache/geronimo/Server,J2EEServer=geronimo,j2eeType=TransactionManager,
name=TransactionManager
Re: problem with Geronimo-1.0
|
|
|
Reply (Restricted by the Administrator)
| Show Only this Message
Rakesh,
It would help to get the information I asked for: "a more complete
chunk of your code, plus all the pertinent output and a full stack
trace. Also, please mention what you've deployed into the server (if
anything) other than this application." Again, it's impossible to
debug your problem without knowing what your code is doing.
Let me try to explain in more detail. Here's the code you posted:
Set gbeanNames = kernel.listGBeans(gbQuery);
for (Iterator i = gbeanNames.iterator(); i.hasNext();) {
ObjectName gbeanName = (ObjectName) i.next();
System.out.println(gbeanName1);
}
TransactionManager tm = (TransactionManager)
kernel.getProxyManager().createProxy(gbeanName,
TransactionManager.class);
Now, the gbeanName variable in the for loop is declared in the for
loop, so it's not the same as the gbeanName variable in the
createProxy call. Further, the println in the loop is using a
variable called gbeanName1. So in these three lines, there are three
different variables being used. Of them, we only see where gbeanName
in the loop is assigned, but it's never used. We need to know (and
you need to find out) where the values gbeanName1 and gbeanName (the
one outside of the loop) are assigned. Note that YOU ARE NOT USING
THE RESULT OF THE listGBeans CALL FOR ANYTHING (except to control the
number of times you print gbeanName1) in the code you supplied, so
when people suggest that listGBeans is broken that conclusion is not
supported by the code you posted. That's why I'm asking you to post
more, and hunt down how those variables are being assigned.
On 1/4/06, Ranjan, Rakesh
(Cognizant) <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Sorry Aaron about confidential information footers. But i cann't do
anything because it is generated by the mail server.
Presumably your company doesn't want you sending information to the
world from your company e-mail account if they attach that to every
message. I sent you an invitation to use GMail for your personal
correspondance. :)
Thanks,
Aaron
> The value contained in the variable 'gbeanName' is :
>
>
>
>
geronimo.server:J2EEApplication=null,J2EEModule=org/apache/geronimo/Server,J2EEServer=geronimo,j2eeType=TransactionManager,
>
> name=TransactionManaer
>
>
> I have tried the query using the full object name:
>
>
>
>
geronimo.server:J2EEApplication=null,J2EEModule=geronimo/j2ee-server/1.0/car,J2EEServer=geronimo,
j2eeType=TransactionManager, name=TransactionManager
>
>
>
> Its working correctly. I am able to get the TransactionManager instance
using the full GBean name.
>
> But i would like to know why this thing is not working with
kernel.listGBeans(). Is it a bug in Geronimo-1.0 ?
>
> Rakesh Ranjan
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> Re: problem with Geronimo-1.0
>
> Grr, more confidential information footers. Please don't do that to
> public mailing lists! If your information is confidential,
don't send
> it to the world, and if it's not confidential, please don't assault
us
> with the legalese!
>
> Anyway, now that that's off my chest, Geronimo cannot (well,
> definitely *should* not) produce an incorrect ObjectName out of thin
> air, so you need to figure out where you're getting the ObjectName
> containing org/apache/geronimo/Server from. In the code
snippet you
> showed, you do a lookup and print all the results, but then you try
to
> create a proxy using a variable called gbeanName (which I suspect is
> what's failing) and you never showed us what that variable holds and
> where you got the value in that variable. Maybe it's hardcoded
or in
> a config file or something? You also didn't should the output
of your
> program where it prints all the matching transaction manager names.
> You also didn't give a proper stack trace. So it's real hard
to
> troubleshoot from here. You might want to run it under a
debugger and
> figure out where the o/a/g/Server is coming from.
>
> If none of this helps you figure out what's going on, please post a
> more complete chunk of your code, plus all the pertinent output and
a
> full stack trace. Also, please mention what you've deployed
into the
> server (if anything) other than this application.
>
> Thanks,
> Aaron
>
> On 1/4/06, Ranjan, Rakesh
(Cognizant) <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> > Hi friends,
> >
> > I am trying to get a reference to Geronimo TransactionManager.
For this, I have done the following things : -
> >
> > a) Getting a reference to the kernel using
the KernelRegistry class.
> >
> > b) Then searching the TransactionManager
GBean using a pattern.
> >
> > c) Finally getting the TransactionManager
reference using the searched Gbean.
> >
> >
> >
> >
> >
> > Here the code snippet :
> >
> >
> >
> > Kernel kernel=KernelRegistry.getSingleKernel();
> >
> > ObjectName gbQuery =
JMXUtil.getObjectName("*:j2eeType=TransactionManager,*");
> >
> > Set gbeanNames = kernel.listGBeans(gbQuery);
> >
> > for (Iterator i = gbeanNames.iterator(); i.hasNext();) {
> >
> > ObjectName gbeanName = (ObjectName)
i.next();
> >
> > System.out.println(gbeanName1);
> >
> > }
> >
> > TransactionManager tm = (TransactionManager) kernel.getProxyManager().createProxy(gbeanName,
ransactionManager.class);
> >
> >
> >
> >
> >
> >
> >
> > When I am using this with the Geronimo-1.0-M5, this is working
correctly. But with Geronimo-1.0 , this is not working correctly.
> >
> >
> >
> > With Geronimo-1.0, I am getting the following Exception :
> >
> >
> >
> > java.lang.IllegalArgumentException:
> >
> > Could not get GBeanInfo for target object:
> >
> >
geronimo.server:J2EEApplication=null,J2EEModule=org/apache/geronimo/Server,J2EEServer=geronimo,j2eeType=TransactionManager,name=TransactionManager
> >
> >
> >
> > I think kernel.listGBeans() is not working correctly in case of
Geronimo-1.0. According to the above code, the GBean is
> >
> > geronimo.server:J2EEApplication=null,J2EEModule=org/apache/geronimo/Server,J2EEServer=geronimo,j2eeType=TransactionManager,name=TransactionManager
> >
> >
> >
> > But as much I know, it should be
> >
> >
> >
> > geronimo.server:J2EEApplication=null,J2EEModule=geronimo/j2ee-server/1.0/car,J2EEServer=geronimo,j2eeType=TransactionManager,name=TransactionManager
> >
> >
> >
> > Can anybody please help me whether there is any fault with
Geronimo-1.0 or something else.
> >
> >
> >
> >
> >
> > Regards,
> >
> > Rakesh Ranjan
> >
> >
> > This e-mail and any files transmitted with it are for the sole
use of the intended recipient(s) and may contain confidential and privileged
information.
> > If you are not the intended recipient, please contact the
sender by reply e-mail and destroy all copies of the original message.
> > Any unauthorized review, use, disclosure, dissemination,
forwarding, printing or copying of this email or any action taken in reliance
on this e-mail is strictly
> > prohibited and may be unlawful.
> >
> > Visit us at http://www.cognizant.com
> >
>
>
>
> This e-mail and any files transmitted with it are for the sole use of the
intended recipient(s) and may contain confidential and privileged information.
> If you are not the intended recipient, please contact the sender by
reply e-mail and destroy all copies of the original message.
> Any unauthorized review, use, disclosure, dissemination, forwarding,
printing or copying of this email or any action taken in reliance on this
e-mail is strictly
> prohibited and may be unlawful.
>
> Visit us at http://www.cognizant.com
>