1
votes

I have an ejb file that contains some files and a message driven bean.

When I run my ejb file, I got this error.

EJB Container initialization error.

However, when I remove the message driven bean from my ejb. My ejb can run smoothly.

Any ideas on how to resolve this issue?

Error of Glassfish server here 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
2

2 Answers

0
votes

I guess your EJB module uses the EJBContainer. A word of caution is that the EJBContainer only supports EJB lite which does not include remote EJBs nor MDBs. Refer to this link for details

EJBContainer is mainly for testing in JUnit, it is not meant for production code.

0
votes

You get the exception

Caused by: java.lang.IllegalArgumentException: MQJMSRA_AS4001: setSubscriptionDurability:Invalid subscriptionDurability=durable

because the subscriptionDurability property value is case sensitive and you specified it as lowercase, i.e. "durable" instead of the correct value of Durable (i.e. with first letter capitalized)

I've had the same problem and this was the cause.

This property enables you to configure the durability of the topic subscriber. Durable subscribers can survive any disconnection from the JMS server.

The valid values are Durable and NonDurable.

The problem can be reproduced with the following MDB (Message Driven 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");
        }
    }

}