毕业论文开发语言企业开发JAVA技术.NET技术WEB开发Linux/Unix数据库技术Windows平台移动平台嵌入式论文范文英语论文
您现在的位置: 毕业论文 >> 开发语言 >> 正文

jboss7.1.1部署ejb3javax.naming.CommunicationException: Could not obtain connection to any of these urls: localhost:1099 and discovery

更新时间:2012-6-6:  来源:毕业论文

环境  
  jboss jboss7.1.1
   
  所使用的包 有 jboss/bin/client/jboss-client.jar
  还有从网上找的jnpserver.jar

  代码不部分很简单  
  HelloWorld 接口
 
Java code
               public interface HelloWorld {
                    public String SayHello(String name);
             }


  HelloWorldBean 
 
Java code
               import com.jav.impl.HelloWorld;
               import javax.ejb.Remote;
               import javax.ejb.Stateless;

                @Stateless
                @Remote(HelloWorld.class)
                public class HelloWorldBean implements HelloWorld {

             @Override
              public String SayHello(String name) {
            // TODO Auto-generated method stub
               return name+"Welcome Test";
               }

                 }
           

 

  Test代码
 
Java code
               Properties props=new Properties();
          props.setProperty("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
          props.setProperty("java.naming.provider.url","localhost:1099");
          props.setProperty("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
          try
          {
              InitialContext context=new InitialContext(props);
              HelloWorld hello=(HelloWorld)context.lookup("HelloWorldBean/remote");
              System.out.println(hello.SayHello("Hello Kitty"));
          }
          catch(NamingException e)
          {
              e.printStackTrace();
              System.out.println(e.getMessage());
          }
  部署上面的HelloWorld 和HelloWorldBean 的jar包之后  
   
  java:global/Hello/HelloWorldBean!com.jav.impl.HelloWorld
  java:app/Hello/HelloWorldBean!com.jav.impl.HelloWorld
  java:module/Hello/HelloWorldBean!com.jav.impl.HelloWorld
  java:jboss/exported/Hello/HelloWorldBean!com.jav.impl.HelloWorld
  java:global/Hello/HellWorldBean
  java:app/Hello/HellWorldBean
  java:module/Hello/HellWorldBean
  启动之后出现上面的代码
      但是我Test类做测试的时候还是报出异常,但是我用jboss-6.1.0.Final 做测试的同样的代码没有错误,问题应该还是在jboss7上
  错误时

  javax.naming.CommunicationException: Could not obtain connection to any of these urls: localhost:1099 and discovery failed with error: javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out] [Root exception is javax.naming.CommunicationException: Failed to connect to server localhost:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused: connect]]]
at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1452)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:597)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:590)
at javax.naming.InitialContext.lookup(Unknown Source)
at com.jav.test.Test.main(Test.java:20)
Caused by: javax.naming.CommunicationException: Failed to connect to server localhost:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused: connect]]
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:272)
at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1423)
... 4 more
Caused by: javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused: connect]
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:246)
... 5 more

[1] [2] [3] 下一页

设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©youerw.com 优尔论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。