我有一个包含一些文件和消息驱动bean的ejb文件。
当我运行我的ejb文件时,我收到了这个错误。
EJB容器初始化错误。
但是,当我从我的ejb中删除消息驱动的bean时。我的ejb可以顺利运行。
有关如何解决此问题的任何想法?
这里的Glassfish服务器出错 http://pastebin.com/HkyRFnwE
SEVERE: Exception while loading the app : EJB Container initialization error
java.lang.Exception
at com.sun.enterprise.connectors.inbound.ConnectorMessageBeanClient.setup(ConnectorMessageBeanClient.java:233)
at com.sun.ejb.containers.MessageBeanContainer.<init>(MessageBeanContainer.java:205)
at com.sun.ejb.containers.ContainerFactoryImpl.createContainer(ContainerFactoryImpl.java:121)
at org.glassfish.ejb.startup.EjbApplication.loadContainers(EjbApplication.java:230)
at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:305)
at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:108)
at org.glassfish.internal.data.ModuleInfo.load(ModuleInfo.java:186)
at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:264)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:460)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:389)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:348)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:363)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1085)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:95)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1291)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1259)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:461)
at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:212)
at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:179)
at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
at com.sun.enterprise.v3.services.impl.ContainerMapper$Hk2DispatcherCallable.call(ContainerMapper.java:354)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Thread.java:724)
Caused by: java.security.PrivilegedActionException: com.sun.appserv.connectors.internal.api.ConnectorRuntimeException
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.enterprise.connectors.inbound.ConnectorMessageBeanClient.getActivationSpec(ConnectorMessageBeanClient.java:257)
at com.sun.enterprise.connectors.inbound.ConnectorMessageBeanClient.setup(ConnectorMessageBeanClient.java:213)
... 36 more
Caused by: com.sun.appserv.connectors.internal.api.ConnectorRuntimeException
at com.sun.enterprise.connectors.util.SetMethodAction.handleException(SetMethodAction.java:152)
at com.sun.enterprise.connectors.util.SetMethodAction.run(SetMethodAction.java:136)
... 39 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.sun.enterprise.connectors.util.SetMethodAction.run(SetMethodAction.java:105)
... 39 more
Caused by: java.lang.IllegalArgumentException: MQJMSRA_AS4001: setSubscriptionDurability:Invalid subscriptionDurability=durable
at com.sun.messaging.jms.ra.ActivationSpec.setSubscriptionDurability(ActivationSpec.java:537)
... 44 more
答案 0 :(得分:0)
我猜你的EJB模块使用了EJBContainer。需要注意的是,EJBContainer仅支持不包含远程EJB和MDB的EJB lite。请参阅this link for details
EJBContainer主要用于在JUnit中进行测试,它不适用于生产代码。
答案 1 :(得分:0)
你得到了例外
引起:java.lang.IllegalArgumentException:MQJMSRA_AS4001: setSubscriptionDurability:无效的subscriptionDurability =持久
因为subscriptionDurability属性值区分大小写并且您将其指定为小写,即“持久”而不是持久的正确值(即首字母大写)
我遇到了同样的问题,这就是原因。
此属性使您可以配置主题的持久性 订户。持久的用户可以在任何连接断开的情况下继续存在 JMS服务器。
有效值为Durable和NonDurable。
可以使用以下MDB(消息驱动Bean)重现该问题:
@JMSDestinationDefinition(name = "BookingTopic", interfaceName = "javax.jms.Topic",
resourceAdapter = "jmsra", destinationName = "BookingTopic") @MessageDriven(activationConfig = {
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Topic"),
@ActivationConfigProperty(propertyName = "destinationLookup", propertyValue = "BookingTopic"),
@ActivationConfigProperty(propertyName = "subscriptionDurability", propertyValue = "durable"),
@ActivationConfigProperty(propertyName = "clientId", propertyValue = "BookingTopic"),
@ActivationConfigProperty(propertyName = "subscriptionName", propertyValue = "BookingTopic") }) public class ReservationNotifier implements MessageListener {
private static final Logger loggger = Logger.getLogger(ReservationNotifier.class.getSimpleName());
public ReservationNotifier() {
}
@Override
public void onMessage(Message message) {
try {
Booking booking = (Booking) ((ObjectMessage) message).getObject();
loggger.log(Level.INFO, "Sending e-mail containing reservation information to {0}", booking.getCustomer().getEmail());
} catch (JMSException ex) {
loggger.log(Level.SEVERE, "Error reading booking from topic");
}
}
}