I am trying to make an Enterprise Application but facing a very strange error.
Java Interview Questions Remote Method Invocation (RMI) Java Interview Questions: Remote Method Invocation (RMI) What is RMI? The Java Remote Method Invocation (Java RMI) is a Java API that performs the object-oriented equivalent of remote procedure calls (RPC), with support for direct transfer of serialized Java classes and distributed garbage collection. RMI (Remote Method Invocation) menyediakan sarana dimana client dan server dapat berkomunikasi dan saling bertukar infomasi.RMI memungkinkan pengembang perangkat lunak untuk merancang aplikasi terdistribusi dimana methods dari remote object dapat dipanggil dari JVM (Java Virtual Mechine) lain, yang mungkin berjalan pada host yang berbeda.
Whenever i try to call enterprise application's facade from any class other than Main, I am get an InvocationTargetException.
Here is my code: -
Test Class: -
Method in BillerFacade: -
Stack Trace: -
Why it's like that? and sometime even i am calling the remote method from my Main class it still gives me this Exception. What's the matter with Netbeans? Sometime it works sometime it doesn't. Please Help and clear my confusion.
VarundroidVarundroid
1 Answer
According to this stackoverflow discussion and the referenced EJB specification,
static
injection is only allowed in the application main class. Therefore, the injection works for your TellerMachine
class but not for called TestClass
instance from within the TellerMachine
main
method.Community♦
kraftankraftan