I am having trouble testing EJB across network.

I am trying to test an ejb client, with jboss being the App Server, that would call a method of an EJB running on say "theserver.domain.com" machine. I get the following error when I run the client program from my PC.
The EJB and client works fine when jboss and client is on the same machine.
This is an example that comes from jboss site (http://www.jboss.org/doco_files/) called documentation-example.zip. I have modified the client as listed below. However, I have not touched the InterestBean which contains one business method called calculateCompoundInterest. It's very straight forward.
Does any one see anything wrong with the client code. Do you have to do anything special when deploying EJB to "theserver.domain.com" vs. running locally with client.
Thanks for your help.
Error:
[java] Got context
[java] javax.naming.CommunicationException [Root exception is java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is:
[java] java.net.ConnectException: Connection refused: connect]
Code:
package org.jboss.docs.interest;
import java.rmi.RemoteException;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
import java.sql.*;
import javax.sql.DataSource ;
import oracle.jdbc.driver.* ;
import oracle.jdbc.* ;
import javax.naming.InitialContext ;
import javax.naming.NamingException;
import javax.naming.Context ;
This class contains the implementation for the `calculateCompoundInterest'
method exposed by this Bean. It includes empty method bodies for the methods
prescribe by the SessionBean interface; these don't need to do anything in this
simple example.
class InterestClient
/** This method does all the work. It creates an instance of the Interest EJB on
the EJB server, and calls its `calculateCompoundInterest()' method, then prints
the result of the calculation.
public static void main(String[] args)
// Enclosing the whole process in a single `try' block is not an ideal way
// to do exception handling, but I don't want to clutter the program up
// with catch blocks
try
Properties env = new Properties();
env.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
env.setProperty("java.naming.provider.url", "jnp://theserver.domain.com:1099");
env.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
// cachedCTX = new InitialContext(env);
// Get a naming context
InitialContext jndiContext = new InitialContext(env);
// InitialContext jndiContext = new InitialContext();
System.out.println("Got context");
// Get a reference to the Interest Bean
Object ref = jndiContext.lookup("interest/Interest");
System.out.println("Got reference");
// Get a reference from this to the Bean's Home interface
InterestHome home = (InterestHome)
PortableRemoteObject.narrow(ref, InterestHome.class);
// Create an Interest object from the Home interface
Interest interest = home.create();
// call the calculateCompoundInterest() method to do the calculation
System.out.println("Interest on 1000 units, at 10% per period, compounded over 2 periods is:");
System.out.println(interest.calculateCompoundInterest(1000, 0.10, 2));
catch(Exception e)
System.out.println(e.toString());

Hello! We have the same firewall problem with JBoss 2.4.x as App. Server and a Java Application (Swing) as EJB client. How did you go around it?

Similar Messages

  • Is anyone else having trouble viewing the SEC network via Watch ESPN on a 2nd gen Apple TV?  Software is up to date, but SEC network not showing up as a channel.  Using Xfinity - and it appears on iPhone5 but not on iPad2 - both of which ar

    Is anyone else having trouble viewing the SEC network via Watch ESPN on a 2nd gen Apple TV?  Software is up to date, but SEC network not showing up as a channel.  Using Xfinity - and it appears on iPhone5 but not on iPad2 - both of which are current on IOS. Help!

    the wifi router could also be blocking
    and to really test if the windows firewall is the problem then try turning it off!
    if that scare you too much then disable the internet modem / cable modem or the likes while you test
    always remove more and more factors when troubleshooting sooner or later it will work and you can narrow down which factor did the job and work on that

  • I am having trouble connecting to my network all of a sudden. It is not an issue with the service/router. I keep getting kicked off and getting a ! in my airport... anyone know what's up with this?

    I am having trouble connecting to my network all of a sudden. I am able to connect to other networks but not my own. It is not an issue with the service/router because other devices connect fine. I keep getting kicked off and getting a ! in my airport. Last time it happended I called apple and the suggested I wipe my HD and reinstall everything. I did and it did not work. One day I turned my laptop on and it connected no problem. Now it has kicked me off again. I tried resetting my IP address but that does not work either! Has anyone had this problem?

    Try this:
    Apple menu / System Preferences / Network.
    Click Location: and select Edit Locations..
    Click + (plus sign), and enter a name for the new location - anything will do.
    Apply this.

  • I am having trouble connecting to wifi network via airport express on my windows xp pc, but I know it is working because I can connect on my macbook, does anyone know what the problem is?

    I am having trouble connecting to wifi network via airport express on my windows xp pc, but I know it is working because I can connect on my macbook, does anyone know what the problem is?

    Tell us more about the problem, I can think up 100&1 different reasons, but don't have time to go through all the possibilities. So.. what happens?

  • When trying to use Siri I keep getting this message: "Sorry, I am having trouble connecting to the network."

    I am trying to use Siri, and I get the message "Sorry, I am having trouble connecting to the network."  Is this the expected "growing pains" of this new feature/service, or am I doing something wrong?  Are there any settings that I gotta do before I can use Siri?
    Thanks.

    I've had the same issue with my wife's iPhone, the first night it worked great then nothing.  My iPhone 4s has had no issues.  I disabled Siri and shut the iPhone off, waited a minute or so and turned it back on.  Re-enable Siri, her info populated automatically.  Siri has been working for the last 30 minutes with no problems ??  Server problems, too many things open at once, having the phone loaded to the hilt with no free space?  It could be any number of things, or many thing working together to silence Siri.....good luck all, I hope this helps.

  • I am having trouble connecting to wifi networks that are password secured, even though I know the passwords.

    hey guys,
    Ok so here is the problem. I am having trouble connecting to wifi networks that are password secured. I am able to connect to public wifi with no problem, but when networks have passwords on them I am unable to connect to them, and I know that passwords. I also know that i am putting the correct passwords in because I am able to connect to the networks on my computer. I have tried turning my phone off and then back on, turning the wifi off and then back on and even resetting my network passwords to no avail. The networks that are secure show up in the wifi list for networks but when I go to put the password in, it tells me "incorrect password for the network". It has never connected to it since the passwords have been put on it. I am out of ideas for trouble shooting. Can anyone else help?!

    Try a soft reset by holding in the power button and the home button in at the same time for about 15 seconds until the screen flashes and then goes completely black. Afterwards try and turn the phone back on and see if that works. Also you could try and reset the Network Settings by going to Settings--General--Reset--Reset Network Settings and see if that resolves your problems as well. If all else fails be sure and do a backup through ITunes and then try to restore the device. Hopefully all will be well now.

  • I am having trouble installing a dell network laser printer so my mac will print.  Please help

    I am having trouble installing and printing my Dell laser 1700 network printer.  I keep doing the install and it won't print.  I previously had it installed but because I had to get a new router the IP address changed and i no longer can print with the old or load a new printer.  Please help me.

    CLICKY CLICK----> What to do when you can't print 

  • I'm having trouble connecting to the network on my HP stream 7

    I'm having so much trouble with connecting my interet to my HP tablet , when i got it .. it was working perfectly fine couple days later it did not want to connect to my internet, it doesn't give any choices to what network to connect too. The troubleshooter said that it had to do something with the adapter. Please help!!!!

    This happened to me and a few others here.  The fix for me was uninstalling the wireless driver from Device Manager. I said "yes" when prompted to delete the driver files.  I then ran the wireless driver installer from the hp.com site and that fixed it.  You would have to download the file on another computer and then copy it to the Stream via USB, micro SD or bluetooth if that is working.

  • Having trouble connecting to wireless network

    Hello. I am having some difficulties connecting to my Linksys router from my Powerbook G4. Here is my issue... sometimes airport can find the wireless connection (called Linksys) and sometimes it can't. I don't understand why it does sometimes, but other times it does not. I have a brand new iMac that is always able to find the network through the airport. I've never had problems with connecting the iMac to the wireless network, it's the Powerbook that will sometimes not find the wireless network in the drop down menu through airport. I don't understand how one computer can and one computer cannot. I was thinking maybe it's because the airport card is a bit older in the Powerbook and doesn't pick up as many networks, but like I said, some of the time it works just fine and it stays working until I shut down the laptop. Any ideas? I appreciate the help.

    Try the following on your Powerbook:
    1. Delete Preferred Network(s)
    - System Preferences > Network > AirPort > Configure
    - In the "By default, join:" pull-down menu, select "Preferred networks"
    - Delete the network(s) you regularly use from the list
    2. Delete AirPort Keychain Entries
    - Launch the "Keychain Access" application located in Applications/Utilties.
    - Click on the "Kind" filter at the top, and look for any "AirPort network password" entries...and delete them.
    - Restart, or log out then back in.
    3. Add Preferred Network(s)
    - System Preferences > Network > AirPort > Configure
    - In the "By default, join:" pull-down menu, select "Preferred networks"
    - Add the preferred network(s) using the "+" button.
    - Restart or log out then back in.

  • Having trouble with ejb jar...

    Hi experts,
    I've created a simple Java Enterprise Application project. Which contain, a web client and a ejb. The ejb package (ejb jar) contain one session interface and a session object. The web package (war) contain a index.jps which call a serlet (controller). This servlet invoke an object located into the ejb jar project. I don't want to create a .ear.
    I deployed both files into a glassfish server. So, i'm getting a .war file and ejb .jar file. Now, my question is why am i having a ClassNotFound exception when the servlet invoke the ClientSessionRemote interface of the ejb? Currently, the only way i've found to remove this exception is to include the ejb jar file into the classpath of the war... but it doesn't make sens!
    any help would be appreciate.
    I joined some code....
    ClientSessionRemote.java
    package com.imagem;
    import javax.ejb.Remote;
    @Remote
    public interface ClientSessionRemote {
       public java.lang.String SayHello();
    }ClientSession.java
    package com.imagem;
    import javax.ejb.Stateful;
    @Stateful
    public class ClientSession implements ClientSessionRemote  {
       public String SayHello(){
             String msg="Hello! I am Session Bean";
             System.out.println(msg);
             return msg;
    } Controller.java (servlet)
    public class Controller extends HttpServlet {
       @EJB
       private ClientSessionRemote m_testClientSessionBean;
       ...some code...
       public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
          PrintWriter out;
          response.setContentType("text/html");
          String title = "EJB Example";
          out = response.getWriter();
          out.println("<html>");
          out.println("<head>");
          out.println("<title>Hello World Servlet!</title>");
          out.println("</head>");
          out.println("<body>");
          out.println("<p align=\"center\"><font size=\"4\" color=\"#000080\">Servlet Calling Session Bean</font></p>");
          try{
                //ClientSessionRemote client = (ClientSessionRemote) new InitialContext().lookup("java:comp/env/StatefulClientSession");
             //ClientSessionRemote client = (ClientSessionRemote) new InitialContext().lookup(ClientSessionRemote.class.getName());
             //out.println("<p align=\"center\"> Message from Session Bean is: <b>" + client.SayHello() + "</b></p>");
             //System.out.println("Message = " + client.SayHello());
             out.println("<p align=\"center\"> Message from Session Bean is: <b>" + m_testClientSessionBean.SayHello() + "</b></p>");
          catch(Exception CreateException){
             CreateException.printStackTrace();
          out.println("<p align=\"center\"><a href=\"javascript:history.back()\">Go to Home</a></p>");
          out.println("</body>");
          out.println("</html>");
          out.close();
       ...some code...
    }thks
    Mart.

    yorkroad wrote:
    If you just have the .war and .jar file deployed separatley then how is the Servlet going to know about the EJB classes? It doesn't, hence the ClassNotFoundException. You should at least include the EJB interfaces in the war file. Is there a particular reason for notwanting an .ear file? Just asking as it could simply things :)
    mI think you're seriously wrong on this one. Isn't the whole point of placing your logic in EJBs in not having to include anything in separate projects that are going to share it?
    @pm.renaud
    It could be the @EJB annotation. It doesn't work properly on some app servers (though I believe it should work just fine on Glassfish). Try getting to the EJB manually, through a JNDI call.

  • Trouble sharing songs across network

    I'm trying to share songs on two PCs on the same network. I've enabled sharing on both PCs (Edit menu -> Preferences -> Sharing tab -> click "Look for shared libraries" and "Share my library on my local network" buttons). Unfortunately, neither PC is able to see the other shared library.
    What am I doing wrong? Thanks.

    Well, I guess it's "regular" sharing, and not "Home Sharing."  Tricky.  I do see that the checkbox says "Home sharing computers and devices update play counts," but it's on the same screen under the regular sharing options.  Very confusing I think.
    Soooo.  I didn't think I wanted Home Sharing because the description seemed to indicate that it was for copying songs across pc's on your home network, and specifically seems to indicate that it is only for songs purchased through iTunes.  I really don't necessarily need songs copied to both of my pc's, and I certainly wouldn't want only iTunes purchases copied.  So am I understanding this right?  Does Home Sharing only copy iTunes purchased songs? 

  • Having trouble connecting after upgrading network

    Hi. I'm currently running 10.5.5 on a 17inch MacBook Pro, and have two roommates running 10.5 and 10.4 on two different MacBooks. I used to run our apartment network (from a cable modem) over a AirPort Express Basestation Model #A1084, that was two years old. Last week, I upgraded to a brand new Airport Extreme. After setting it up as a replacement for the Express, I've had no problems, but my roommates are having issues connecting. One claims it takes up to 40 minutes for him to finally connect to the network, and after that, internet is still sketchy.
    Since I'm having no real problems, I'm curious what could possibly be a problem. Any help?

    May be worth trying the general iOS Wifi troubleshooting first. I don't think they've updated it yet for iOS7, but all the steps should be pretty much the same.
    http://support.apple.com/kb/TS1398
    = L.I.

  • Having trouble setting up a network

    My house has two macs. A powermac g5 and a imac g5. My setup is as follows. Cable modem to a router, router to the powermac g5(ethernet cable) and again the router to an airport express (ethernet cable). The imac g5 is located on a different floor of the house so I just installed an airport express card in it. I can connect to the internet fine via airport, but I'm having a problem sharing information between the two computers. Particularly I was hoping to share the itunes music library, and use bonjour messaging. If anyone can help me with this I would be very appreciative.
    Best,
    Ken

    In your configuration you have inadvertently created a different subnet for the wireless iMac G5. To remedy this, configure the AirPort Express so that the option to distribute IP addresses is DISABLED.

  • Having trouble setting up home network for home sharing

    Hi there, I'm new the idea of home sharing. What i want to do is watch the movies that i have on my iMac on my iPad. So sort of like wireless streaming.
    I see that Home sharing on iTunes allows you to view videos stored on your iMac on another device like the iPad etc.
    I've already setup Home sharing accounts and looged in on iTunes on both my iMac and iPad.
    The problem is being on the same Wi-Fi network. I don't understand what this means.
    I regualrly use Internet sharing to share my Macs internet connection with my iPad over WiFi.
    But I'm not sure what setting I should use for home sharing to work to watch videos from iMac on iPad
    On my iMac under Sharing there's a whole bunch of options DVD or CD sharing, File Sharing, Printer Sharing etc.
    The only box i have checked is Internet Sharing..
    What to i have to do to get the iMac and iPad sharing video over WiFi through home sharing??

    In your configuration you have inadvertently created a different subnet for the wireless iMac G5. To remedy this, configure the AirPort Express so that the option to distribute IP addresses is DISABLED.

  • New MacBook Air having trouble connecting to the network and staying connected

    I have an iMac as my prime and a MacBook Air as my remote. My network is all Apple. If I close the lid on my MacBook Air it immediately disappears from finder as a shared resource. However, if on first run though I put it to sleep and then close the lid, it will remain on the network as a shared resource. From hereon in, I can just close the lid to put it to sleep and its fine.
    If I restart either computer or both computers, I have to go through the first run routine again. What makes matters worse is I’m trying to do an 11pm Retrospect backup of the Air and if it gets lost from the network Retrospect is unable to find the device. I have to do a locate in Retrospect and then let it do its backup.
    I think this putting it to sleep on first run and then closing the lid to maintain stability is just a workaround I accidentally discovered. I don’t think it should be working like this. I think if I just close the lid and let it sleep that way on first run it should remain on the network as a shared resource and I should continue to see it on my iMac in Finder but this isn’t the case.
    I’m really looking for opinions on this issue, if others have experienced this and is there anything that can be done about it. I’ve got mixed messages from Apple Tech support but Retrospect tech support said I’m doing everything right. This to me seems like a bug in probably the software. The machine runs fine except for this one little quirk.
    Kerry

    Yes its ticked. I’ve worked at this for two weeks and have gone through every iteration I can think of. Apple said that it is normal that the lid has to be open to have the shared resource but as long as on first sleep I put it to sleep first then close the lid it remains in the iMacs finder Window as a shared resource. And I can open and close the lid from thereon in and it is always there as a shared resource and Retrospect can locate it for backups.

Maybe you are looking for

  • Internal server error while raising a claim request.

    Dear All, I am using claims and we have implemented badi for finding the approver and sending the request. Here after implementing the Badi, i am getting internal server error as this. While processing the current request, an exception occured which

  • Download speeds awful on 4mb line

    Please can someone hear this out because it's driving me mad. I have two Macs, iMac G5 and iBook. I alos have a, dare I say it, a PC laptop. I am connected to the internet with Telewest Broadband (blueyonder) on a 4mb line. My download speeds on the

  • How to Clean the iPod?

    I was wondering how you clean the metal panel on the back of the Nano. I used a tissue with soap and water and it got clean but I have heard people use metal wool to clean the back of their iPods in general. So how do you really clean the back of the

  • Compiling .java files during program execution.

    I have a program that read events in from a file and creates custom Event objects (which extend Thread) from this information, and then later the events are activated depending on the timing information that was provided in the file. Everything works

  • Will PSE 8 support ACR 8.3

    I just got a nikon D610 and nikkor 16-35 lens. PSE8 won't recognize the nef (raw) files. I understand that ACR 8.3 will handle the D610 nef files. What I don't know is whether PSE8 will work if I upgrade to ACR 8.3 or greater. Does anyone have any id