我正在尝试调用EJB但获得SASL PROPERTY:没有这样的归档错误。我已经添加了SASL jar“jboss-sasl-1.0.0.Beta1.jar”作为依赖。
这是我的代码:
Properties properties = new Properties();
properties.put("endpoint.name", "client-endpoint");
properties.put("remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED", "false");
properties.put("remote.connections", "default");
properties.put("remote.connection.default.host", "localhost");
properties.put("remote.connection.default.port", "4447");
properties.put("remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS", "false");
properties.put("remote.connection.default.username", "user");
properties.put("remote.connection.default.password", "pass");
EJBClientConfiguration cc = new PropertiesBasedEJBClientConfiguration(properties);
final ContextSelector<EJBClientContext> ejbClientContextSelector = new ConfigBasedEJBClientContextSelector(cc);
final ContextSelector<EJBClientContext> previousSelector = EJBClientContext.setSelector(ejbClientContextSelector);
StatelessEJBLocator<SomeClass> locator = new StatelessEJBLocator(SomeClass.class, "app", "module", "viewType", "distinctName");
SecurityDomainService ejb = org.jboss.ejb.client.EJBClient.createProxy(locator);`
但我得到了这个例外:
java.lang.NoSuchFieldError: SASL_PROPERTIES
org.jboss.ejb.client.PropertiesBasedEJBClientConfiguration.<clinit>(PropertiesBasedEJBClientConfiguration.java:79)
有人可以帮忙吗?
答案 0 :(得分:0)
事实证明我收到此错误是因为我没有使用正确的EJB客户端jar。
我猜jboss-ejb-client-1.0.16.Final.jar
引入了这个字段,与这个jar一起使用时效果很好。