Excepion when initializing EJB as a CORBA client
Hi,
I am trying to connect to a remote CORBA server(C++) through my ejb running on PE8.2, but when I init the IONA ORB in the ejb, I get the follwing exception:
Caused by: org.omg.CORBA.INITIALIZE: Exception reading properties, probably this is an applet but no applet parameter supplied to ORB.init vmcid: 0x0 minor code: 0 completed: No
at IE.Iona.OrbixWeb.CORBA.ORB._set_parameters(ORB.java:1573)
at IE.Iona.OrbixWeb.CORBA.ORB.<init>(ORB.java:81)
at IE.Iona.OrbixWeb.CORBA.ORB._create_orb(ORB.java:1611)
at IE.Iona.OrbixWeb.CORBA.ORB._initialise(ORB.java:1545)
at IE.Iona.OrbixWeb.CORBA.ORB.init(ORB.java:1505)
Here is the ORB invocation from my ejb:
public void initOrb(String p_hostName, String p_serverName) {
String[] args = {p_hostName, p_serverName};
Properties p = new Properties();
p.setProperty("org.omg.CORBA.ORBClass","IE.Iona.OrbixWeb.CORBA.ORB");
p.setProperty("org.omg.CORBA.ORBSingletonClass", "IE.Iona.OrbixWeb.CORBA.singletonORB");
// Initialize the ORB
ORB orb = (ORB)ORB.init(args,p);
}All the required libs are included in the appserver lib.
I have tried this with JBOSS and it works fine.
Has anyone seen this before?
This has been resolved by setting the PropertyPermission to read,write
in the application server server.policy
Hope this helps someone
Similar Messages
-
Accessing EJB's from CORBA clients
Hi!
Can someone answer one badly important question?
Is it possible to access EJB's from CORBA clients directly, as if the
beans were ordinary CORBA objects? I mean DIRECT access - WIDHOUT
CORBA/Java server application as a liason between CORBA client and EJB
server!
I'm using WebLogic Enterprise 5.0.1.
Thanks in advance.
Aleksey.Please reference a later posting on this very same question.
-- Lou Caraballo
Sr. Systems Engineer
BEA Systems Inc., Denver Telco Group
719-332-0818 (cell)
720-528-6073 (denver)
Aleksey Bukavnev <[email protected]> wrote in message
news:[email protected]..
Thank you!
Aleksey.
Bill Lloyd wrote:
There is a java to IDL mapping, which is quite complex. To use it, you
must
have an ORB which supports, at minimum, CORBA 2.3. ORBs I know of which
support this include Orbix 2000 for Java, Visibroker 4.0 for Java, and
Orbacus 4.0 for Java.
Also, check out the June 2000 "Java Report" which has an article onthis.
>>
To be perfectly honest, though, the best solution is to write a bridge,in
Java. One side is IDL, which CORBA clients use. The implementation ofthat
IDL makes RMI requests to get the necessary info. This solution willwork,
guaranteed. The portion of the spec for the java to IDL mapping isstill
quite new, and I would expect some, uh, "unexpected features" at thistime.
>>
-B
"Aleksey Bukavnev" <[email protected]> wrote in message
news:[email protected]..
Hi!
Can someone answer one badly important question?
Is it possible to access EJB's from CORBA clients directly, as if the
beans were ordinary CORBA objects? I mean DIRECT access - WIDHOUT
CORBA/Java server application as a liason between CORBA client and EJB
server!
I'm using WebLogic Enterprise 5.0.1.
Thanks in advance.
Aleksey. -
Hello
I am trying to connect Corba Client to EJB deployed in OC4J.
I followed the instructions given on
http://otn.oracle.com/tech/java/oc4j/htdocs/how-to-rmi-iiop.html
But I am not getting success after making tries in different ways.
Can some body tell how to connect to EJB by a corba client using Oc4j.
If OC4J does't support RMI-IIOP , can you suggest other server which supports that.
Thanx in advance.I'm stuck exactly with the same issue while trying to port my application from weblogic to jboss.
I tried to specify different ORB implementations (JacORB, OpenORB) for jvm option org.omg.CORBA.ORBClass, but JBoss couldn't get them instantiated. Native Sun implementation which is used in JBoss by default and can be instantiated, apparently is not fully compatible with weblogic security module.
So did you manage to find out the solution?
Edited by DigitalDude at 04/09/2008 11:47 PM -
EJB in WLS - CORBA and EJB on WLE
I have a client who is looking to attach a C++ client to their WLE
system, and, since
they now have WLS and WLE thanks to v. 5.1, they want to start moving
EJBs to the
WLS platform. The issue is this.
What if any are the issues regarding communicating between CORBA objects
on WLE
TO EJBs on WLS? I noticed that the illustrations always show the
communication coming
from the WLS side to the WLE side, but this client will be connected
directly to the WLE
platform, and wanting to access services on WLS.
Any issues, directions to documentation, or other advice regarding this
issue?
Thanks in advance,
Maffy
[maffy.vcf]can anyone give code example for accessing WLS-EJB from WLE corba client.
louc wrote:
Interesting how things can be interpreted. What we need is direct input
from engineering on this.
In studying the only direct source of information we have... (the docs...
and ass-u-me'ing that the docs are correct) it appears that we can have a
CORBA object in WLE access a EJB in WLS through RMI/IIOP as long as the
parameter passing is kept to primitive data types. Any attempt to use the
'Object-by-Value' feature of CORBA 2.3 will result in a error because WLE
5.1 does not support passing 'Object-by-Value' at this time.
So to answer Maffy's question... yes a WLE CORBA client can access a WLS EJB
service through RMI over IIOP.
-- Lou Caraballo
Sr. Systems Engineer
BEA Systems Inc., Denver Telco Group
719-332-0818 (cell)
720-528-6073 (denver)
Robert Patrick <[email protected]> wrote in message
news:[email protected]...
The issue is that WLE does not yet support the RMI/IIOP standard (since itdoes not yet support
Objects by Value) not that the RMI/IIOP support in WLS 5.1 (as of SP3)does not support
bi-directional communication.
Papaya Head wrote:
so, you are saying bi-directional communication is not supported... can
you tell me what
rmi/iiop is for?
Thanks.
Maffy Finnerty wrote:
Okay, found a work around thanks to Deepak Sharma (THANK YOU,
DEEPAK!!) in the BEA
East office.
What my customer is going to have to do for now - until, as Will Lyonspointed out, the
bi-directional
communication is supported - is to build a Java "client" process onWLE that communicates
with the
RMI/EJB/Servlet process on WLS.
Deepak suggested that the best way, since they are a CORBA shop tryingto move to Java,
would be to have the C++ client talking to a CORBA/C++ object on WLEthat calls
a CORBA/Java object on WLE that acts as a client to WLS and accessesthe services of the
Java object on that server.
Another option would be to have the CORBA/C++ object on WLE use theJNI API to call a Java
object
on WLE that acts as a client to WLS and accesses the Java servicerunning there. There may
be better
performance from CORBA/C++ to CORBA/Java, though, so that was Deepak'sfirst choice.
Maffy
Papaya Head wrote:
you can also find an example in the WLS5.1 docs that includes a code
segment from C++
client of the RMI-IIOP hello example.
Will Lyons wrote:
The example application with C++ CORBA objects calling EJBs on a
Java Server refers
to C++ CORBA objects on the WLE T-Engine calling EJBs on the WLET-Engine. That
interoperability capability is supported, but it is not possibleto call the J-Engine
from the T-Engine in WLE 5.1. The primary usage model assumed inWLE 5.1 is calling
the WLE T-Engine from the J-Engine (or from WLS).
Will
Papaya Head wrote:
my understanding of your question is: you want some feature that
allows CORBA
objects to talk to EJB objects on WLS.
WLS5.1 has a new feature: RMI/IIOP, it's probably the featureyou want.
before WLS5.1, CORBA components couldn't talk to EJB componentsdirectly, but you
could make it happen by building a bridge from CORBA objects toEJB components on
WLS. that's probably what the references you read are talkingabout...
Maffy Finnerty wrote:
We haven't even gotten that far yet, re: transactions. Right
now the issue is
having an
in-house client (C++) connected to WLE but accessing services(EJBs) on WLS.
No talk
of transactions has occurred, yet.
However, I just found some conflicting information. I found areference to
building the
simpapp application to connect C++ objects on a CORBA serverto EJBs on a Java
Server,
which, if I'm reading it correctly, translates to WLE to WLS.However, I also
found a
reference to bidirectional interoperability that said that,for now, the
T-Engine could not
(WLE) could NOT invoke services on the J-Engine (WLS) but thatservices on the
T-Engine
(WLE) could BE invoked from requesters on the J-Engine (WLS).So, color me
confused.
maffy
Papaya Head wrote:
the first question that comes to my mind is:
can transaction run across components on WLE and components
on WLS? I don't
think it can...
Maffy Finnerty wrote:
I have a client who is looking to attach a C++ client to
their WLE
system, and, since
they now have WLS and WLE thanks to v. 5.1, they want tostart moving
EJBs to the
WLS platform. The issue is this.
What if any are the issues regarding communicating betweenCORBA objects
on WLE
TO EJBs on WLS? I noticed that the illustrations alwaysshow the
communication coming
from the WLS side to the WLE side, but this client will beconnected
directly to the WLE
platform, and wanting to access services on WLS.
Any issues, directions to documentation, or other adviceregarding this
issue?
Thanks in advance,
Maffy -
Hi,
I have a question on using EJB / or RMI servers with CORBA clients using
RMI-IIOP transport, which in theory should work, but in practice has few
glitches.
Basically, I have implemented a very simple server, StockTreader, which
looks up for a symbol and returns a 'Stock' object. In the first example, I
simplified the 'Stock' object to be a mere java.lang.String, so that lookup
would simply return the 'synbol'.
Then I have implemented the above, as an RMI-IIOP server (case 1) and a
CORBA server (case 2) with respective clients, and the pair of
client-servers work fine as long as they are CORBA-to-CORBA and RMI-to-RMI.
But the problem arises when I tried using the RMI server (via IIOP) with the
CORBA client, when the client tries to narrow the object ref obtained from
the naming service into the CORBA idl defined type (StockTrader) it ends up
with a class cast exception.
This is what I did to achieve the above results:
[1] Define an RMI interface StockTrader.java (extending java.rmi.Remote)
with the method,
public String lookup( String symbol) throws RMIException;
[2] Implement the StorckTrader interface (on a PortableRemoteObject derived
class, to make it IIOP compliant), and then the server to register the stock
trader with COS Naming service as follows:
String homeName =....
StockTraderImpl trader =new StockTraderImpl();
System.out.println("binding obj <" homeName ">...");
java.util.Hashtable ht =new java.util.Hashtable();
ht.put("java.naming.factory.initial", args[2]);
ht.put("java.naming.provider.url", args[3]);
Context ctx =new InitialContext(ht);
ctx.rebind(homeName, trader);
[3] Generate the RMI-IIOP skeletons for the Implementation class,
rmic -iiop stock.StockTraderImpl
[4] generate the IDL for the RMI interface,
rmic -idl stock.StockTraderImpl
[5] Generate IDL stubs for the CORBA client,
idlj -v -fclient -emitAll StockTraderImpl.idl
[6] Write the client to use the IDL-defined stock trader,
String serverName =args[0];
String symList =args[1];
StockClient client =new StockClient();
System.out.println("init orb...");
ORB orb =ORB.init(args, null);
System.out.println("resolve init name service...");
org.omg.CORBA.Object objRef
=orb.resolve_initial_references("NameService");
NamingContext naming =NamingContextHelper.narrow(objRef);
... define a naming component etc...
org.omg.CORBA.Object obj =naming.resolve(...);
System.out.println("narrow objRef: " obj.getClass() ": " +obj);
StockTrader trader =StockTraderHelper.narrow(obj);
[7] Compile all the classes using Java 1.2.2
[8] start tnameserv (naming service), then the server to register the RMI
server obj
[9] Run the CORBA client, passing it the COSNaming service ref name (with
which the server obj is registered)
The CORBA client successfully finds the server obj ref in the naming
service, the operation StockTraderHelper.narrow() fails in the segment
below, with a class cast exception:
org.omg.CORBA.Object obj =naming.resolve(...);
StockTrader trader =StockTraderHelper.narrow(obj);
The <obj> returned by naming service turns out to be of the type;
class com.sun.rmi.iiop.CDRInputStream$1
This is of the same type when stock trader object is registered in a CORBA
server (as opposed to an RMI server), but works correctly with no casting
excpetions..
Any ideas / hints very welcome.
thanks in advance,
-hariOn the contrary... all that is being said is that we needed to provide clearer examples/documentation in the 5.1.0 release. There will be no difference between the product as found in the service pack and the product found in the 5.1.1. That is, the only substantive will be that 5.1.1 will also
include the examples.
"<=one way=>" wrote:
With reference to your and other messages, it appears that one should not
expect that WLS RMI-IIOP will work in a complex real-life system, at least
not now. In other words, support for real-life CORBA clients is not an
option in the current release of WLS.
TIA
"Eduardo Ceballos" <[email protected]> wrote in message
news:[email protected]...
We currently publish an IDL example, even though the IDL programmingmodel in Java is completely non-functional, in anticipation of the support
needs for uses who need to use IDL to talk to the Weblogic server,
generically. This example illustrates the simplest connectivity; it does not
address how
to integrate CORBA and EJB, a broad topic, fraught with peril, imo. I'llnote in passing that, to my knowledge, none of the other vendors attempt
this topic either, a point which is telling if all the less happy to hear.
For the record then, what is missing from our distribution wrt RMI-IIOPare a RMI-IIOP example, an EJB-IIOP example, an EJB-C++. In this you are
correct; better examples are forth coming.
Still, I would not call our RMI-IIOP implementation fragile. I would saythat customers have an understandably hard time accepting that the IDL
programming model is busted; busted in the sense that there are no C++
libraries to support the EJB model, and busted in the sense that there is
simply no
support in Java for an IDL interface to an EJB. Weblogic has nothing to doit being busted, although we are trying to help our customers deal with it
in productive ways.
For the moment, what there is is a RMI (over IIOP) programming model, aninherently Java to Java programming model, and true to that, we accept and
dispatch IIOP request into RMI server objects. The way I look at it is this:
it's just a protocol, like HTTP, or JRMP; it's not IDL and it has
practically nothing to do with CORBA.
ST wrote:
Eduardo,
Can you give us more details about the comment below:
I fear that as soon as the call to narrow succeeds, the remainingapplication will fail to work correctly because it is too difficult ot
use an idl client in java to work.It seems to me that Weblogic's RMI-IIOP is a very fragile
implementation. We
don't need a "HelloWorld" example, we need a concrete serious example(fully
tested and seriously documented) that works so that we can get a betteridea
on how to integrate CORBA and EJB.
Thanks,
Said
"Eduardo Ceballos" <[email protected]> wrote in message
news:[email protected]...
Please post request to the news group...
As I said, you must separate the idl related classes (class files and
java
files) from the rmi classes... in the rmic step, you must set a newtarget
(as you did), emit the java files into that directory (it's not clearyou
did this), then remove all the rmi class files from the class path... ifyou
need to compile more classes at that point, copy the java files to theidl
directly is you must, but you can not share the types in any way.
I fear that as soon as the call to narrow succeeds, the remainingapplication will fail to work correctly because it is too difficult otuse
an idl client in java to work.
Harindra Rajapakshe wrote:
Hi Eduardo,
Thanks for the help. That is the way I compiled my CORBA client, by
separating the IDL-generated stubs from the RMI ones, but still I
get a
CORBA.BAD_PARAM upon narrowing the client proxy to the interfacetype.
Here's what I did;
+ Define the RMI interfaces, in this case a StockTrader interface.
+ Implement RMI interface by extendingjavax.rmi.PortableRemoteObject
making
it IIOP compliant
+ Implemnnt an RMI server, and compile using JDK1.2.2
+ use the RMI implementation to generate CORBA idl, using RMI-IIOPplugin
utility rmic;
rmic -idl -noValueMethods -always -d idl stock.StockTraderImpl
+ generate Java mappings to the IDL generated above, using RMI-IIOPplugin
util,
idlj -v -fclient -emitAll -tf src stocks\StockTrader.idl
This creates source for the package stock and also
org.omg.CORBA.*
package, presumably IIOP type marshalling
+ compile all classes generated above using JDK1.2.2
+ Implement client (CORBA) using the classes generated above, NOTthe
RMI
proxies.
+ start RMI server, with stockTrader server obj
+ start tnameserv
+ start CORBA client
Then the client errors when trying to narrow the obj ref from the
naming
service, into the CORBA IDL defined interface using,
org.omg.CORBA.Object obj =naming.resolve(nn);
StockTrader trader =StockTraderHelper.narrow(obj); // THIS
ERRORS..!!!
throwing a CORBA.BAD_PARAM exception.
any ideas..?
Thanks in advance,
-hari
----- Original Message -----
From: Eduardo Ceballos <[email protected]>
Newsgroups: weblogic.developer.interest.rmi-iiop
To: Hari Rajapakshe <[email protected]>
Sent: Wednesday, July 26, 2000 4:38 AM
Subject: Re: problem using CORBA clients with RMI/EJBservers..!!!???
Please see the post on june 26, re Errors compiling... somewherein
there,
I suspect, you are referring to the rmi class file when you are
obliged
to
completely segregate these from the idl class files.
Hari Rajapakshe wrote:
Hi,
I have a question on using EJB / or RMI servers with CORBA
clients
using
RMI-IIOP transport, which in theory should work, but in practice
has
few
glitches.
Basically, I have implemented a very simple server,
StockTreader,
which
looks up for a symbol and returns a 'Stock' object. In the firstexample, I
simplified the 'Stock' object to be a mere java.lang.String, so
that
lookup
would simply return the 'synbol'.
Then I have implemented the above, as an RMI-IIOP server (case
1)
and a
CORBA server (case 2) with respective clients, and the pair of
client-servers work fine as long as they are CORBA-to-CORBA andRMI-to-RMI.
But the problem arises when I tried using the RMI server (via
IIOP)
with
the
CORBA client, when the client tries to narrow the object ref
obtained
from
the naming service into the CORBA idl defined type (StockTrader)
it
ends
up
with a class cast exception.
This is what I did to achieve the above results:
[1] Define an RMI interface StockTrader.java (extending
java.rmi.Remote)
with the method,
public String lookup( String symbol) throws RMIException;
[2] Implement the StorckTrader interface (on a
PortableRemoteObject
derived
class, to make it IIOP compliant), and then the server to
register
the
stock
trader with COS Naming service as follows:
String homeName =....
StockTraderImpl trader =new StockTraderImpl();
System.out.println("binding obj <" homeName ">...");
java.util.Hashtable ht =new java.util.Hashtable();
ht.put("java.naming.factory.initial", args[2]);
ht.put("java.naming.provider.url", args[3]);
Context ctx =new InitialContext(ht);
ctx.rebind(homeName, trader);
[3] Generate the RMI-IIOP skeletons for the Implementation
class,
rmic -iiop stock.StockTraderImpl
[4] generate the IDL for the RMI interface,
rmic -idl stock.StockTraderImpl
[5] Generate IDL stubs for the CORBA client,
idlj -v -fclient -emitAll StockTraderImpl.idl
[6] Write the client to use the IDL-defined stock trader,
String serverName =args[0];
String symList =args[1];
StockClient client =new StockClient();
System.out.println("init orb...");
ORB orb =ORB.init(args, null);
System.out.println("resolve init name service...");
org.omg.CORBA.Object objRef
=orb.resolve_initial_references("NameService");
NamingContext naming=NamingContextHelper.narrow(objRef);
... define a naming component etc...
org.omg.CORBA.Object obj =naming.resolve(...);
System.out.println("narrow objRef: " obj.getClass() ":"
+obj);
StockTrader trader =StockTraderHelper.narrow(obj);
[7] Compile all the classes using Java 1.2.2
[8] start tnameserv (naming service), then the server to
register
the
RMI
server obj
[9] Run the CORBA client, passing it the COSNaming service ref
name
(with
which the server obj is registered)
The CORBA client successfully finds the server obj ref in the
naming
service, the operation StockTraderHelper.narrow() fails in thesegment
below, with a class cast exception:
org.omg.CORBA.Object obj =naming.resolve(...);
StockTrader trader =StockTraderHelper.narrow(obj);
The <obj> returned by naming service turns out to be of the
type;
class com.sun.rmi.iiop.CDRInputStream$1
This is of the same type when stock trader object is registeredin a
CORBA
server (as opposed to an RMI server), but works correctly with
no
casting
excpetions..
Any ideas / hints very welcome.
thanks in advance,
-hari -
This is the situation we have:
1) We must support both C++ and Java clients that will be requesting
services from our EJBs running in WLS. The clients are internal apps running
in different companies and we would prefer to avoid requiring our clients to
use an ORB by a specific vendor. At the same time we do not want to deal
with potential problems related to the implementation differences by
different ORB vendors. What would be the best way to handle this situation?
2) WLS documentation has the following paragraph:
"WebLogic RMI over IIOP is the framework for EJB-to-CORBA mapping support.
Currently, however, a standard for passing user identity -- required to
implement EJB-to-CORBA mapping -- does not exist and the requirement for
transaction propagation from the client is in question. While RMI over IIOP
does allow CORBA clients to access EJBeans, the following services will not
be available:
EJB transaction services
EJB security services"
Does this mean that:
2.1) CORBA client initiated transactions will not be supported,
everything will work
2.2) None of the EJB security services will be available in EJB method
called by a CORBA client (i.e. getCallerPrincipal() and isCallerInRole()
will fail)
Thanks in advanceGenerally speaking, applications are built around common resources, namely the databases and security realms. Here, it seems you can't make any assumptions about the client at all, so you render useless the ability to propagate the transaction and security context; the upshot being that you couldn't
use it, even if we provided support for it, which we don't.
You also want to be shielded from all the incompatibilities between the ORB vendors, that is, you want to provide a client interface to call into an ejb, that will work irrespective of the orb the client runs. From this, I gather that you can have a 1.0 or 2.1 Tao, Visibroker, IONA, etc, orb as a
client, so you can not use objects in the interface.
To accomplish this, you need to do the following:
-- design the client interface so that it is stateless
-- design the interface so that it does not include any objects or structs... actually, you can use structs, it's just more complicated.
-- use server side transactions only (this follows from the statelessness of the interface)
-- either assume that ssl will be in place by the time you need it or include a token in the interface for the authenticated user
Please, read on...
"<=one way=>" wrote:
This is the situation we have:
1) We must support both C++ and Java clients that will be requesting
services from our EJBs running in WLS. The clients are internal apps running
in different companies and we would prefer to avoid requiring our clients to
use an ORB by a specific vendor. At the same time we do not want to deal
with potential problems related to the implementation differences by
different ORB vendors. What would be the best way to handle this situation?
We support IIOP as the transport. To call into any remote interface, you must provide a java.rmi.Remote interface, and code generate the IDL from that interface using weblogic.rmic. If you follow the above strictures, and use the -noValueTypes discussed earlier, you should be able to make progress
without the promised examples.... or you can wait for the examples.
>
2) WLS documentation has the following paragraph:
"WebLogic RMI over IIOP is the framework for EJB-to-CORBA mapping support.
Currently, however, a standard for passing user identity -- required to
implement EJB-to-CORBA mapping -- does not exist and the requirement for
transaction propagation from the client is in question. While RMI over IIOP
does allow CORBA clients to access EJBeans, the following services will not
be available:
EJB transaction services
EJB security services"
Does this mean that:
2.1) CORBA client initiated transactions will not be supported,
everything else (sic) will workYes.
>
2.2) None of the EJB security services will be available in EJB method
called by a CORBA client (i.e. getCallerPrincipal() and isCallerInRole()
will fail)No. The call will not fail, they will either provide values that correspond to the default or the user configured by the weblogic.iiop.user property.
>
>
Thanks in advance -
According to the article "Enterprise JavaBeans Components and CORBA Clients: A Developer Guide", CORBA clients can directly access an EJB bean via IIOP.
The procedure is like the followings:
1) Generate IDL files from EJB remote classes(Logger.class, LoggerHome.class).
2) Deliver IDL files to CORBA clients.
3) CORBA clients comple IDL files to a specific language(i.e., C++, Java, ...)
I used 'rmic', distributed with J2SDK 1.3 and 1.4, as a Java-to-IDL translator.
> rmic -idl -noValueMethods -classpath %j2ee_home%\lib\j2ee.jar;. ejbinterop.Logger ejbinterop.LoggerHome
But I encountered many problems while compiling Java source files, generated by 'idlj' of J2SDK 1.3 and 1.4, after the third step.
Anyone else experienced the same situation?
Any help will be appreciated.You most likely won't be able to make the "round trip" of
Java -> IDL -> Java
I believe the IDL to Java and Java to IDL specs at the OMG say that it's unsupported. -
Corba client to EJB on OAS408 ?
I have an EJB deployed on OAS408. Can I call the EJB methods from a Corba client? How will I setup a CORBA client to communicate RMI over IIOP ?
I found the following statement on the Oracle Java roadmap :
"Enterprise beans and Common Ojbect Request Broker Architecture (CORBA) clients can inter-operate with each other opening up the possibility of multiple types of clients accessing EJB servers accross the enterprise."
Can anybody please help me on how to do this
nullI am trying to do exactly the same thing
But I am unable to read the zip file on
the newsgroup.
Can someone mail me the zip of the sample
code.
Thanks inAdvance.
Irfan Lateef -
EJB 3.0 Application Client threw Remote nested exception
Hi All,
I came across the following EJBException message when trying to retrieve an Employee record (entity bean in EJB 3.0) after having successfully added it into EMPLOYEE table using stateless session bean:
*10/03/2009 8:53:14 PM com.sun.enterprise.appclient.MainWithModuleSupport <init>*
WARNING: ACC003: Application threw an exception.
javax.ejb.EJBException: nested exception is: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.RemoteException: null; nested exception is:
java.lang.NullPointerException
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.RemoteException: null; nested exception is:
java.lang.NullPointerException
at com.sun.corba.ee.impl.javax.rmi.CORBA.Util.mapSystemException(Util.java:243)
at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:205)
at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(StubInvocationHandlerImpl.java:152)
at com.sun.corba.ee.impl.presentation.rmi.bcel.BCELStubBase.invoke(BCELStubBase.java:225)
at ejb.__EmployeeRemote_Remote_DynamicStub.findEmployee(ejb/__EmployeeRemote_Remote_DynamicStub.java)
at ejb._EmployeeRemote_Wrapper.findEmployee(ejb/_EmployeeRemote_Wrapper.java)
at client.EmployeeApplicationClient.printEmployee(EmployeeApplicationClient.java:608)
at client.EmployeeApplicationClient.main(EmployeeApplicationClient.java:55)
Below is the code snippets of EmployeeApplicationClient.java:
public class EmployeeApplicationClient {
@EJB
private static EmployeeRemote employeebean1;
@EJB
private static EmployeeRemote employeebean2;
public EmployeeApplicationClient() {}
public static void main(String[] args)
EmployeeApplicationClient employee_application_client = new EmployeeApplicationClient();
employee_application_client.addEmployee(1, John, Smith);
employee_application_client.printEmployee(1);
public void addEmployee(int id, String firstname, String surname)
try {
Employee employee1 = new Employee();
employee1.setID(id);
employee1.setfirstname(firstname);
employee1.setsurname(surname);
employeebean1.createEmployee(employee1);
catch {.....}
public void printEmployee(int employee_id)
Employee employee2 = employeebean2.findEmployee(employee_id);
System.out.println("employee Id: " + employeebean2.getId());
System.out.println("employee firstname: " + employeebean2.getfirstname());
System.out.println("employee surname: " + employeebean2.getsurname());
}Using employeebean1/employeebean2 in printEmployee() did not make any difference.
The error message appears to indicate that I have incorrectly structured these methods.
The deployment of EmployeeBean was successful and employee1 is in EMPLOYEE table via SQL query.
I am using JDK1.6.07, Glassfish v2 with MySQL 5.0 and Netbeans 6.1 on Windows XP platform.
Any assistance would be greatly appreciated.
Thanks,
JackHi Ataraxisme,
Thank you for responding to this post.
This is a J2EE Application Client that was created and deployed along as an Netbeans EAR (both Application Client and EJB) project which uses resource injection as opposed to JNDI lookup.
I am trying to get employeeApplicationClient.java to work the same way as the following travelAgentApplicationClient.java example which has successfully retrieved its record record immediately after adding using resource injection:
public class TravelAgentClient {
@EJB
private static TravelAgentRemote travelagent;
public TravelAgentClient() {
public static void main(String[] args) {
TravelAgentClient client = new TravelAgentClient();
client.doTravelAgent();
public void doTravelAgent() {
try {
Cabin cabin_1 = new Cabin();
cabin_1.setId(1);
cabin_1.setName("Master Suite");
cabin_1.setDeckLevel(1);
cabin_1.setShipId(1);
cabin_1.setBedCount(3);
travelagent.createCabin(cabin_1);
Cabin cabin_2 = travelagent.findCabin(1);
System.out.println(cabin_2.getName());
System.out.println(cabin_2.getDeckLevel());
System.out.println(cabin_2.getShipId());
System.out.println(cabin_2.getBedCount());
......Thanks,
Jack -
CORBA client reconnection: InvalidDomain
I'm developing a CORBA-client for WLE 5.1. In short, the problem is:
I can't restore a connection after a COMM_FAILURE. When trying to create a Tobj_Bootstrap object again I get
com.beasys.Tobj.InvalidDomain: Can't connect to the domain (//my.domain:2600)
Here are some details. The client must work without restart during a long time. It is normal that sometimes network problems occur or server is restarted or any other thing happens that can make a remote object reference invalid. So, when getting a COMM_FAILURE, I try to "reconnect" - that is to obtain remote reference again. I do it in the same way as on the first start of the client:
1. Create Tobj_Bootstrap.
2. Obtain Factory Finder.
3. Obtain Factory.
4. Obtain remote interface reference.
On the first step I get this InvalidDomain exception. Even if the connection is OK, the server is up and running and the URL passed to Tobj_Bootstrap(orb, url) is correct. The other strange thing is - there is no network activity during this call (observed by network monitoring tool). Seems ORB doesn't really try to do its job.
BTW, I use m3envobj.jar and wleclient.jar for CORBA-functionality.
The same client using SUN's ORB (with simple CORBA-server from JDK 1.4) reconnects well.
What is the reason?
Thanks in advance.
Yury.Generally, no. If you carefully massage the IDL that results from the EJB, it's possible to manufacture a subset of the EJB's interface that a 2.2 or 2.1 ORB can call, but there is currently no automagical support for this in WLS. Beyond the use of value types, the trouble that most ORBs run into is
the IIOP type codes that start with RMI: instead of IDL:
Loaner wrote:
Hi,
I have a CORBA client developed on pre CORBA 2.3 ORB, i.e. the ORB
doesn't supports Object by Value. Can this client access the services
being provided by the EJB somehow??
Any help will be appreicated.
Vikas -
Looking up EJBs from a java client
While trying to migrate my application from standalone-oc4j
to Oracle Application Server 10g, I ran into the following problem.
My application has a stateless session bean. When trying to lookup the bean (from a java client), I get the following exception:
javax.naming.NamingException: Lookup error: javax.naming.AuthenticationException
Invalid username/password for UnifyoccEAR (ias_admin)
My code used the username/password I used to log into web-based console (which I used to deploy the application). The lookup code follows:
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
OracleJASLayer.INITIAL_CONTEXT_FACTORY);
env.put(Context.PROVIDER_URL, "ormi://localhost:3201/UnifyoccEAR");
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, username);
env.put(Context.SECURITY_CREDENTIALS, password);
Context ctx = new InitialContext(env);
Object obj = ctx.lookup("unify/nxj/controlCenters/occ/ControlCenterEJB");
On a whim, I tried the old SCOTT/TIGER username/password and got the following
exception:
javax.naming.NoPermissionException: Not allowed to look up unify/nxj/controlCenters/occ/ControlCenterEJB,
check the namespace-access tag setting in orion-application.xml for details
So evidently, SCOTT/TIGER is in the security database used by the app (but isn't
authorized) while the ias_admin user is not in the security database.
I have the following questions:
1. In the default configuration, is there a username/password I can use to
lookup EJB homes in the jndi namespace of an OC4J instance? If so, what
is it?
2. Where is the security database? I tried looking in the web-based console
to find how to configure security and could not figure it out. I did find
the Security page for the application, but when I tried to add a user,
it had no effect. Furthermore, this page did not show a user entry for
SCOTT; hence, it doesn't seem that OC4J is actually using the information
on this page. This is strange because the path to this page is:
Farm > Application Server: ias_admin.lab10.sac.unify.com > OC4J: home > Application: UnifyoccEAR > Security
I then went to the Security page for the default application and found
that it did have a SCOTT user. So I added a new user and tried to run
my java client. This resulted in the javax.naming.AuthenticationException
described above (I was expected the NoPermissionException encounted when
using SCOTT/TIGER). Next, I used the Security page for the default application
to change the password for SCOTT and reran my java client using SCOTT/TIGER.
This time I was expecting an AuthenticationException exception, but got the
NoPermission exception. Therefore, it seems that OC4J isn't using this
security data either.
Hunting in the console (again) for the security database, I stumble accross
the Infrasturcture page and see an Identity Management section and see that
it is configure to use an Oracle Internet Directory server. Using
<ORACLE_HOME>/bin/oidadmin, I connect to the directory server and look
for the SCOTT user. I don't find it, so I believe that this can't be the
security database either.
3. Finally, how do I configure the OC4J instance such that it will allow
anonymous users to lookup my EJB from a java client?
Please help a confused and frustrated user.Looking at your example, it looks like you are using a J2EE client container or some properties file to specify the JNDI environment used to create the initial context (for you use the no-arg constructor to InitialContext). Since our application needs to the ability to dynamically connect to ejb's running on different Java application servers (e.g., WebLogic, WebSphere, JBoss), such an approach will not work. Instead we must do it the old-fashioned way and pass the jdni connection info to the InitialContext constructor.
In any event, our problem isn't how to write the connection code, it is how to test it. Specifically, we can't figure out a valid username/password that will allow us to look up the home. Nor can we figure out how to configure security for the oc4j instance. -
Does the weblogic server supports c++ corba client /IIOP?
hi:)
I have a c++ corba client interacts with WLS using IIOP. I am just wondering
what ORB i need to use 2) trsaction propagation 3 ) security
thankx,
suresh reddyI suggest trying the RMI IIOP newsgroup. I do not quite understand your
question.
Michael Girdley
Product Manager, WebLogic Server & Express
BEA Systems Inc
"Sunesh Kumra" <[email protected]> wrote in message
news:[email protected]...
Hi Michael,
Is it allowed to use your own multi-threaded library from within WLS ?Note that
the WLS Beans do not contain the threads, the threading part is in somelibrary
which the WLS Beans communicates with. Can the Helper classes which arepackaged
with the WLS Beans span threads of their own ?
Most importantly, is it allowed to use some vendor's ORB (for exampleOrbixweb)
within WLS because the thread created by the ORB might interfere with WLS
threads ??
Michael Girdley wrote:
2.1) CORBA client initiated transactions will not be supported,
everything else will workYes, that is my understanding.
2.2) None of the EJB security services will be available in EJB
method
called by a CORBA client (i.e. getCallerPrincipal() andisCallerInRole()
will fail)Yes, that is my understanding. I would suggest that you place this onthe
RMI IIOP newsgroup. The developers who write the code for this feature
actually hang out over there.
Thanks,
Michael
Michael Girdley
Product Manager, WebLogic Server & Express
BEA Systems Inc
"<=one way=>" <[email protected]> wrote in message
news:[email protected]...
1) We must support both C++ and Java clients that will be requesting
services from our EJBs running in WLS. The clients are internal appsrunning
in different companies and we would prefer to avoid requiring our
clients
to
use an ORB by a specific vendor. At the same time we do not want to
deal
with potential problems related to the implementation differences by
different ORB vendors. What would be the best way to handle thissituation?
2) WLS documentation has the following paragraph:
"WebLogic RMI over IIOP is the framework for EJB-to-CORBA mapping
support.
Currently, however, a standard for passing user identity -- requiredto
implement EJB-to-CORBA mapping -- does not exist and the requirementfor
transaction propagation from the client is in question. While RMI overIIOP
does allow CORBA clients to access EJBeans, the following services
will
not
be available:
EJB transaction services
EJB security services"
Does this mean that:
2.1) CORBA client initiated transactions will not be supported,
everything else will work
2.2) None of the EJB security services will be available in EJB
method
called by a CORBA client (i.e. getCallerPrincipal() andisCallerInRole()
will fail)
Thanks in advance
"Michael Girdley" <[email protected]> wrote in message
news:[email protected]...
Yes, check out the documentation on the RMI over IIOP on our web
site.
>>>>
Thanks,
Michael
Michael Girdley
Product Manager, WebLogic Server & Express
BEA Systems Inc
"indham inc" <[email protected]> wrote in message
news:[email protected]...
hi:)
I have a c++ corba client interacts with WLS using IIOP. I am justwondering
what ORB i need to use 2) trsaction propagation 3 ) security
thankx,
suresh reddy -
Hi,
I would like to know more about to CORBA clients (C++ & Java) accessing EJBs
in the weblogic cluster. We have an EJB deployed in the weblogic cluster,
when we are trying to access that EJB through CORBA client (Visibroker 5.1
ORB), will it return me a replica aware stub or there is no Fault tolerant
for CORBA clients.
TIA,
VikasHi Andy,
Thanks for your reply.
We have been calling EJBs using CORBA, the clients we have tested are C++ &
Java clients. So I don't understand when you said Java doesn't work well due
to some limitations. We are using the Visibroker ORB at the client side.
Now as we move forward, we hit a wall as far as HA of the whole system is
concerned. Are you aware of somebody using J2EE & CORBA in HA environment?
Since we have some friends in house who are C++ geeks & we do have some
legacy C++ code too. As you mentioned Tuxedo ORB, is it a fully functional
ORB, which version of OMG specs it comply with?
What happens in case if we want to invoke CORBA service from our EJBs
deployed in the weblogic cluster? What are the issues we have in HA for this
scenario?
Thanks,
Vi
"Andy Piper" <[email protected]> wrote in message
news:[email protected]...
"Vikas Chawla" <[email protected]> writes:
I would like to know more about to CORBA clients (C++ & Java) accessing
EJBs
>
C++ works fine (we recommend you use the WebLogic C++ Client (Tuxedo
ORB) since its free and works well). Java does not work at all due to
limitations in the Java IDL mapping spec (i.e. does not work for any
Vendor). Java clients should always use RMI to access EJB's.
in the weblogic cluster. We have an EJB deployed in the weblogic
cluster,
when we are trying to access that EJB through CORBA client (Visibroker5.1
ORB), will it return me a replica aware stub or there is no Faulttolerant
for CORBA clients.Fault tolerance in WLS is client driven and thus there is no support
for it in foreign ORBs. The next release of the WebLogic C++ client
(part of Tux 8.1) includes fault-tolerance and load-balancing which
you can use against WLS. This product will be free to WLS
licencees. You could probably get hold of a beta of this product. It
would also to be possible to implement fault-tolerance using
interceptors if your ORB is spec compliant (we do this with the JDK
1.4 ORB) but you would need to go through your account rep in order to
get details of the IOR and Service Context formats.
HTH
andy -
How do I call an ejb from a java client?
I put ejb classes in a jar file along with java client code and deployed it on my OC4J server. Now I am trying to run the ejb by calling the client code on my OC4J server from the command line but I am not having success. Am I doing this the right way? Should I also deploy my client code? Should the client code also be in a directory on my OC4J server?
MikeHi. Here is a part of the code for a java client. In this particular case it is also an EJB but it is a Message Driven Bean.
public class MDBEjbMecomsIFSBean implements MessageDrivenBean,
MessageListener {
// context
private MessageDrivenContext m_ctx = null;
// properties filename
private String m_propFile = DEF_PROPFILE;
// application
private String m_app;
// callable function from properties
// private String m_dsJndiName;
// private String m_dsType;
// private String m_dsFunc;
private int m_connRetryMax;
private int m_connRetryWait;
// initial stylesheet transformation file
private String m_xsltFile;
// web service operation name
private String m_operationName;
// trap emitter members from properties
private String m_trapMbeanURL;
private String m_trapObjectName;
private String m_trapAction;
private String m_trapAppName;
private Severity m_trapMax = Severity.CRITICAL;
private int m_trapAfterDelivery;
private boolean m_trapStart;
// jmx members for auto shutdown from properties
private String m_mdbMbeanURL;
private String m_mdbMbeanAccount;
private String m_mdbMbeanPassword;
private String m_mdbObjectName;
private String m_mdbAutoShutdown;
// clob allocator to be used by Oracle jdbc call
// private CLOB m_clob;
* Remember the context for this MDB.
* @param ctx the context for this MDB
public void setMessageDrivenContext(MessageDrivenContext ctx) {
logger.log(Level.FINEST, "Setting MessageDrivenContext");
m_ctx = ctx;
* ejbCreate() is called when the server wants to create a new instance of this MDB.
* At this time a connection with the target is established and the callable statement
public void ejbCreate() {
readProperties();
// Connection errors are IGNORED, because it seems that raising Exceptions from here
// does NOT result in a container managed rollback. Instead the dequeue is commited,
// resulting in AQ message status 2 (success).
// By ignoring the fault, another Exception will occurr in onMessage(), from where
// a propagated exception DOES result in a rollback.
String logStr = "Started TenneT-MDB-" + m_app;
logger.log(Level.FINEST, prefixLog(logStr));
if (m_trapStart)
notify(Severity.NORMAL, logStr);
* This method is called whenever a message is sent to the queue associated with this MDB.
* @param msg assumed to be a javax.jms.TextMessage containting an xml string
public void onMessage(Message msg) {
* msg id, timestamp and length are logged at info level
* msg content is logged at debug level
String msgText = "uninitialized";
String msgId = "undefined";
int msgDeliveryCount = 0;
// this block retrieves msg info from the jms header
// errors are logged as info and ignored
try {
// get msgid first so any subsequent error can be associated with the msg
msgId = msg.getJMSMessageID();
logger.log(Level.FINE, prefixLog("MessageID: " + msgId));
logger.log(Level.FINE,
prefixLog("Enq_time : " + msg.getJMSTimestamp()));
// delivery count can be used to send a critical trap only on the last retry
if (msg.propertyExists(JMS_X_RCV_TIMESTAMP)) {
logger.log(Level.FINE,
prefixLog("Deq_time : " + msg.getIntProperty(JMS_X_RCV_TIMESTAMP)));
// delivery count can be used to send a critical trap only on the last retry
if (msg.propertyExists(JMS_X_DELIVERY_COUNT)) {
msgDeliveryCount = msg.getIntProperty(JMS_X_DELIVERY_COUNT);
logger.log(Level.FINE,
prefixLog("DeliveryCnt: " + msgDeliveryCount));
} catch (Exception e) {
String errStr =
"Minor exception in JMSConsumeMDBBean.onMessage() receiving msg \"" +
msgId + "\": " + e.getMessage();
logger.log(Level.SEVERE, prefixLog(errStr));
// next the message content is addressed
try {
TextMessage message = (TextMessage)msg;
msgText = message.getText();
logger.log(Level.FINE,
prefixLog("MessageLength: " + msgText.length()));
logger.log(Level.FINEST, prefixLog("Msg: " + msgText));
} catch (Exception e) {
String errStr =
"Error in JMSConsumeMDBBean.onMessage() retrieving msg \"" +
msgId + "\": " + e.getMessage();
logger.log(Level.SEVERE, prefixLog(errStr));
notify(Severity.CRITICAL, errStr);
throw new EJBException(errStr);
// From now we can do intial stylesheet transformation if necessary
try {
// Prepare input
XMLDocument xslInput;
XMLDocument xmlInput;
DOMParser parser = new DOMParser();
parser.setPreserveWhitespace(true);
// Parse XSL
parser.parse((MDBEjbMecomsIFSBean.class.getResourceAsStream(m_xsltFile)));
xslInput = parser.getDocument();
// Parse XML
parser.parse((Reader)new StringReader(msgText));
xmlInput = parser.getDocument();
// Instantiate XSL Processor
XSLProcessor processor = new XSLProcessor();
XSLStylesheet stylesheet;
stylesheet = processor.newXSLStylesheet(xslInput);
XMLDocumentFragment xmlOutput =
(XMLDocumentFragment)processor.processXSL(stylesheet,
xmlInput);
// Now prepare xml for use with entity bean
Document xmlDoc = new XMLDocument();
xmlDoc.appendChild(xmlOutput);
*// Invoke Entity Bean to perform lookup of destination Web Service*
Context ctx;
ctx = new InitialContext();
EBEjbMecomsIFSLocalHome ebOppIfsLH =
*(EBEjbMecomsIFSLocalHome)ctx.lookup("java:comp/env/ejb/local/EBEjbopp_ifs");*
EBEjbMecomsIFSLocal ebOppIfs;
ebOppIfs = ebOppIfsLH.create();
*// pass message content to entity bean*
ebOppIfs.setXMLmessage((Element)xmlDoc.getDocumentElement());
*// provide correct soap action*
ebOppIfs.setOperationName(m_operationName);;
*// do actual work*
ebOppIfs.doWork();
} catch (XSLException e) {
logger.log(Level.INFO,
prefixLog("XSL Exception during onMessage " +
e.getMessage()));
} catch (SAXException e) {
logger.log(Level.INFO,
prefixLog("SAX Exception during onMessage " +
e.getMessage()));
} catch (CreateException e) {
logger.log(Level.INFO,
prefixLog("Create Exception during onMessage " +
e.getMessage()));
} catch (NamingException e) {
logger.log(Level.INFO,
prefixLog("Naming Exception during onMessage " +
e.getMessage()));
} catch (IOException e) {
logger.log(Level.INFO,
prefixLog("IO Exception during onMessage " + e.getMessage()));
private void notify(Severity severity, String message) {
logger.log(Level.FINEST,
prefixLog("Started method notify() with severity level " +
severity));
try {
if (m_trapMbeanURL == null || m_trapMbeanURL.equals("")) {
logger.log(Level.WARNING,
prefixLog("No MBean URL! Skipping SNMP trap."));
} else {
logger.log(Level.INFO,
prefixLog("Setting up JMX connection with " +
m_trapMbeanURL));
ObjectName delegateName = null;
MBeanServerConnection mbsc = null;
try {
JMXServiceURL jmxServiceURL =
new JMXServiceURL(m_trapMbeanURL);
JMXConnector connector =
JMXConnectorFactory.connect(jmxServiceURL);
mbsc = connector.getMBeanServerConnection();
delegateName = new ObjectName(m_trapObjectName);
logger.log(Level.FINEST,
prefixLog("JMX connection established with " +
m_trapMbeanURL));
} catch (Exception ex) {
logger.log(Level.SEVERE,
prefixLog("Error while initializing JMX Server connection"),
ex);
throw new EJBException("Error while initializing JMX Server connection",
ex);
String localHost = null;
try {
InetAddress addr = InetAddress.getLocalHost();
localHost = addr.getCanonicalHostName();
logger.log(Level.FINEST,
prefixLog("Localhost=" + localHost));
} catch (UnknownHostException ex) {
logger.log(Level.SEVERE, prefixLog(ex.getMessage()), ex);
throw new EJBException(ex.getMessage(), ex);
// invoke the trapemitter
try {
if (mbsc != null) {
if (severity.ordinal() > m_trapMax.ordinal()) {
severity = m_trapMax;
String severityArg = severityMap.get(severity);
Object[] arguments =
{ severityArg, message, m_trapAppName, localHost };
String[] signature =
{ "java.lang.String", "java.lang.String",
"java.lang.String", "java.lang.String" };
mbsc.invoke(delegateName, m_trapAction, arguments,
signature);
logger.log(Level.INFO,
prefixLog("TrapEmitter invoked: severity=" +
severityArg + " - message=" +
message));
} else {
logger.log(Level.SEVERE,
prefixLog("Error: No MBean server connection established with " +
m_trapMbeanURL));
} catch (MBeanException e) {
logger.log(Level.SEVERE,
prefixLog("Error occured in invoked method"),
e);
} catch (ReflectionException e) {
logger.log(Level.SEVERE, prefixLog(e.getMessage()),
e.getCause());
} catch (IOException e) {
logger.log(Level.SEVERE,
prefixLog("A communication problem occurred when talking to the MBean server"),
e);
} catch (InstanceNotFoundException e) {
logger.log(Level.SEVERE,
prefixLog("The MBean specified is not registered in the MBean server."),
e);
} catch (Exception e) {
logger.log(Level.SEVERE,
prefixLog("Error in method notify. Handling resumes..."));
} finally {
if (severity.equals(Severity.CRITICAL)) {
stopConsuming();
private void stopConsuming() {
logger.log(Level.FINEST, prefixLog("Started method stopConsuming()"));
if ("true".equals(m_mdbAutoShutdown)) {
if (m_mdbMbeanURL == null || m_mdbMbeanURL == "") {
logger.log(Level.WARNING,
prefixLog("No MDB MBean URL! Skipping stopConsuming()."));
} else {
JMXConnector jmxCon = null;
try {
Hashtable<String, String> credentials =
new Hashtable<String, String>();
credentials.put("login", m_mdbMbeanAccount);
credentials.put("password", m_mdbMbeanPassword);
// Properties required to use the OC4J ORMI protocol
Hashtable env = new Hashtable();
env.put(JMXConnectorFactory.PROTOCOL_PROVIDER_PACKAGES,
"oracle.oc4j.admin.jmx.remote");
env.put(JMXConnector.CREDENTIALS, credentials);
JMXServiceURL serviceUrl =
new JMXServiceURL(m_mdbMbeanURL);
jmxCon =
JMXConnectorFactory.newJMXConnector(serviceUrl, env);
jmxCon.connect();
MBeanServerConnection mbs =
jmxCon.getMBeanServerConnection();
logger.log(Level.FINEST,
prefixLog("JMX connection established with " +
m_mdbMbeanURL));
ObjectName objectName = new ObjectName(m_mdbObjectName);
MessageDrivenBeanMBeanProxy MDBMBean =
(MessageDrivenBeanMBeanProxy)MBeanServerInvocationHandler.newProxyInstance(mbs,
objectName,
MessageDrivenBeanMBeanProxy.class,
false);
MDBMBean.stop();
logger.log(Level.WARNING,
prefixLog("Message consumption suspended"));
} catch (Exception ex) {
logger.log(Level.SEVERE,
prefixLog("Error while initializing JMX Server connection"),
ex);
throw new EJBException("Error while initializing JMX Server connection",
ex);
} else {
logger.log(Level.WARNING,
prefixLog("No AutoShutdown. property=false"));
* Called when the server no longer wants to keep this MDB instance.
* Closes the connection and statement objects created in <code>ejbCreate</code>.
public void ejbRemove() {
try {
cleanup();
} catch (Throwable t) {
logger.log(Level.SEVERE,
prefixLog("Error in ejbRemove(): " + t.getMessage()));
/* Cleanup resources cleanly */
private void cleanup() {
logger.log(Level.INFO, prefixLog("TenneTMDB.cleanup() called."));
// m_dsService = null;
// m_dsCall = null;
private String prefixLog(String logText) {
String logPrefix = "%" + m_app + ": ";
//System.out.println(logPrefix + logText);
return logPrefix + logText;
private void logCause(Throwable e, LogLevel logLevel) {
int i = 0;
String causeStr;
Throwable exception = e.getCause();
while (exception != null) {
i++;
causeStr = "Cause " + i + ": " + exception.getMessage();
switch (logLevel) {
case INFO:
logger.log(Level.INFO, prefixLog(causeStr));
break;
case WARN:
logger.log(Level.WARNING, prefixLog(causeStr));
break;
case ERROR:
logger.log(Level.SEVERE, prefixLog(causeStr));
exception = exception.getCause();
} -
IllegalArgumentException while accessing an EJB with a servlet client
Dear All,
Hey,
I am facing some problems while accessing a deployed stateless ejb. Following is how my application is being accessed:
WEBAPP CLIENT
caller.html ------->> DisplayServletClient --------->> DisplayServlet
(Simple HTML Page) (Servlet which performs lookup) (The actual bean)
CONSOLE CLIENT
DisplayConsoleClient --------->> DisplayServlet
(Simple Console Client) (The actual bean)
I am using the J2EE reference implementation, the ejb bean is successfully deployed. The console client successfully, access the ejb. But when I try to access the ejb using the webapp client, I get the following exception:
======= EXCEPTION ENCOUNTERED ============
Application DisplayApp deployed.
Servlet Entered
HTML Content Type Set
PrintWriter Object Created
Context Object Created
Exception in Servlet Client Code: java.lang.IllegalArgumentException: Unknown co
mponent type
java.lang.IllegalArgumentException: Unknown component type
at com.sun.enterprise.naming.NamingManagerImpl.getComponentType(NamingMa
nagerImpl.java:670)
at com.sun.enterprise.naming.NamingManagerImpl.getMangledIdName(NamingMa
nagerImpl.java:708)
at com.sun.enterprise.naming.NamingManagerImpl.getComponentIdInternal(Na
mingManagerImpl.java:680)
at com.sun.enterprise.naming.NamingManagerImpl.getComponentId(NamingMana
gerImpl.java:313)
at com.sun.enterprise.naming.java.javaURLContext.getComponentContext(jav
aURLContext.java:397)
at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.j
ava:51)
at javax.naming.InitialContext.lookup(InitialContext.java:350)
at DisplayServletClient.service(DisplayServletClient.java:27)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServl
et.java:428)
at org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java
:180)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.access$0(ApplicationF
ilterChain.java:197)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilt
erChain.java:176)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:172)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:215)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:566)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve
.java:246)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:
2314)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:164)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:566)
at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.ja
va:368)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:163)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcesso
r.java:995)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.ja
va:1088)
at java.lang.Thread.run(Thread.java:484)
======== EXCEPTION END ===========
Tweaking with the servlet client code, I have discovered that it is failing to perform a correct lookup. Can anybody suggest any remedy? My Source code is below:
=========================================================
============ Remote Interface START ==============
// The DisplayApp Remote Interface File
import javax.ejb.*;
import java.rmi.*;
public interface Display extends EJBObject
public String display() throws RemoteException;
============ Remote Interface END ==============
============ Home Interface START ==============
// The DisplayApp Home Interface File
import javax.ejb.*;
import java.rmi.*;
public interface DisplayHome extends EJBHome
public Display create() throws RemoteException, CreateException;
============ Home Interface END ==============
============ Bean Class START ==============
// The DisplayApp Bean Class File
import javax.ejb.*;
import java.rmi.*;
public class DisplayBean implements SessionBean
public String display() throws RemoteException
System.out.println("The Server Side Response");
return "Hello, Me a New Friend";
public void ejbCreate(){}
public void ejbRemove(){}
public void ejbActivate(){}
public void ejbPassivate(){}
public void setSessionContext(SessionContext ctx){}
============ Bean Class END ==============
========== Console Client Class START ======
// The Display Console Client Class File
import javax.ejb.*;
import javax.rmi.*;
import javax.naming.*;
import Display;
import DisplayHome;
public class DisplayConsoleClient
public DisplayConsoleClient()
try
Context initial=new InitialContext();
Object objref=initial.lookup("java:comp/env/DisplayJNDI");
DisplayHome home=(DisplayHome)PortableRemoteObject.narrow(objref, DisplayHome.class);
Display ref=home.create();
System.out.println("Client Side: "+ref.display());
ref.remove();
catch(Exception ex)
System.out.println("Exception in Client Code: "+ex);
ex.printStackTrace();
public static void main(String args[])
new DisplayConsoleClient();
========== Console Client Class END ======
========== Servlet Client Class START ======
// The DisplayApp Servlet Client Class File
import javax.ejb.*;
import javax.rmi.*;
import javax.naming.*;
import Display;
import DisplayHome;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class DisplayServletClient extends HttpServlet
private PrintWriter out;
public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
try
System.out.println("Servlet Entered");
response.setContentType("text/html");
System.out.println("HTML Content Type Set");
out=response.getWriter();
System.out.println("PrintWriter Object Created");
Context initial=new InitialContext();
System.out.println("Context Object Created");
Object objref=initial.lookup("java:comp/env/ejb/DisplayWEBJNDI");
System.out.println("Lookup Done Successfully");
DisplayHome home=(DisplayHome)PortableRemoteObject.narrow(objref, DisplayHome.class);
System.out.println("Home Object Created");
Display ref=home.create();
System.out.println("Remote Object Created");
out.println("<html><title>The Results Page</title>");
out.println("<body<hr>");
out.println("<h1>The Client Side Response is: ");
out.println(ref.display());
out.println("</h1>");
out.println("<hr>");
out.println("</body></html>");
System.out.println("Responses Done");
out.flush();
System.out.println("Output Stream Flushed");
ref.remove();
System.out.println("Remote Object Removed");
catch(Exception ex)
System.out.println("Exception in Servlet Client Code: "+ex);
ex.printStackTrace();
========== Servlet Client Class END ======
========== Calling HTML File START ======
<html>
<body>
<hr>
<form method="get" action="/servlet/DisplayServletClient">
<input type="submit" name="submit" value="Call Now!">
</form>
<hr>
</body>
</html>
========== Calling HTML File END ======
=========================================================
Since, the descriptors were automatically generated, I have not included them here. Also, I did not build the war, jar, ear files myself, they were automatically generated by the deploytool.
Please help!!
Thanks & Bye,
Tualha KhanHey,
This was the latest code snippet which I used in the Servlet file.
========================
try
System.out.println("Servlet Entered");
response.setContentType("text/html");
System.out.println("HTML Content Type Set");
out=response.getWriter();
System.out.println("PrintWriter Object Created");
InitialContext initial=new InitialContext();
System.out.println("Context Object Created");
Object objref=initial.lookup("DisplayWEBJNDI");
System.out.println("Lookup Done Successfully");
DisplayHome home=(DisplayHome)PortableRemoteObject.narrow(objref, DisplayHome.class);
System.out.println("Home Object Created");
Display ref=home.create();
System.out.println("Remote Object Created");
out.println("<html><title>The Results Page</title>");
out.println("<body<hr>");
out.println("<h1>The Client Side Response is: ");
out.println(ref.display());
out.println("</h1>");
out.println("<hr>");
out.println("</body></html>");
System.out.println("Responses Done");
out.flush();
System.out.println("Output Stream Flushed");
ref.remove();
System.out.println("Remote Object Removed");
========================
The Response was
========================
Servlet Entered
HTML Content Type Set
PrintWriter Object Created
Context Object Created
Exception in Servlet Client Code: javax.naming.NameNotFoundException: DisplayWEB
JNDI not found
javax.naming.NameNotFoundException: DisplayWEBJNDI not found
<<no stack trace available>>
========================
So what else should I do???
Thanks & Waiting,
Tualha Khan
Maybe you are looking for
-
Can't figure out what will make this work....
So I have a Verizon Wireless USB modem for internet access, and I have to turn off airport in order to gain access to the internet (some issue with VZW). And I can't have the modem plugged into anywhere but on the computer itself. So, I connected the
-
Email notification issue in p6 eppm 8.3
Hi, I have installed the p6 eppm 8.3 and i have configured the email notification too. I can send the notification for running reports in p6 eppm. But while assigning resource its showing an error like your email server has not been configured please
-
For loop in JavaBean????
for(int i=1;i<records;i++) i declare the variable records... but no response frm this for loop.... if i change to for(int i=1;i<10;i++) it works....how to use variable in the for loop???
-
Does anyone here use a usb to RS-422 adapter for machine control?
I'm looking to insert sweetened audio via fire-wire but inserting via FW doesn't seem to be a viable option. If anyone is using an adapter please post your experiences. 2 GHz Power PC G5 Mac OS X (10.4.8) 2GB Ram
-
Iweb would not update the title
My iweb would not update the title of one of my website pages. All other updates went through but this one. I even deleted the page and did it again and it refuses to appear right after published. It also shows an error 404 in the page when published