EJBCLIENT000025: Приемник EJB недоступен для обработки [имя_приложения :, имя_модуля: EJB_projectTP1_Server, имя_различия:] - PullRequest
0 голосов
/ 09 ноября 2019

Я использую Wildfly 8.x, и я не знаю, почему у меня есть эта ошибка. Я пытаюсь добавить в свой ejb-jar, но ничего.

Я также, удаляю сервер и настраиваю его сноваи ничего тоже.

Мой главный в моем EJB_Client> appClientModule> (пакет по умолчанию):

import java.util.Properties;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

import org.jboss.ejb.client.EJBClientConfiguration;
import org.jboss.ejb.client.EJBClientContext;
import org.jboss.ejb.client.PropertiesBasedEJBClientConfiguration;
import org.jboss.ejb.client.remoting.ConfigBasedEJBClientContextSelector;

import welcome.RemoteWelcome;
import welcome.WelcomeBean;

public class Main {
    public static void main(String[] args) throws NamingException {
        RemoteWelcome remoteWelcome = lookupRemoteWelcome();
        String message = remoteWelcome.sendWelcomeMessage("Salut");
    }

    /* (non-Java-doc)
     * @see java.lang.Object#Object()
     */
    public Main() {
        super();
    }

    public static RemoteWelcome lookupRemoteWelcome() throws NamingException {
        Properties properties = new Properties();
        properties.put("Options.SSL_ENABLED", "false");
        properties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
        properties.put("remote.connections", "default");
        properties.put("remote.connection.default.host", "localhost");
        properties.put("remote.connection.default.port", "8080");
        properties.put("remote.connection.default.username", "application"); //Soit admin soit application (idem pour les mot des passe)
        properties.put("remote.connection.default.password", "application");

        EJBClientConfiguration ejbConfig = new PropertiesBasedEJBClientConfiguration(properties);
        ConfigBasedEJBClientContextSelector configSelector = new ConfigBasedEJBClientContextSelector(ejbConfig);
        EJBClientContext.setSelector(configSelector);
        final Context context = new InitialContext(properties);

        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 = "EJB_Project_TP1_Client";
        // 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 = "EJB_projectTP1_Server";
        // The EJB name which by default is the simple class name of the bean implementation class
        final String beanName = WelcomeBean.class.getSimpleName();
        // the remote view fully qualified class name
        final String viewClassName = RemoteWelcome.class.getName();
        // let's do the lookup

        System.out.println("ejb:" + appName + "/" + moduleName + "/" + distinctName + "/" + beanName + "!" + viewClassName);
        return (RemoteWelcome) context.lookup("ejb:" + appName + "/" + moduleName + "/" + distinctName + "/" + beanName + "!" + viewClassName);

        //return (RemoteWelcome) context.lookup("ejb:/EJB_Project_TP1_Client/EJB_projectTP1_Server/WelcomeBean!welcome.RemoteWelcome");         
    }

}

В EJB_projectTP1_Server у меня есть:

Мой удаленный интерфейс

package welcome;

import javax.ejb.Remote;

@Remote
public interface RemoteWelcome {
    public String sendWelcomeMessage(String message);

}

И мой боб

package welcome;

import javax.ejb.LocalBean;
import javax.ejb.Stateless;

/**
 * Session Bean implementation class WelcomeBean
 */
@Stateless
@LocalBean
public class WelcomeBean implements RemoteWelcome {

    /**
     * Default constructor. 
     */
    public WelcomeBean() {
        // TODO Auto-generated constructor stub
    }

    public String sendWelcomeMessage(String message){
        //Send the message
        String messageToSend = "Bienvenue " + message;
        System.out.println(messageToSend);
        return messageToSend;
    }

}

Мой ejb-jar.xml:

<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar version="3.2" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/ejb-jar_3_2.xsd">
  <display-name>EJB_projectTP1</display-name>
 </ejb-jar>

Кто-нибудь может мне помочь, пожалуйста? Мой учитель тоже не понимает.

...