-
1. Re: Can delphi call EJB running in jboss ?
ipozeng Aug 8, 2002 10:46 PM (in response to ipozeng)JAsta and JBoss
While Java has been less then perfect as a client, it's certainly hard to top when it comes to
servers. In fact J2EE servers are fast becoming a commodity which support EJBs largely in a
plug-and-play fashion.
Asta's origin includes technology which allows the developer to quickly build thin fast rich
clients capable of accessing a wide variety of RDBMS servers residing on Windows and
non-Windows platforms. Asta servers support client applications running on Windows, Palm, and
Win CE.
As Asta continues to evolve, it is natural to introduce a technology which allows a J2EE server
to directly support a native Windows client.
As is depicted in the diagram below, JAsta extends the Asta functionality to include an EJB
client API. This new API calls JAsta on the J2EE server which in turn calls the EJB.
The "magic" behind the scenes is a servlet which in turn calls a proxy service. This service,
the heart of JAsta, calls the EJB as needed making certain stateless and stateful, local and
remote, session and entity EJB functionality is all available to the native Windows
applications. Of course all this happens "efficiently over the wire" in a manner which has
become synonymous with Asta.
Java Application Servers are the proven choice for Enterprise Application Servers and
Enterprise Java Beans are the accepted method of coding Java Application Servers. Why not use
Java where it belongs, on the server, with small, fast Windows thin clients?
JAsta and JBoss
The JBoss configuration tested includes Tomcat. As of this writing the current stable versions
of the JBoss-Tomcat distribution is JBoss 2.4.4 and Tomcat 4.0.1 (Catalina). I suspect it's
possible to use the JBoss which does not include Tomcat (or Jetty) to get JAsta running with
JBoss (and it may even be easier for some) but I prefer the combination distribution because it
does work "as-is".
Theoretically JBoss itself offers effortless deployment of EJBs. I have found this to be close
to truth when it comes to practice.
by Carl Mosca
The best programmer I know and I used to debate about good theories which cannot be put into
practice. He always argued they are not really good theories if they could not be put into
practice. I still won't admit I might have been wrong because I can't give up on the semantics
I think we were really debating.
Anyhow the jasta.war file is just about all it takes to get JAsta going on JBoss. This file
(jasta.war) should be copied into the deploy directory like any other package/bean/war one
might want to deploy. Because the magic of JAsta starts with a call to a servlet and we are
using Tomcat, it's also important to put a copy of jndi.properties in Tomcat's conf directory
or in the CLASSPATH. On our test environment this is the catalina/conf directory under the
JBOSS_DIST directory.
Now that we've got the quick-and-dirty what's needed for your average JBoss-aware developer,
let's start at the beginning. By the way I am working on a Win2000 machine.
What's needed?
* JBoss (the distribution with Tomcat) from jboss.org
* JDK 1.3+
Before you attempt to install JBoss you should have the JDK installed and make certain your
JAVA_HOME environment variable is set. If you are just getting started with Java a visit to
Sun's tutorials on setting up a Java development environment (on any platform) will be worth
the trip. I am going to assume the JDK 1.3+ is installed and usable.
To install JBoss, unzip the distribution archive into the directory of choice.
by Carl Mosca
I used the default name which includes the version of JBoss and Tomcat. If I were on my Linux
box I'd create a symbolic link to the directory but here in Win32 land I'll keep the ten-dollar
directory name and use environment variables when I am at the command-line.
In my case I unzipped to D:\ and I ended up with my top level JBoss directory being
D:\JBoss-2.4.4_Tomcat-4.0.1 (which I have pointed to by the JBOSS_DIST environment variable for
convenience). So after you unzip JBoss, I recommend adding a system environment variable called
JBOSS_DIST. This should point to the directory to which JBoss was unzipped. Therefore if you
change to %JBOSS_DIST% you should see two directories called jboss and catalina.
In case you are not familiar with adding environment variables here's a quick explanation. Go
to your desktop and right-click the "My Computer" icon. Select "Properties" and then go to the
"Advanced" tab. Click the "Environment Variables" button and then click the "New" button under
the list box which contains "System Variables". The variable name in this case is "JBOSS_DIST"
(without the double quotes). The variable value in my case is "D:\ JBoss-2.4.4_Tomcat-4.0.1"
(again no quotes). After you click the "Ok" button the environment variable will be saved. The
*next* time you open a command prompt (I tend to live with at least one open), it will have the
new variable set.
Change to the jboss\bin directory and type "run_with_catalina".
Press enter and assuming the JDK and JBoss installation are OK, JBoss will start. You will see
a bunch of messages (which may be reviewed in the server.log file found in the
%JBOSS_DIST%\jboss\log directory) and then finally the "JBoss started" message (or something
close to that) will appear. At some point you should review the log just so you'll become
familiar with it. If there are any startup or deployment problems you will want to start there.
Now that we've see it run, let's terminate the server by pressing Ctrl-C. After some more
messages fill the screen and add to the log file, the "Shutdown complete" message will appear.
This is followed by a "Terminate batch job (Y/N)?" prompt. Enter "Y" to terminate.
The JAsta demo comes with two files we need to copy to the JBoss deployment directory in order
to make the demo run. The first one is jasta.war (JAsta itself) and the second one is
JAstaEjbDemo.jar (the demo EJB we are going to call from our Delphi app).
Copy these two files to the %JBOSS_DIST%\jboss\deploy directory.
Because tomcat needs the access to the EJB interface we are also going to copy JAstaEjbDemo.jar
to the tomcat/lib directory. In our case this is the %JBOSS_DIST%\catalina\lib directory. Now
that we have JAsta and our demo EJB installed we can restart JBoss (actually JBoss will deploy
without restarting). Remember go to the %JBOSS_DIST%\bin directory and type "run_with_catalina"
to get JBoss started.
Now it's time to run our JAsta Delphi client. Go to the JAsta demo directory and type
"JAstaTestClient". You will see a windows application that looks like this.
If you are running JAsta on the same machine and you have not modified the port settings, click
the "Setup Connection" button.
by Carl Mosca
If you are running the client and server on separate machines, enter the address in the JBoss
Server text box before clicking the "Setup Connection" button.
Now click the "Access EJB Server" tab and then click the "Create EJB" button.
You should see a message which says "Created EJB Handle" at this point. If you go back to the
shell (DOS box) in which JBoss is running you will see some activity there are well. Again the
messages here are also recorded to the JBoss log.
Now go back to the demo application and click the "Credit/Debit Amount" button. You will then
see a message indicating the current balance. Repeat the operation and you should see an
additional increase in the balance.
There you have it. An EJB running on JBoss and accessed from a native Windows app via JAsta!
Does any one use JAsta ? -
2. Re: Can delphi call EJB running in jboss ?
ipozeng Aug 20, 2002 2:42 AM (in response to ipozeng)JAsta is too expensive for us to use it :(
I really hope com-bridge would help us however it seems no one here is interested in it !
What we really want to do is using jboss instead of com+ to host the business components.Of course we do need to remain the GUI client developed by delphi.
I am frustrated now.please help me out !
thanks in advance ! -
3. Re: Can delphi call EJB running in jboss ?
ipozeng Aug 21, 2002 11:56 PM (in response to ipozeng)It seems this is a difficult question.Let us put a breakpoint on line "bean := home.create()".When the program stops at that line we press ctrl+alt+c to enter assembly window.The following is the code snippet:
...
push $0044c0e4
lea eax,[ebp-$10]
push eax
lea eax,[ebp-$40]
push eax
call VarDispProc ; raise error here
add esp,$0c
lea edx,[ebp-$40]
lea eax,[ebp-$20]
call @OleVarFromVar
...
So it should be delphi's problem.What can i do now ? -
4. Re: Can delphi call EJB running in jboss ?
vorlon Aug 23, 2002 1:32 PM (in response to ipozeng)I don't know if this helps you, or if it even works - but did you think about accessing EJBs running on JBoss through CORBA? JBoss 3 seems to include a CORBA ORB, which should be accessible from Borland Delphi.
-
5. Re: Can delphi call EJB running in jboss ?
ipozeng Sep 4, 2002 11:43 PM (in response to ipozeng)Thanks for your answer !
Now i give j2ee-cas-bridge thoroughly because i feel sun will not support it in the future.
For delphi to use corba,we need to install visbroker on client side.it is complicated :(
I have tested web service and i feel web service have NOT solved interoperability very well : the delphi client can call web service developed using delphi however it cannot call web service developed using apache-axis :(
Now i find a solution for delphi to call EJB which needs to be tested in the future. I feel it should work :)
I will use a servlet as a gateway to ejb.The delphi client will use standard HTTP protocol to access the servlet which will package data from EJB to xml format and return it to the client.
Best Regars!