Duggle EJB (2)

xiaoxiao2021-03-06  87

Our ultimate goal is to call EJB on different machines, and the experience is distributed below. On another machine, set up a server, deploy EJB, then change the IP in the Client code, ready, run! Did you make it? I expect to fail. If you see the distance from the remote, don't excite, see if you still run a J2EE RI on the machine running the Client? What does I adjust the remote EJB, and what is the relationship with the server I have? Don't take this first, close it. Congratulations, the code is finally failed.

Who is willing to face failed? There is a problem, we have to do it. Abnormal prompt is a good starting point. javax.naming.CommunicationException: Can not find SerialContextProvider at com.sun.enterprise.naming.SerialContext.getProvider (SerialContext.java:63) at com.sun.enterprise.naming.SerialContext.lookup (SerialContext.java:120) at Javax.naming.initialContext.lookup (Unknown Source) ... Obviously, this is not a good tip, because we can't get more through exception information, but we know the incorrect class. Fortunately, Sun's J2EE RI source code is open, so I saved the trouble of compiling Class files. Open com.sun.enterprise.naming.serialcontext, find getProvider, one of the debug variables caused my interest, this is a debug logo, just put it as true, some debugging information will flow out. I definite my own ideas, change Debug, but how to compile the source code? I don't want to spend my heart to compile J2EE RI huge source code. After all, I need it just to change one of them, not to study the entire J2EE RI.

Waving yourself to use the magic weapon, build it in your IDE, after establishing a project, directly adding the JAR file containing the target class (possibly some comparison JAR files), which compiles the entire content required by this class. All have. Take my target class, follow the package structure into the project, this code should be properly compiled. So my change begins to play a role in playing the changed Class file.

Through changes, we can more information. Org.omg.corba.comm_failure: VMCID: Sun Minor Code: 201 Completed: no at com.sun.corba.ee.internal.iip.connectionTable.GetConnection (connectionsTable.java: 176) at com.sun.corba.ee. InterNal.iop.ConnectionTable.getConnection (connectionTable.java: 68) at com.sun.corba.ee.internal.iip.giopimpl.getConnection (GiopImpl.java: 70) ... CORBA error? Yes, CORBA. This is not very easy to do, although I have heard of the thousands of things between EJB and CORBA, but I am a standard CORBA door. After the decision is determined, after learning CORBA, I decided to continue to dig the problem with the previous method.

The result of counterflow is that I found this information. com.sun.corba.ee.internal.iip.giopimpl (thread [main, 5, main]: getndpoint (iiop_clear_text, 0, null) com.sun.corba.ee.internal.iop.giopImpl (Thread [main, 5, main]): Createlistener (sockettype = iiop_clear_text port = 0) com.sun.corba.ee.internal.iiop.connectionTable (Thread [main, 5, main]): Client Get Called: Host = localhost port = 1050 COM .sun.corba.ee.internal.iiop.ConnectionTable (Thread [main, 5, main]): Exception java.lang.RuntimeException: Connection refused: connect while creating socket for new connection: aborting connection com.sun.corba.ee .international.iip.ConnectionTable (Thread [main, 5, main]: deleteconn Called: host = localhost port = 1050 com.sun.corba.ee.internal.iiop.connectionTable (Thread [main, 5, main]: Client Get Called: Host = localhost port = 1050 is very strange! The localhost appeared here. In the intuition, we clearly write a calling remote EJB in the code, and there should be no localhost. The truth is such a strange, when the call is called, I will first take Localhost first. This is why if a J2EE RI of this machine, we can see the greetings from the distance. Just when I doubt it, I don't know how to go next step, I am not intentional to give my new direction. I turned up the J2EE RI supported document. Yes, I have been exploring it. In J2EE SDK Tools documents, there is a section in Runclient's explanation, its title is "Accessing A Remote Server", apparently this is a very big touch. It refers to an attribute "org.omg.corba.orbinitialhost". Set this attribute to access remote EJB? ? ? What are you waiting for? We know that in the Java runtime, you have the same effect as the same attributes in the code with SYSTEM.SETPROPERTY directly in the code, so this will appear in the code: System.SetProperty ("Org.omg.Corba.orbinitialHost", "xxx .xxx.xxx.xxx "); run, pray! The greetings from the distance finally appeared in front of me, that excitement believes that the programmer is still willing to feel the feelings of numerous times. I am willing to put this feeling with drug addiction, it is completely addiction. This is this addiction, I am willing to meet again and again, overcome one of the difficulties.

转载请注明原文地址:https://www.9cbs.com/read-108080.html

New Post(0)