facebook

How/where to create application client

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #205051 Reply

    Rich Schramm
    Member

    Im new and am trying to figure out the ‘right’ way to create a java client application that talks to my server ejb using MyEclipse/jboss. I dont seem to see a wizard pick that is for none-web/jsp clients. Ive tried just hanging a java class with a main() method off of my top level project but cant seem to make it import the package or compile properly. Is there some doc/tutorial someone can point me towards that shows me the correct layout etc.
    Thanks – Rich

    #205056 Reply

    Riyad Kalla
    Member

    Rich,
    MyEclipse is a J2EE productivity tool, so we don’t currently have any implicit support for rich clients (Swing, Awt, etc.) but that support is provided pretty robustly from the standard Eclipse platform (especially if you decide to install a GUI builder like the VE plugin or SWT designer plugin).

    If you have a MyEclipse web project, and want to start working on a rich client (swing lets say) you would treat it as you would any other Java Project, create a package in your /src directory (or whatever you have marked as your source directory) and start working on it. To provide a more clean organization, I would suggest creating a separate Java Project to work on your client in. So you can switch to your web project, deploy and run it, then switch back to your Java Project, and run it; connecting to your webapp.

    #207049 Reply

    pokey909
    Member

    But is there a way to generate the application-client.xml with MyEclipse?

    #207071 Reply

    Scott Anderson
    Participant

    If there is, it would be done through XDoclet and I must admit I’ve never done that myself. Anyone else?

    #207112 Reply

    pokey909
    Member

    But how do you create your clients? Is there a “standard” way of doing this?
    My problem is that I can’t get the jndi lookup working. I always get “javax.naming.NamingException: Failed to find j2ee.clientName in jndi env” but I set the clientName with System.setProperty and everything else.
    I really have no clue how I could build a client for a simple HelloWorld Bean.

    #207113 Reply

    Scott Anderson
    Participant

    But how do you create your clients?

    application-client.xml is only for specifying that you’re packaging a standalone Java client in your EAR that you want to distribute to communicate back to your server application. It’s not needed for web applications or previously installed Java apps so most people never use it, myself included.

    I really have no clue how I could build a client for a simple HelloWorld Bean.

    A java client or a web client?

    #207126 Reply

    pokey909
    Member

    I´m talking java clients. My web app works fine.
    But at our department we cannot use web clients. We want to distribute real java clients.
    But I didnt find much documentation about building java clients with MyEclipse, JBossIDE or similar which work in conjunction with JBossAS.
    Any links on this topic?

    #207169 Reply

    Scott Anderson
    Participant

    Any links on this topic?

    Actually, I couldn’t find any either. Apparently packaging Java clients in J2EE apps isn’t a very widely used feature, as near as I can tell. Anyone else?

    #207172 Reply

    Walter Riley
    Member

    There seems to be two issues here, one related to constructing a working client, another with packaging it. If you’re primarily concerned with packaging, ignore this message. If you’re primarily concerned with constructing one though, I recently sent Scott an example EJB project that included several EJB client programs (see ‘using xdoclet to build a ejb’ thread for more info). None are GUI clients however. You can request that he send you a copy if you think it will help.

    Although I just left the clients as Ant targets to be called from within the IDE, you could easily run them in a couple of different ways.

    An alternate way of running the same clients from within the IDE is to select Client_xx.java from within the Package Explorer and then from the Main Menu select Run – Run… – Java Application – New
    A new Client_xx Run Configuration will be created. You will need to switch to the Classpath tab, click User Entries to highlight it and then click Advanced… Add Folders and select the jndi project folder. Also with User Entries highlighted, click Add External JARs… and add jbossall-client.jar You will also need to add command line arguments on the Arguments tab if required by the client.

    One way to run outside the IDE (from a Cmd window) is to modify jndi.properties if required and to:
    create a client folder
    copy the com/titan/* class file structure as a subdirectory of client from eclipse/workspace/ex13/classes
    copy the jbossall-client.jar from the jboss/client installation directory to the client folder
    copy the jndi.properties file to the client folder
    From within the client folder, run
    >java -cp .;jbossall-client.jar; com.titan.clients.Client_xx

    Once you have a working example, I’m sure you can easily adapt it to best fit your situation.

    Good luck,
    Walter

    #207173 Reply

    pokey909
    Member

    Thanks for your informative reply Walter!
    I just figured out by myself how I can run my client. But i had to edit the XDoclet generated files to be successful, which is probably not the correct way.
    But its strange that the getHome() method of the autogenerated Util class uses the COMP_NAME string for lookup (which is like “java:comp/env/ejb/MyBean”). This does not work “comp not bound”. Only MyBean is bound to an object. So if i change the java:comp/env/ejb/MyBean to MyBean everything works fine!
    Is there a way to tell XDoclet to take only MyBean string for lookups instead of the other one? Or are there some other things I’m doing wrong?
    I will have a look at your example project. Maybe that answers some of my questions.

    Thanks
    Alex

    #207202 Reply

    Scott Anderson
    Participant

    Alex,

    Send us an email at [email protected] and we’ll be glad to send along Walter’s example. Thanks again Walter!

Viewing 11 posts - 1 through 11 (of 11 total)
Reply To: How/where to create application client

You must be logged in to post in the forum log in