How to run a application client in jboss?

Hi guys i'm new to EJB and may have some qns to ask.
I have create ejb java files, compile and package it as jar. Next i also create the .jsp pages and package it as war. I package the war and jar together with the xml files for deployment. The file works.
Now i create a java file as an application client along with the application-client.xml file. Next i jar both the class and xml files together.
Now , how am i going to run the client class file to produce the results since its jar up. I using jboss 4.0 to run the application.
thanks
Regards ChongMing

Your J2SE client code should simply look up the required EJB homes using JNDI, and use the client interface to execute the EJB code. The example interfaces ejb.interfaces.SimpleHome and ejb.interfaces.Simple need to be packaged into the client JAR and placed in the classpath of test.java
Example:
import javax.ejb.EJBException;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.rmi.PortableRemoteObject;
import ejb.interfaces.SimpleHome;
import ejb.interfaces.Simple;
public class test {
    public static void main(String[] args) {
        try {
             InitialContext ctx = new InitialContext();
             SimpleHome home = PortableRemoteObject.narrow(ctx.lookup("ejb/Simple"), SimpleHome.class);
             Simple simple = home.create(); // or findByPrimaryKey(), etc.
             simple.aMethod();
        } catch (NamingException ne) {
            // unable to look up SimpleHome
        } catch (EJBException ejbe) {
           // generic EJBException, maybe something went wrong with Simple?
        } catch (ClassCastException cce) {
           // SimpleHome was of the wrong type
}I may have screwed up the JNDI lookup, as I might not be getting the context correctly, but I usually don't call EJB code from the command line. If I'm wrong, the only thing that will change is that ctx will have to be initialized differently. The rest should work the same.
Brian

Similar Messages

  • How to run J2EE application client remotely

    I have the Duke's Bank demo running on a Linux PC "crackpad" (http://thomasfly.com:8000/bank/logon CustomerID=200, Password=j2ee) which I can access LAN-wise as http://crackpad:8000/etc. Accessing the bank as an administrator using the J2EE app. client also works fine (locally) on the Linux PC.
    I've also installed & run the Bank demo on a Windows PC, so I have all the req'd ears & jars there as well. However, when I try to run the app client on the Windows PC (accessing the J2EE Reference Implementation server on running crackpad), I getC:\j2eetutorial\bank\jar> runclient -client DukesBankApp.ear -name BankAdmin
    Application threw an exception:javax.naming.NamingException: Serial Context failureI set the environment variables per http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/Tools10.html#65815 http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/Tools10.html :C:\j2eetutorial\bank\jar> echo %VMARGS%
    -Dorg.omg.CORBA.ORBInitialHost=crackpad
    C:\j2eetutorial\bank\jar> echo %APPCPATH%
    DukesBankAppClient.jar
    C:\j2eetutorial\bank\jar> dir DukesBankApp*.*
    07/10/2002  09:58 PM           420,480 DukesBankApp.ear
    07/10/2002  10:25 PM           712,814 DukesBankAppClient.jarHas anybody encountered this problem & solved it, or see anything that I've overlooked?

    I have the Duke's Bank demo running on a Linux PC "crackpad" (http://thomasfly.com:8000/bank/logon CustomerID=200, Password=j2ee) which I can access LAN-wise as http://crackpad:8000/etc. Accessing the bank as an administrator using the J2EE app. client also works fine (locally) on the Linux PC.
    I've also installed & run the Bank demo on a Windows PC, so I have all the req'd ears & jars there as well. However, when I try to run the app client on the Windows PC (accessing the J2EE Reference Implementation server running on crackpad), I getC:\j2eetutorial\bank\jar> runclient -client DukesBankApp.ear -name BankAdmin
    Application threw an exception:javax.naming.NamingException: Serial Context failureI set the environment variables per http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/Tools10.html#65815 :C:\j2eetutorial\bank\jar> echo %VMARGS%
    -Dorg.omg.CORBA.ORBInitialHost=crackpad
    C:\j2eetutorial\bank\jar> echo %APPCPATH%
    DukesBankAppClient.jar
    C:\j2eetutorial\bank\jar> dir DukesBankApp*.*
    07/10/2002  09:58 PM           420,480 DukesBankApp.ear
    07/10/2002  10:25 PM           712,814 DukesBankAppClient.jarHas anybody encountered this problem & solved it, or see anything that I've overlooked?

  • How to run others application in Oracle Forms on the web version?

    How to run others application in Oracle Forms on the web version?

    Pang,
    guess that you want to start client side programs from Forms on the Web. There is a sample on OTN (host bean) that allow you to acces sthe client and start executables.
    Frank

  • How to run desktop application

    Hi! I've programmed for years JSP, Servlets and Applets, but never a desktop application, so... my problem is that I don't have any idea on how to run it. I mean, of course I know how to run some application in my own desktop (java applicationname) but my doubt is, what I need to install in the client desktop or how must I do my package in order to run without the need for installing the SDK. Because, as I known, the "java.exe" comes with SDK, and of course, I don't think that I need to install de entire SDK in all my clients desktops in order to run my application.
    Any help will be very appreciated!

    You should give them the Java Runtime Environment. You will find a java.exe there too. E.g.
    C:\Program Files\Java\jre1.5.0_02
    The principle problems you will have to consider are:
    1.) How easy, and often, will you have to update your program? You might need to consider something like Java Webstart, for example.
    2.) What are the security considerations? If you need access to a database you will have difficulty keeping passwords secure. You may want to obfiscate code, for example.
    3.) If the applications are communicating with a central resource how will you deal with simultaneous usage. Coming from a web application background this is nothing new to you I guess but you may want to consider a J2EE application server, for example.
    4.) You need to consider whether you stick with what you know and develop an intranet approach to internal applications.

  • How to run expdp from client ?

    Hi All,
    I tried searching google and forums for my issue but to no avail > How to run expdp from client side ....like in my laptop.
    Because currently our PROD database server has no space for expdp dump file. So I want it directed to my laptop which has an extenal USB of 1TB harddisk...via client EXPDP
    import data using impdp command
    Posted on: 08-May-2012 11:36, by user: 841731 -- Relevance: 53% -- Show all results within this thread
    below command is correct or not? if it is not correct could you please send me the correct command. impdp user/pass@databasename schemas=sourceschemaname remap_schema=sourceschemaname:destinationschemaname ...
    System generated Index names different on target database after expdp/impdp
    Posted on: 30-May-2012 11:58, by user: 895124 -- Relevance: 43% -- Show all results within this thread
    After performing expdp/impdp to move data from one database (A) to another (B), the system name generated indexes has different ...
    [ETL] TTS vs expdp/impdp vs ctas (dblink
    Posted on: 08-May-2012 21:10, by user: 869578 -- Relevance: 39% -- Show all results within this thread
    (table : 500 giga, index : 500 giga), how much faster is TTS (transportable tablespace) over expdp/impdp, and over ctas (dblink) ? As you know, the speed of etl depends on the hardware capacity. (io ...
    Oracle Client
    Posted on: 21-Jun-2012 22:47, by user: Sh**** -- Relevance: 32% -- Show all results within this thread
    Hi Guys, Please can you guys elaborate the difference between Oracle Client and Oracle Instant Client. Also, please can you advise from where I can download the Oracle normal ...
    Oracle 10g Client
    Posted on: 05-Jun-2012 10:11, by user: dzm -- Relevance: 26% -- Show all results within this thread
    to search at oracle site and this forum, but i wasn't able to find a link to download the oracle 10g client. I really need especificaly the 10g version. Anybody know the link or another way to download ...
    9i client to access 11g database
    Posted on: 22-Jun-2012 07:31, by user: kkrm333 -- Relevance: 24% -- Show all results within this thread
    Hi, Can i access a 11g database using 9i client? Thanks,
    SQLplus in Oracle Client
    Posted on: 14-Jun-2012 00:36, by user: Tim B. -- Relevance: 24% -- Show all results within this thread
    Hi, I tried to install an 11g oracle client in linux. As I've compared the files with the files when you install using the oracle instant ...
    Re: Information on Oracle Client 11202-1.1.4-6
    Posted on: 05-Jun-2012 03:33, by user: 898763 -- Relevance: 23% -- Show all results within this thread
    Actually thats the client requirement
    Analysing the performance of a single client
    Posted on: 28-Mar-2012 02:05, by user: 880172 -- Relevance: 23% -- Show all results within this thread
    timeouts even on some of the simplest queries. I want to try and get some data about how just this one client is performing and what it’s doing, but everything Google has thrown up so far is orientated around ...
    to make client connection as sys
    Posted on: 12-Jun-2012 22:04, by user: user11221081 -- Relevance: 23% -- Show all results within this thread
    Dear gurus can i connect to my server from my client machine with sysdba without giving sys password i have connected in different ways as sys@abc ...Thanks a lot.

    Though you can initiate the binary from your client side but for the file creation, there is no other way but to store it on the server side. So your best bet would be to get some space free on the server side of yours.
    Aman....

  • How to run the application in weblogic

    Hello!
    I have deployed 1 application in Apache Tomcat , it is working fine. Now i want to deploy same application in Weblogic Server. I have already installed "Weblogic 9.1". Now i dont know how to do and what to do next.
    I also dont know where to copy that application folder in weblogic, and how to run & deploy the application?
    I have stuck over here.
    Please if anybody knows how to run the application in weblogic, plz let me know.
    I need your help.
    Thank you.

    hi,
    have you gone through [this link.|http://e-docs.bea.com/wls/docs92/index.html]. i think it may help.

  • How to run windows application programs in mac book pro, how to run windows application programs in mac book pro

    how to run windows application programs in mac book pro, how to run windows application programs in mac book pro

    Install Windows..either by Boot Camp or via virtual machine from VMWare, Parallels or Virtual Box

  • How to run ipad applications in mac

    how to run ipad applications in mac i ahve downloaded the application in macbook air . But i do not know how to run?

    It can't be done. iPads use iOS as the operating system. Macs use OS X as the operating system. iOS apps don't run on Macs and OS X apps don't run on iPads.
    That's why if there is an app that has been developed for both platforms, you have to buy them separately; iOS apps from the iTunes App Store and Mac apps from the Mac App Store.

  • How to download Personal Java and how to run the application

    Hi,
    From java.sun.com, which file has to be downloaded for develpoing the application in personal java.
    How to run an application in peraonal java?
    If you give me the steps it will be more helpful to me.
    I couldn't find the samples for personal java anywhere?
    If you give me links for basic samples with source code such as hello world and small games, it will be more helpful to me.
    All of my doubts are very basic one.
    Please help me.
    Thanks in advance.
    Regards,
    Nagaraj.

    Sun has a beta implementation available for download (http://developer.java.sun.com/developer/earlyAccess/personaljava/) which will allow you to run Personal Java on a MIPS/SH3/StrongARM or XScale device running WindowsCE 2.0 or greater. You can also download the Personal Java Emulation environment (http://java.sun.com/products/personaljava/pj-emulation.html) which will allow you to develop and run personal java applications in a Windows or Solaris environment.
    Most JDK1.1.8 compliant applications will run on Personal Java, so a Hello World program would look like the regular.
    public static void main(String[] args) {
    System.out.println("Hello World");
    System.exit(0);
    You can also purchase a full blown commercial implementation of Personal Java for PocketPC at handango.com. Do a search on Insignia Jeode for Dell. You can use this on any PocketPC/XScale pda.
    To run a Personal Java program on Pocket PC. Deploy your jar to the Device and create a shortcut similar to this:
    50#"\program files\Java\bin\pjava.exe" -setcwd "\program files\Java\pjtest" -classpath "\program files\Java\pjtest\pjtest.jar" -file "pjtest.testmain.class"
    The number is arbitrary, but the paths need to point to the directory where you installed Personal java and your jar/application respectively.

  • How to run composite application

    Dear all,
    I developed one composite application in ce 7.1 ehp 1 version.I deployed that application.can any one let me know how to run that
    application.
    regards
    ravi

    Hi Ravi,
    Take a look at the following links:
    - [Quick Start tutorial|http://help.sap.com/saphelp_nwce10/helpdata/en/45/055d394c09048ae10000000a155369/frameset.htm]
    - [Modeling Composite Views with Visual Composer |http://help.sap.com/saphelp_nwce10/helpdata/en/45/04134e8a5741dee10000000a1553f6/content.htm]
    - [SAP NetWeaver Visual Composer FAQ|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/00b9ba6d-1291-2a10-208d-bd27544e7939]
    I think the "Quick Start tutorial" -> "Creating the Basic Model" -> section 13 can answer your question.
    Regards,
    Udi
    Edited by: Udi Cohen on Aug 19, 2009 10:14 AM

  • How to run richfaces application in JBOSS

    hi,
    I installed jboss-4.2.2.GA and extracted richfaces-ui-3.2.1.GA-src in the jboss-4.2.2.GA\server\default\deploy folder.
    But while running richfaces application through http://localhost:8080/richfaces-ui-3.2.1.GA-src , showing "HTTP Status 404 - /richfaces-ui-3.2.1.GA-src" error. I tried to run other simple applications, but those are also not running, as the same error showing "HTTP Status 404"....
    please help me asap.

    I'm sorry man, but you are not getting out the easy way no matter how many times you post the same question. Whole books have been written on the subjects of JBoss and JSF and you are going to have to read at least some articles online if you are going to get anywhere. It is not something that has a simple 123 step guide, this is complex material that requires research, study and effort to accomplish.
    So your first step is to go figure out what the structure of a JSF web application is and how to deploy one to JBoss. Good luck.

  • How to create and run J2EE application client for Hello World EJB

    Hi
    I am new to NWDS EJB deployment.I have created a "Hello World" bean. But how to deploy it and run using a J2EE application client step by step.
    Also please help in the steps of the deploy tool.
    Thanks in Advance

    Hi Ananda
    Check this link,
    http://help.sap.com/saphelp_nw04/helpdata/en/55/600e64a6793d419b82a3b7d59512a5/content.htm
    cheers
    Sameer

  • VSM 1.3 application - How to run VSM Administration Client ( ?)

    Hi
    I am unable to access VSM's mall admin page. Is there any special procedure, like using JClient.
    I looked at the following URL:
    http://www.oracle.com/technology/sample_code/tutorials/bc4jvsm/over/setup.htm
    But I am not quite sure if this applies to VSM 1.3. Could somebody let me know..
    thanks in advance

    Using Run As - Java application, as the name implies, will run the main class as a Java standalone application and not as an application client. For example, doing a lookup() will raise
    Exception in thread "Main Thread" javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
    because the java.naming.factory.initial is not specified this happens in a standalone application, while in an application client running in the container this doesn't have to be specified, as the class is already in the container.

  • How to run Content DB Client console from JDevloper

    Hi
    I have downloaded all the content db client console pages from server. Please let me know how to run the console from my local machine thru jdeveloper. When i tried to run it is giving some runtime exceptions.
    Sep 10, 2007 10:46:07 AM oracle.ifs.fdk.http.HttpNodeManager
    INFO: Creating HTTP Node ...
    07/09/10 10:46:07 Cannot create HTTP Node:
    oracle.ifs.common.IfsException: IFS-45061: Unable to create node
    oracle.ifs.common.IfsException: IFS-20016: Required parameters are null (either "Schema Name" or "Domain Name" should be non-null)
         at oracle.ifs.management.domain.HttpServletNodeUtilities.createNode(HttpServletNodeUtilities.java:243)
         at oracle.ifs.management.domain.HttpServletNodeUtilities.createNode(HttpServletNodeUtilities.java:156)
         at oracle.ifs.fdk.http.HttpServer.createNode(HttpServer.java:162)
         at oracle.ifs.fdk.http.HttpNodeManager.contextInitialized(HttpNodeManager.java:37)
    Please let me know if there is any documentation for this.
    Thanks
    Ravi

    Hi,
    I built berkeley DB 4.4.20 and use it from Jbuilder2005, I noticed that tha size of Jbuilderw.exe consumes about 96MB of memory and the size of javaw.exe consumes (in my application) about 63MB. so I thought that if I load the jdk1.4 only ( by running my code from the command line) this will save memory because not all compenents of Jbuilder will be loaded into memory. to do so, I copied the directory jdk1.4 from inside jbuilder2005 and put it on c:\, then I build berkeley DB using visaul c++ 6.0 and filled the following pathes in the include directory(tools-->options->directories)
    c:\jdk1.4\include
    c:\jdk1.4\include\win32
    and in the executable files directories I added the following path:
    c:\jdk1.4\bin
    then I set the classpath from inside windows (server2003), and I set the path as well but when I run the java class from the command line, I recieved message like "the packege com.sleepycat.db " not exist
    thanks

  • How to run ejb application OC4J J2EE Container

    Hi all,
    I unable run ejb applications in OC4J J2EE Container.
    I have configure following files.
    in config directory
    Server.xml
    I have .ear file if configured in server.xml. this .ear copied into home/application directory
    I have create following deployment discriptor file.
    in META-INF for ejb.
    ejb-jar.xml
    application.xml
    I have specify all ejb classes details in ejb-jar.xml
    Please help me .How to run ejbs with jsp and application client.Which files shall i configure.
    Thnaks,

    Hi all,
    I unable run ejb applications in OC4J J2EE Container.
    I have configure following files.
    in config directory
    Server.xml
    I have .ear file if configured in server.xml. this .ear copied into home/application directory
    I have create following deployment discriptor file.
    in META-INF for ejb.
    ejb-jar.xml
    application.xml
    I have specify all ejb classes details in ejb-jar.xml
    Please help me .How to run ejbs with jsp and application client.Which files shall i configure.
    Thnaks,

Maybe you are looking for

  • How to set the header of the file to excel type when writing it?

    Hello, I am using POI API to read an excel file that I have previously written using Java, but not using POI (I've written the file using Microsoft office xml and then writing it using FileOutputStream with an xls extension). The problem is that when

  • Is there a way to add multiple folder locations to my pictures folder?

    I have a USB hard drive with a lot of photos on it.  Rather than copy them all to my mac mini hard drive and chew up a lot of space there I'd like to add it as another source to the pictures folder.  Is there a way to do this?

  • 4s - tried update but phone now not working

    Can anyone help? Went to sync phone last night and got prompted to do the new update. I started doing this however half way through got a message saying could not be completed. Now my phone shows USB and Itunes picture (recovery mode?) and when plugg

  • Elements 9 - Actions

    I download an action but have problems to install this actions There are 3 files : .atn, .png and .jsx .atn + .png are installed in following folder : ProgramData\Adobe\Photoshop Elements\9.0\Photo Creations\Photo Effects The only thing that I do not

  • HT5035 Card did not credit correct amount

    I've just tried to redeem a £15 gift card but it only shows a £ 11.01 credit? Can anyone explain why please?  Thank you!