This week's book giveaway is in the Testing forum.
We're giving away four copies of The Way of the Web Tester: A Beginner's Guide to Automating Tests and have Jonathan Rasmusson on-line!
See this thread for details.
Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
    Bookmark Topic Watch Topic
  • New Topic

EJB help, very confused with gui's and JFrames with J2EE

stewart ridgway
Posts: 2
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi im in need of some help with a J2EE application im working on. I need to develop a JFrame front-end GUI client that will talk to the server, however i am not sure how to use JFrame to invoke methods on the server. This is mainly because im struggling to understand how I can call a method on the client side that will call a method on the server side when it appears to me that the client doesn't have a handle on the server-side (If that makes sense?)

I have crawled the web for some examples(including sun) but I still cannot find a tutorial.

I think my biggest problem is where I access the bean and how I can use it to set the JLabel to "hello World"
So I created a simple 'Tester' package that had a stateless session bean with one method which was to return a String. When the client GUI clicked a JButton its JLabel updated to the value. I initially created all of the code without a JFrame and compiled it using ant, and it worked fine (printing to the console).

Then I added some JFrame code to the frontend, but I got 28 error messages when I did so. My real questions are how to call methods on the bean and where I do this, take a look at the 'actionPerformed' method I call on the beans method here but it causes an error, also Im stuck as to where I must place the IntitialContext and EJB creation/casting/JNDI lookup stuff in the class.

I can write all the server-side/business methods its just the GUI im getting stuck on(this is just a testing example).

The following is the TesterBean and TesterClient files
I have done a printscreen on the errors, they can be found
here here

[ March 12, 2006: Message edited by: stewart ridgway ]
Lasse Koskela
Posts: 11962
  • Mark post as helpful
  • send pies
  • Report post to moderator
Stewart, please don't cross-post the same question to several forums. Even if your problem involves both Swing and EJB code, you really need to either pick one forum or formulate your question into several more specific ones and post each to their respective forums.

I'm closing this thread as a duplicate for the one in the Swing forum.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic