Duggle EJB (3)

xiaoxiao2021-03-06  80

Are everything is over? Don't worry, just come to the time, don't you think there is an IP, have a port even better? Unfortunately, the document does not give us an answer. With the front result, we continue to move forward. The port is often dancing with IP, then we will start from "org.omg.corba.orbinitialhost". Since it can work, it is obvious that this string should be in the code. I don't expect it, and "Org.comg.Corba.orbinitialPort" appeared. Add a paragraph in the code: System.SetProperty ("org.omg.corba.orbinitialport", "1050"); if the test is tested, use 1050 and there is almost no difference because it is the default port. Change it easily, but also changed the port of Server to verify our ideas. With the previous exploration, find a simple configuration of the Server configuration. Eventually I lock the target on config / orb.properties. A Port and a host. Change Port, restart Server, from printing information, I am convinced that my change is successful. CLIENT, run! OK!

We already know the purpose, but that host? Can I start IP that can be tied to others? Strong curious heart makes me temporarily shift the original track, change IP, nothing, it still can start, turn it off! Discover the problem! Turning off is not the server of the machine, but is a server on the machine specified by Host, it is doing this.

Back to the original road. There is already IP and ports, and the URL specified in Context.Provider_URL also involves IP and ports, what is the meaning? Deleted it, try it. The code is still working well.

Let's take a look at HelloWorldappClient.jar, after adding it to ClassPath, we almost forgot its existence. In J2EE TUTORIAL, HelloWorldClient is also hit this JAR file, we write itself is a client, then what is this client? It turns out that it is a standard trust, useless, deleting it for the overall situation. Now look at HelloWorldAppClient.jar, only classes closely associated with EJB, a lot of clean!

What is the problem? I still remember that when we started, change the reference name to the JNDI name! I want to change it back. The same starts with an abnormality, finding the call against the flow, step by step, solves the problem. Comparison directly runs with Runclient, it is easy to find the difference between the two, and step forward. Runclient is actually just a batch file, where I am the core of my core is the following look:% java_command% com.sun.Enterprise.Appclient.main% *% java_command% is equivalent to our common java command, that is actually This sentence is to run com.sun.Enterprise.AppClient.main. Compared with direct operation, the difference between the two is definitely RunClient set something in the previous period, so that the code can eventually run well, so directly calls you to do this.

When I added some new code in the code, I decided to give up. Not a problem, it is unable to solve, but some settings found in the differences are closely related to some of the J2EE RIs. If the way to set the properties in front is that I can accept, then here is completely destroyed the kind of beauty in the code. In this way, even if it can eventually be completed, it has lost its meaning. I want to come, I originally "calling remote EJB" has reached, and in my future code will run on the application server, these settings work application servers can be done well for me, I don't have to pay attention.

Finally, I want to warn a friend who is interested in trying, all the code in front is done on J2EE RI, and there is still a difference between the specific application servers. Ok, a fightener ends.

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

New Post(0)