Jakarta ee Wildfly JMS配置失败
我对wildfly的JMS配置有问题。应用程序在独立的完整配置文件上运行。我正在监视javax.security.sasl.SaslException,所以我想这是关于standalone full.xml的配置。另外,我在项目中有许多会话bean,但它们工作起来没有任何问题。您可以在下面查看相关文件Jakarta ee Wildfly JMS配置失败,jakarta-ee,jms,wildfly,Jakarta Ee,Jms,Wildfly,我对wildfly的JMS配置有问题。应用程序在独立的完整配置文件上运行。我正在监视javax.security.sasl.SaslException,所以我想这是关于standalone full.xml的配置。另外,我在项目中有许多会话bean,但它们工作起来没有任何问题。您可以在下面查看相关文件 谢谢您创建用户了吗?使用add-user.sh/bat properties.put(InitialContext.SECURITY_PRINCIPAL, "sevan.nerse"); pr
谢谢您创建用户了吗?使用add-user.sh/bat
properties.put(InitialContext.SECURITY_PRINCIPAL, "sevan.nerse");
properties.put(InitialContext.SECURITY_CREDENTIALS, "XXX");
是的,它是一个应用程序用户,并且拥有对ejb的访问权限。另外,我更喜欢使用数据库服务器登录模块,并且sevan.nerse被添加到用户表中。会话bean工作正常,但消息驱动bean有问题。
import java.io.Serializable;
import java.util.Properties;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.JMSException;
import javax.jms.MessageProducer;
import javax.jms.ObjectMessage;
import javax.jms.Queue;
import javax.jms.Session;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.jboss.logging.Logger;
public class JMSHelper
{
protected InitialContext ic = null;
protected ConnectionFactory connectionFactory = null;
protected Queue queue = null;
protected Connection connection = null;
protected String integrationHost = null;
private Logger logger = Logger.getLogger(JMSHelper.class);
public JMSHelper()
{
this("127.0.0.1");
}
public JMSHelper(String integrationHost)
{
this.integrationHost = integrationHost;
}
public void sendMessage(String destination, Serializable messageObject) throws NamingException, JMSException
{
sendMessage(destination, messageObject, 0);
}
public void sendMessage(String destination, Serializable messageObject, int status) throws NamingException,
JMSException
{
try
{
InitialContext ic = getInitialContext();
queue = (Queue) ic.lookup(destination);
logger.info("destination: " + destination);
logger.info("station: " + status);
Session session = createSession();
MessageProducer sender = session.createProducer(queue);
ObjectMessage messageImp = session.createObjectMessage(messageObject);
messageImp.setJMSExpiration(System.currentTimeMillis() + 5000);
messageImp.setIntProperty("status", status);
sender.send(messageImp);
}
catch (Exception exc)
{
logger.info("exception while sending message to : " + destination);
logger.error(exc.toString());
exc.printStackTrace();
}
finally
{
connection.close();
}
}
private Session createSession() throws NamingException, JMSException
{
InitialContext ic = getInitialContext();
connectionFactory = (ConnectionFactory) ic.lookup("ConnectionFactory");
connection = connectionFactory.createConnection();
return connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
}
private InitialContext getInitialContext() throws NamingException
{
if (ic == null)
{
Properties properties = new Properties();
properties.put(InitialContext.INITIAL_CONTEXT_FACTORY,
"org.jboss.naming.remote.client.InitialContextFactory");
properties.put(InitialContext.PROVIDER_URL, "http-remoting://" + integrationHost + ":8080");
properties.put(InitialContext.SECURITY_PRINCIPAL, "sevan.nerse");
properties.put(InitialContext.SECURITY_CREDENTIALS, "XXX");
properties.put(InitialContext.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
properties.put("jboss.naming.client.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT", "false");
properties.put("org.jboss.naming.client.ejb.context", true);
return (ic = new InitialContext(properties));
}
else
return ic;
}
}
15:28:36,575 WARN [org.xnio.option.parse] (EJB default - 8) XNIO000010: Invalid option 'org.xnio.Options.SASL_POLICY_NOPLAINTEXT' in property 'jboss.naming.client.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT': java.lang.IllegalArgumentException: XNIO000006: Class "org.xnio.Options" not found in ModuleClassLoader for Module "deployment.ikarus.ear.domain_service.jar:main" from Service Module Loader
15:28:36,649 ERROR [org.jboss.remoting.remote.connection] (Remoting "config-based-naming-client-endpoint" I/O-1) JBREM000200: Remote connection failed: javax.security.sasl.SaslException: Authentication failed: all available authentication mechanisms failed:
15:32:25,800 INFO [com.celebi.ikarus.structure.JMSHelper] (EJB default - 8) exception while sending message to : jms/queue/Flight_Queue
15:32:25,801 ERROR [com.celebi.ikarus.structure.JMSHelper] (EJB default - 8) javax.naming.AuthenticationException: Failed to connect to any server. Servers tried: [http-remoting://127.0.0.1:8080 (Authentication failed: all available authentication mechanisms failed:)] [Root exception is javax.security.sasl.SaslException: Authentication failed: all available authentication mechanisms failed:]
15:32:25,801 ERROR [stderr] (EJB default - 8) javax.naming.AuthenticationException: Failed to connect to any server. Servers tried: [http-remoting://127.0.0.1:8080 (Authentication failed: all available authentication mechanisms failed:)] [Root exception is javax.security.sasl.SaslException: Authentication failed: all available authentication mechanisms failed:]
properties.put(InitialContext.SECURITY_PRINCIPAL, "sevan.nerse");
properties.put(InitialContext.SECURITY_CREDENTIALS, "XXX");