0

OpenEJB のメッセージ駆動型 Bean でトピックを使用しようとしています。そこで、conf/openejb.xml を次のように編集しました。

<?xml version="1.0" encoding="UTF-8"?>
<openejb>
    <Resource id="TrueUpdate" type="javax.jms.Topic">
        destination = TrueUpdate
        clientId = nevermind
    </Resource>
</openejb>

私が得る使用bin/openejb properties

# Resource(id=TrueUpdate)
# className: org.apache.activemq.command.ActiveMQTopic
# 
TrueUpdate = new://Resource?type=javax.jms.Topic
TrueUpdate.destination = TrueUpdate
TrueUpdate.clientId = nevermind

これは問題ないようです。ただし、EAR ファイルをデプロイすると、次のようになります。

Exception: class org.apache.openejb.OpenEJBException: Unable to create activation spec: Invalid settings: subscriptionDurability cannot be set to: Durable when destinationType is set to javax.jms.Queue as it is only valid when destinationType is set to javax.jms.Topic. clientId must be set since durable subscription was requested.: Unable to create activation spec: Invalid settings: subscriptionDurability cannot be set to: Durable when destinationType is set to javax.jms.Queue as it is only valid when destinationType is set to javax.jms.Topic. clientId must be set since durable subscription was requested.
        at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:836)
        at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:546)
        at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:542)
        at org.apache.openejb.assembler.DeployerEjb.deploy(DeployerEjb.java:195)
        at org.apache.openejb.assembler.DeployerEjb.deploy(DeployerEjb.java:104)
        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 org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:181)
        at org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:163)
        at org.apache.openejb.security.internal.InternalSecurityInterceptor.invoke(InternalSecurityInterceptor.java:34)
        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 org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:181)
        at org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:163)
        at org.apache.openejb.cdi.CdiInterceptor.invoke(CdiInterceptor.java:126)
        at org.apache.openejb.cdi.CdiInterceptor.access$000(CdiInterceptor.java:42)
        at org.apache.openejb.cdi.CdiInterceptor$1.call(CdiInterceptor.java:63)
        at org.apache.openejb.cdi.CdiInterceptor.aroundInvoke(CdiInterceptor.java:69)
        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 org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:181)
        at org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:163)
        at org.apache.openejb.monitoring.StatsInterceptor.record(StatsInterceptor.java:176)
        at org.apache.openejb.monitoring.StatsInterceptor.invoke(StatsInterceptor.java:95)
        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 org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:181)
        at org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:163)
        at org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:138)
        at org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:239)
        at org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:191)
        at org.apache.openejb.server.ejbd.EjbRequestHandler.doEjbObject_BUSINESS_METHOD(EjbRequestHandler.java:290)
        at org.apache.openejb.server.ejbd.EjbRequestHandler.processRequest(EjbRequestHandler.java:140)
        at org.apache.openejb.server.ejbd.EjbDaemon.processEjbRequest(EjbDaemon.java:267)
        at org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:191)
        at org.apache.openejb.server.ejbd.EjbServer.service(EjbServer.java:81)
        at org.apache.openejb.server.ejbd.KeepAliveServer$Session.service(KeepAliveServer.java:273)
        at org.apache.openejb.server.ejbd.KeepAliveServer$Session.access$1000(KeepAliveServer.java:192)
        at org.apache.openejb.server.ejbd.KeepAliveServer.service(KeepAliveServer.java:326)
        at org.apache.openejb.server.ejbd.EjbServer.service(EjbServer.java:72)
        at org.apache.openejb.server.ServerServiceFilter.service(ServerServiceFilter.java:64)
        at org.apache.openejb.server.ServerServiceFilter.service(ServerServiceFilter.java:64)
        at org.apache.openejb.server.ServiceStats.service(ServiceStats.java:54)
        at org.apache.openejb.server.ServerServiceFilter.service(ServerServiceFilter.java:64)
        at org.apache.openejb.server.ServiceLogger.service(ServiceLogger.java:92)
        at org.apache.openejb.server.ServerServiceFilter.service(ServerServiceFilter.java:64)
        at org.apache.openejb.server.ServicePool.access$201(ServicePool.java:35)
        at org.apache.openejb.server.ServicePool$3.run(ServicePool.java:174)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:724)
Caused by: org.apache.openejb.OpenEJBException: Error deploying 'MessageListenerBean'.  Exception: class org.apache.openejb.OpenEJBException: Unable to create activation spec: Invalid settings: subscriptionDurability cannot be set to: Durable when destinationType is set to javax.jms.Queue as it is only valid when destinationType is set to javax.jms.Topic. clientId must be set since durable subscription was requested.: Unable to create activation spec: Invalid settings: subscriptionDurability cannot be set to: Durable when destinationType is set to javax.jms.Queue as it is only valid when destinationType is set to javax.jms.Topic. clientId must be set since durable subscription was requested.
        at org.apache.openejb.assembler.classic.Assembler.startEjbs(Assembler.java:974)
        at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:730)
        ... 58 more
Caused by: org.apache.openejb.OpenEJBException: Unable to create activation spec: Invalid settings: subscriptionDurability cannot be set to: Durable when destinationType is set to javax.jms.Queue as it is only valid when destinationType is set to javax.jms.Topic. clientId must be set since durable subscription was requested.
        at org.apache.openejb.core.mdb.MdbContainer.createActivationSpec(MdbContainer.java:251)
        at org.apache.openejb.core.mdb.MdbContainer.deploy(MdbContainer.java:136)
        at org.apache.openejb.assembler.classic.Assembler.startEjbs(Assembler.java:961)
        ... 59 more
Caused by: javax.resource.spi.InvalidPropertyException: Invalid settings: subscriptionDurability cannot be set to: Durable when destinationType is set to javax.jms.Queue as it is only valid when destinationType is set to javax.jms.Topic. clientId must be set since durable subscription was requested.
        at org.apache.activemq.ra.ActiveMQActivationSpec.validate(ActiveMQActivationSpec.java:136)
        at org.apache.openejb.core.mdb.MdbContainer.createActivationSpec(MdbContainer.java:229)
        ... 61 more

そして、ここに私の豆があります:

@MessageDriven(mappedName = "TrueUpdate",
        activationConfig = {
            @ActivationConfigProperty(propertyName = "messageSelector",
                                      propertyValue = "manager = true"),
            @ActivationConfigProperty(propertyName = "destinationType",
                                      propertyValue = "javax.jms.Topic"),
            @ActivationConfigProperty(propertyName = "destination",
                                      propertyValue = "TrueUpdate"),
            @ActivationConfigProperty(propertyName = "subscriptionDurability",
                                      propertyValue = "Durable"),
            @ActivationConfigProperty(propertyName = "subscriptionName",
                                      propertyValue = "TrueUpdate Manager"),
        })
public class MessageListenerBean implements MessageListener {
    ...
}

ここで何が間違っていますか?

4

2 に答える 2

1

私は同じ問題に遭遇し、次のことを試しました。それは動作します:

  1. クライアント ID を設定

     @ActivationConfigProperty (propertyName = "clientId", propertyValue = "clientIdxxx")
    
  2. 「destinationType」を「DestinationType」に更新

于 2013-12-04T08:33:23.197 に答える