2013-09-28 2 views
2

JBoss AS7.1.1 (standalone.xml)을 허용 원격으로 구성했지만 4447 포트가 열리지 않습니다. 내 standalone.xml :JBoss AS7.1.1 remoting

<subsystem xmlns="urn:jboss:domain:remoting:1.1"> 
    <connector name="remoting-connector" socket-binding="remoting" security-realm="ApplicationRealm"/> 
</subsystem>  
<interfaces> 
    <interface name="mine"> 
     <any-ipv4-address/> 
    </interface> 
</interfaces> 

<socket-binding-group name="standard-sockets" default-interface="mine" port-offset="${jboss.socket.binding.port-offset:0}"> 
    <socket-binding name="management-native" interface="management" port="${jboss.management.native.port:9999}"/> 
    <socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/> 
    <socket-binding name="management-https" interface="management" port="${jboss.management.https.port:9443}"/> 
    <socket-binding name="ajp" port="8009"/> 
    <socket-binding name="http" port="8080"/> 
    <socket-binding name="https" port="8443"/> 
    <socket-binding name="messaging" port="5445"/> 
    <socket-binding name="messaging-throughput" port="5455"/> 
    <socket-binding name="osgi-http" interface="management" port="8090"/> 
    <socket-binding name="remoting" port="4447"/> 
    <socket-binding name="txn-recovery-environment" port="4712"/> 
    <socket-binding name="txn-status-manager" port="4713"/> 
    <outbound-socket-binding name="mail-smtp"> 
     <remote-destination host="localhost" port="25"/> 
    </outbound-socket-binding> 
</socket-binding-group> 

클라이언트 프로그램 :

@Named 
@Stateless 
@Remote(IMailService.class) 
public class MailService implements IMailService { 

@Inject 
private EntityManager em; 

@Override 
public void sendMail() { 
    System.out.println("EntityManager:"+em); 
    System.out.println("Mail sent"); 
} 

@Override 
public String getMail() { 
    return new String("Mail sent"); 
} 

} 
: 서버 측 자바 코드에서

endpoint.name=client-endpoint 
remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false 

remote.connections=default 

remote.connection.default.host=192.168.1.25 
remote.connection.default.port = 4447 
remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false 

remote.connection.default.username=quickstartUser 
remote.connection.default.password=quickstartPassword 

:

public class Homework4EJB3Client { 

    /** 
    * Looks up and returns the proxy to remote stateless calculator bean 
    * 
    * @return 
    * @throws NamingException 
    */ 
    private static IMailService lookupRemoteStatelessMessaging() throws NamingException { 
     final Hashtable jndiProperties = new Hashtable(); 
     jndiProperties.put("jboss.naming.client.ejb.context", true); 
     jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming"); 
     final Context context = new InitialContext(jndiProperties); 
     // The app name is the application name of the deployed EJBs. This is typically the ear name 
     // without the .ear suffix. However, the application name could be overridden in the application.xml of the 
     // EJB deployment on the server. 
     // Since we haven't deployed the application as a .ear, the app name for us will be an empty string 
     final String appName = ""; 
     // This is the module name of the deployed EJBs on the server. This is typically the jar name of the 
     // EJB deployment, without the .jar suffix, but can be overridden via the ejb-jar.xml 
     // In this example, we have deployed the EJBs in a jboss-as-ejb-remote-app.jar, so the module name is 
     // jboss-as-ejb-remote-app 
     final String moduleName = "Homework4Quartz"; 
     // AS7 allows each deployment to have an (optional) distinct name. We haven't specified a distinct name for 
     // our EJB deployment, so this is an empty string 
     final String distinctName = ""; 
     // The EJB name which by default is the simple class name of the bean implementation class 
     final String beanName = "MailService"; 
     // the remote view fully qualified class name 
     final String viewClassName = "hu.infokristaly.homework.quartz.middle.service.IMailService"; 
     // let's do the lookup 
     return (IMailService) context.lookup("ejb:" + appName + "/" + moduleName + "/" + distinctName + "/" + beanName + "!" + viewClassName); 
    } 

