on 10-31-2006 11:16 AM
Hi,
I am trying to access the MEJB implementation in Netweaver EE. As per the documents it claims to be compatible with JSR 77 which meaning that i should be able to access the ManagementHome interface to find out the managed objects for type J2EEApplication. For example:
Context ic = new InitialContext();
java.lang.Object objref = ic.lookup("ejb/mgmt/MEJB");
ManagementHome home =
(ManagementHome)PortableRemoteObject.narrow(objref,ManagementHome.class);
Management mejb = home.create();
ObjectName searchpattern = new ObjectName(":j2eeType=J2EEApplication,");
Set managed_object_set = mejb.queryNames(searchpattern, null);
At this time it does not seems to be working. Any ideas???
Regards,
Rupak Kumar...
Hi Kumar,
As Vladimir wrote - you have to remove duplicating classes and jars.
you have this class javax.management.ManagementHome loaded from 2 classloaders and this is the reason for the ClassCastException as we suggested.
just add a reference to the jsr77's library in your application
best regards,
mladen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rupak,
can you increase the severity of com.sap.engine.services.cross from the telnet connection.
add log
log_edit com.sap.engine.services.cross
write DEBUG and yes from the next step
after that simulate the scenario and after that can you send me the defaultTrace file from the server0\log
when you finish the simulation you can decrease the severity to the ERROR again with:
log_edit com.sap.engine.services.cross
ERROR and yes
best regards,
mladen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mladen,
I changed the log level using telnet to DEBUG. As per the attaching the log file is concerned i am not sure how can i do it here.
For now i am just doing the copy of few lines of the logs here:
#1.5 #00E020569E83000E0000000900000CB803952AB28CE4AEBD#1162819517296#com.sap.engine.services.cross#sap.com/ConverterEAR#com.sap.engine.services.cross#Administrator#2#SAP J2EE Engine JTA Transaction : [1ffffff89ffffffebffffff8e00079]####HTTP Worker [4]##0#0#Debug##Plain###PortableRemoteObjectContainer.narrow(java.lang.Object, Class) : Casted object = RMI_P4: Local Dynamic Stub for impl -> com.sap.engine.services.ejb3.runtime.impl.DefaultEJBProxyInvocationHandler@900cf0ec
------ P4 Remote Object Info : com.sap.engine.services.rmi_p4.server.P4ServerObjectInfo@98
|- broker id : -2051579810
|- server id : 25815950
|- client Id : -1
|- local Id : 25815950
|- is redirectable : true
|- redir Ident :
|- factory Name : com.sap.engine.services.ejb3.runtime.impl.RedirectableEJBProxyObjectFactory
|- objId : com.sap.engine.services.ejb3.runtime.impl.RedirectableEJBProxyIdentifier@1c34b3c
|- server loader name : null
|- connected : false
|- supportOptimization : true
|- protocol : 76 31 v1
|- key : 00 00 00 98 00 00 00 00 CF 62 19 17 ...Â....Ãb..
Remote Interfaces :
Interface : [0] = javax.management.j2ee.ManagementHome
Interface : [1] = com.sap.engine.services.ejb3.runtime.ComponentInterface
=========================================
Connection profiles :
connection profile : [0] = None:172.16.83.20:50204
=========================================
#
#1.5 #00E020569E83000E0000000A00000CB803952AB28CE4AEBD#1162819517296#com.sap.engine.services.cross#sap.com/ConverterEAR#com.sap.engine.services.cross#Administrator#2#SAP J2EE Engine JTA Transaction : [1ffffff89ffffffebffffff8e00079]####HTTP Worker [4]##0#0#Debug##Plain###PortableRemoteObjectContainer.narrow(java.lang.Object, Class) : Casted object classloader = SharedClassLoader[/L_library:tc~je~javax77]#
#1.5 #00E020569E83000E0000000B00000CB803952AB28CE4AEBD#1162819517296#com.sap.engine.services.cross#sap.com/ConverterEAR#com.sap.engine.services.cross#Administrator#2#SAP J2EE Engine JTA Transaction : [1ffffff89ffffffebffffff8e00079]####HTTP Worker [4]##0#0#Debug##Plain###PortableRemoteObjectContainer.narrow(java.lang.Object, Class) : Classloader of the interface = SharedClassLoader[/L_sap.com#ConverterEAR]#
Regards,
Rupak Kumar
Hi Rupak,
These are the important lines:
#1.5 #00E020569E83000E0000000A00000CB803952AB28CE4AEBD#1162819517296#com.sap.engine.services.cross#sap.com/ConverterEAR#com.sap.engine.services.cross#Administrator#2#SAP J2EE Engine JTA Transaction : [1ffffff89ffffffebffffff8e00079]####HTTP Worker [4]##0#0#Debug##Plain###PortableRemoteObjectContainer.narrow(java.lang.Object, Class) : Casted object classloader = SharedClassLoader[/L_library:tc~je~javax77]#
#1.5 #00E020569E83000E0000000B00000CB803952AB28CE4AEBD#1162819517296#com.sap.engine.services.cross#sap.com/ConverterEAR#com.sap.engine.services.cross#Administrator#2#SAP J2EE Engine JTA Transaction : [1ffffff89ffffffebffffff8e00079]####HTTP Worker [4]##0#0#Debug##Plain###PortableRemoteObjectContainer.narrow(java.lang.Object, Class) : Classloader of the interface = SharedClassLoader[/L_sap.com#ConverterEAR]#
So, you see the classloader of the looked up object and the classloader of the interface to which you are casting (javax.management.j2ee.ManagementHome) are different, hence different classes here though same name. This brings me back to my assumption above: you have the JSR 77 classes inside your application ConverterEAR instead of reference to the tcjejavax77 library as it should be in order to work properly.
What can you do? Remove the javax77.jar (or any jar that contains JSR 77 stuff) from your application and edit the application-j2ee-engine.xml - add this reference:
<reference reference-type="hard">
<reference-target target-type="library">
tc~je~javax77
</reference-target>
</reference>
That's it! Hope it helps.
-Vladimir
Hi Vladimir,
Thanks for solving the problem. Infact not only i had to keep the javax77 in the path to avoid compilation error. Apart from this it was required to add the entry in the descriptor file.
Although this is solved, i am having another issue now. When i executed the operation:
Set managed_object_set = mejb.queryNames(null, null);
I got the complete list of items. Now i could see the j2eeTypes as per the jsr 77 like JVM,J2EEApplication, J2EEServer, Servlet etc...
But i could not see any j2eeType with the name "StatelessSessionBean" Or other ejb types as per jsr 77.
Infact the obvious question is do i have a EJB component deployed at the first place. The answer is yes i do have a deployed EJB component. The syntax is as follows:
@Stateless public class SampleConverterBean implements SampleConverterRemote,SampleConverterLocal {}
This one is deployed and i could test it with a webmodule as well. But i do not see the j2eeType for that via the API call "mejb.queryNames(null, null);", i am not sure as whether i have written the EJB component as per the EJB 3.0 standard or not.
Can you pls help??? This is urgent and any clue here is highly appreciated...
Hi Rupak,
I think that it can be a classloader's issue.
Can you check your references?
best regards,
mladen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
could you be more specific on what exact problem is? Just as a hint could you try with "j2ee_tools/mgmt/MEJB" as a lookup string.
Regards
Nikolai
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nikolai,
Thanks for the help. Infact it did worked with the name "j2ee_tools/mgmt/MEJB". But to my frustration i was expecting the JNDI lookup would return me objectref of type "javax.management.j2ee.ManagementHome" as per the JSR 77 specification.
That is the not the case, PortableRemoteObject.narrow() gave me a ClassCastException.
I looked into the return type of class name from the object which happens to be Dynamic Proxy but do not know why that cast exception then. Below is the exception & classtype definition:
java.lang.ClassCastException: javax.management.j2ee.ManagementHome
at com.sap.engine.services.cross.PortableRemoteObjectContainer.narrow(PortableRemoteObjectContainer.java:209)
at com.sap.engine.system.PortableRemoteObjectProxy.narrow(PortableRemoteObjectProxy.java:24)
at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137)
& Class Type is:
RMI_P4: Local Dynamic Stub for impl com.sap.engine.services.ejb3.runtime.impl.DefaultEJBProxyInvocationHandler@900cf0ec
Interface : [0] = javax.management.j2ee.ManagementHome
Interface : [1] = com.sap.engine.services.ejb3.runtime.ComponentInterface
If you look at the interface it clearly shows javax.management.j2ee.ManagementHome which meaning the cast should have been successful.
I am not too sure how come NetweaverJEE claims to be compatible with JSR 77. Either this seems to be a defect or they are not standard compliant.
Thanks for reading this long message.
Regards,
Rupak Kumar...
Hi Rupak,
Hmm... or either there might be a minor chance that you have missed something
Since the SAP Java EE 5 Edition is <a href="http://java.sun.com/javaee/overview/compatibility.jsp">certified for compatibility</a> and JSR 77 is part even of J2EE 1.4, I would not doubt compliance here. This looks more like a classloader issue. Have you already set a reference from your application to the <b>tcjejavax77</b> library (in the application-j2ee-engine.xml)? Or are you trying to lookup the MEJB from somewhere else?
Regards,
Vladimir
Hi,
Well a reason for getting a class cast exception could be the ManagementHome your trying to cast to is not from <i>javax.management.j2ee</i> package. Could you put the package of the ManagementHome casts at
<i>ManagementHome home = (ManagementHome)PortableRemoteObject.narrow(objref,ManagementHome.class);</i> line, just to make sure that it is casting to the desired interface from the correct package?
Regards
Nikolai
Hi Nikolia,
What you are saying may be the most prabable guess i had when i tested this. Infact i revalidated that i do not have any jars in the path of my application which try to execute this program. From the latest JEE distribution i have used javax77.jar for the client application classpath to locate the javax.management.j2ee.ManagementHome interface.
The other suggestion about referring to JMX in the xml descriptor may not be an issue because the application is able to get back the reference of the MEJB object reference but it is only during a PortableRemoteObject.narrow() which causes the classcast exception Or when i try doing a direct cast operation on the returned object reference which fails.
This is becoming very important for me to resolve. Any help to resolve this is highly appreciated.
Regards,
Rupak Kumar...
Hi Martin,
Good to hear that at least at your end it is working. So far i had not introduced the following libraries:
1) sap.comtcexception~impl.jar
2) sap.comtcjeclientlibimpl.jar
Today i added this additional libraries in the build path of the EJB application which tries to run that piece of code, but i get the same error.
I think you seems to make it working. Can you pls share the NWDS project which you made it working, i am sure that may not be propritary code
Did you manually entered any values in the application-j2ee-engine.xml file for references or any other descriptor file changes you had to make to make it working.
Regards,
Rupak Kumar...
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.