    private static IMailService getIMailService() { 
     Properties clientProp = new Properties(); 
     clientProp.put("remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED", "false"); 
     clientProp.put("remote.connections", "default"); 
     clientProp.put("remote.connection.default.port", "4447"); 
     clientProp.put("remote.connection.default.host", "192.168.1.25"); 
     clientProp.put("remote.connection.default.username", "quickstartUser"); 
     clientProp.put("remote.connection.default.password", "quickstartPassword"); 
     clientProp.put("remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS", "false"); 


     EJBClientConfiguration cc = new PropertiesBasedEJBClientConfiguration(clientProp); 
     ContextSelector<EJBClientContext> selector = new ConfigBasedEJBClientContextSelector(cc); 
     EJBClientContext.setSelector(selector); 

     final String appName = ""; 
     final String moduleName = "Homework4Quartz"; 
     final String distinctName = ""; 
     final String beanName = "MailService"; 
     final String viewClassName = "hu.infokristaly.homework.quartz.middle.service.IMailService"; 

     Properties props = new Properties(); 
     props.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming"); 
     IMailService result = null; 
     try { 
      Context ctx = new InitialContext(props); 
      result = (IMailService) ctx.lookup("ejb:" + appName + "/" + moduleName + "/" + distinctName + "/" + beanName + "!" + viewClassName); 
     } catch (NamingException e) { 
      // TODO Auto-generated catch block 
      e.printStackTrace(); 
     } 
     return result; 
    } 

    @SuppressWarnings({ "unchecked", "rawtypes" }) 
    public static void main(String[] args) { 
     try { 
      Object o = lookupRemoteStatelessMessaging(); 
      //Object o = getIMailService(); 
      if (o instanceof IMailService) { 
       String result = ((IMailService)o).getMail(); 
       System.out.println(result); 
       ((IMailService)o).sendMail(); 
      } 
     } catch (Exception e) { 
      // TODO Auto-generated catch block 
      e.printStackTrace(); 
     } 
    } 
} 

나는 jboss-ejb-client.properties 사용

클라이언트 쪽에서 jboss-client.jar을 사용하고 서버는 java : jboss/exported/Homework4Quartz/MailService! hu.infokristaly.homework.quartz.middle.service.IMailService 인터페이스를 내 보냅니다.

그래서, everithing가 application-users.properties (내가 remote.connection.default.host에 대한 localhost를 사용하는 경우, 괜찮지 만, 실패 나 원격 IP에게

WARN: Could not register a EJB receiver for connection to remote://192.168.1.25:4447 
java.lang.RuntimeException: Operation failed with status WAITING 
    at org.jboss.ejb.client.remoting.IoFutureHelper.get(IoFutureHelper.java:93) 
    at org.jboss.ejb.client.remoting.ConfigBasedEJBClientContextSelector.setupEJBReceivers(ConfigBasedEJBClientContextSelector.java:121) 
    at org.jboss.ejb.client.remoting.ConfigBasedEJBClientContextSelector.<init>(ConfigBasedEJBClientContextSelector.java:78) 
    at org.jboss.ejb.client.EJBClientContext.<clinit>(EJBClientContext.java:77) 
    at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:120) 
    at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:104) 
    at com.sun.proxy.$Proxy0.getMail(Unknown Source) 
    at hu.infokristaly.homework.ejb3client.Homework4EJB3Client.main(Homework4EJB3Client.java:100) 

java.lang.IllegalStateException: No EJB receiver available for handling [appName:,modulename:Homework4Quartz,distinctname:] combination for invocation context [email protected] 
    at org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBClientContext.java:584) 
    at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:119) 
    at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:181) 
    at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:136) 
    at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:121) 
    at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:104) 
    at com.sun.proxy.$Proxy0.getMail(Unknown Source) 
    at hu.infokristaly.homework.ejb3client.Homework4EJB3Client.main(Homework4EJB3Client.java:100) 

를 사용하는 경우 내가 추가 사용자를 사용, quickstartUser, quickstartPassword, guest)도 상대방에 있습니다. 다른 컴퓨터에서 클라이언트와 서버를 어떻게 실행합니까?

답변

1

remote.connection.default.host에서 IP 주소 대신 hostname을 사용하면 모든 작업이 정상적으로 처리됩니다.