Ask Experts Questions for FREE Help !
Ask
    mtarun83's Avatar
    mtarun83 Posts: 1, Reputation: 1
    New Member
     
    #1

    Feb 26, 2013, 09:48 AM
    ask questions of java
    Hi,

    I have written the code to read messages from queue.But when I deploy this in weblogic 9.2 after creating a jar file it is showing unmarshaller failed
    Below is the code

    MyMdb.java


    package com.mdb.ejb;

    import javax.ejb.EJBException;
    import javax.ejb.MessageDrivenBean;
    import javax.ejb.MessageDrivenContext;
    import javax.jms.JMSException;
    import javax.jms.Message;
    import javax.jms.MessageListener;
    import javax.jms.TextMessage;

    /**
    * Message-Driven Bean implementation class for: MyMdb
    *
    */


    public class MyMdb implements javax.ejb.MessageDrivenBean,javax.jms.MessageListe ner {

    /**
    *
    */
    private static final long serialVersionUID = 1L;

    /**
    * Default constructor.
    */
    public MyMdb() {
    // TODO Auto-generated constructor stub
    }

    /**
    * @see MessageListener#onMessage(Message)
    */
    public void onMessage(Message message) {
    // TODO Auto-generated method stub
    System.out.println("on two thtr ");
    TextMessage textMessage = (TextMessage) message;

    try {
    System.out.println("\n\n\t(mdb) MyMDB Received \n"+ textMessage.getText());
    SendMail.sendMail(textMessage.getText());
    }
    catch (JMSException e)
    {
    e.printStackTrace();
    }

    }

    public void ejbRemove() throws EJBException {
    // TODO Auto-generated method stub

    }

    public void setMessageDrivenContext(MessageDrivenContext arg0)
    throws EJBException {
    // TODO Auto-generated method stub

    }

    }





    ejb-jar.xml


    <?xml version="1.0" encoding="UTF-8"?>
    <ejb-jar
    xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"
    version="2.1">
    <enterprise-beans>
    <message-driven>
    <ejb-name>MyMdb</ejb-name>
    <ejb-class>com.mdb.ejb.MyMdb</ejb-class>
    <transaction-type>Container</transaction-type>
    <activation-config>
    <activation-config-property>
    <activation-config-property-name>destinationType</activation-config-property-name>
    <activation-config-property-value>javax.jms.Queue</activation-config-property-value>
    </activation-config-property>
    </activation-config>
    <env-entry>
    <env-entry-name>isTransacted</env-entry-name>
    <env-entry-type>java.lang.String</env-entry-type>
    <env-entry-value>true</env-entry-value>
    </env-entry>
    <env-entry>
    <env-entry-name>isJmsRedeliveredBroken</env-entry-name>
    <env-entry-type>java.lang.String</env-entry-type>
    <env-entry-value>false</env-entry-value>
    </env-entry>
    </message-driven>
    </enterprise-beans>
    <assembly-descriptor>
    <container-transaction>
    <method>
    <ejb-name>MyMdb</ejb-name>
    <method-name>onMessage</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    </assembly-descriptor>
    </ejb-jar>


    weblogic-ejb-jar.xml

    <weblogic-ejb-jar
    xmlns="http://www.bea.com/ns/weblogic/90"
    xmlns:j2ee="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic-ejb-jar.xsd">
    <weblogic-enterprise-bean>
    <ejb-name>MyMdb</ejb-name>
    <message-driven-descriptor>
    <pool>
    <max-beans-in-free-pool>10</max-beans-in-free-pool>
    <initial-beans-in-free-pool>10</initial-beans-in-free-pool>
    </pool>
    <destination-jndi-name>qjndi</destination-jndi-name>
    <connection-factory-jndi-name>cfjndi</connection-factory-jndi-name>
    </message-driven-descriptor>
    </weblogic-enterprise-bean>
    </weblogic-ejb-jar>

    It is shwoing below mentioned exception

    An error occurred during activation of changes, please see the log for details.
    ?? Exception preparing module: EJBModule(MessageDrivenBeanProject) Unable to deploy EJB: MessageDrivenBeanProject.jar from MessageDrivenBeanProject.jar: There are 2 nested errors: weblogic.ejb.container.compliance.ComplianceExcept ion: In EJB MyMdb, the message-driven bean class must implement the javax.ejb.MessageDrivenBean interface. At weblogic.ejb.container.compliance.MessageDrivenBea nClassChecker.checkMessageDrivenImplementsMDB(Mess ageDrivenBeanClassChecker.java:54) at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:592) at weblogic.ejb.container.compliance.EJBComplianceChe cker.check(EJBComplianceChecker.java:262) at weblogic.ejb.container.compliance.EJBComplianceChe cker.checkDeploymentInfo(EJBComplianceChecker.java :216) at weblogic.ejb.container.ejbc.EJBCompiler.compliance CheckJar(EJBCompiler.java:875) at weblogic.ejb.container.ejbc.EJBCompiler.checkCompl iance(EJBCompiler.java:843) at weblogic.ejb.container.ejbc.EJBCompiler.doCompile( EJBCompiler.java:229) at weblogic.ejb.container.ejbc.EJBCompiler.compileEJB (EJBCompiler.java:497) at weblogic.ejb.container.ejbc.EJBCompiler.compileEJB (EJBCompiler.java:464) at weblogic.ejb.container.deployer.EJBDeployer.runEJB C(EJBDeployer.java:432) at weblogic.ejb.container.deployer.EJBDeployer.compil eJar(EJBDeployer.java:754) at weblogic.ejb.container.deployer.EJBDeployer.compil eIfNecessary(EJBDeployer.java:657) at weblogic.ejb.container.deployer.EJBDeployer.prepar e(EJBDeployer.java:1201) at weblogic.ejb.container.deployer.EJBModule.prepare( EJBModule.java:355) at weblogic.application.internal.flow.ModuleListenerI nvoker.prepare(ModuleListenerInvoker.java:93) at weblogic.application.internal.flow.DeploymentCallb ackFlow$1.next(DeploymentCallbackFlow.java:360) at weblogic.application.utils.StateMachineDriver.next State(StateMachineDriver.java:26) at weblogic.application.internal.flow.DeploymentCallb ackFlow.prepare(DeploymentCallbackFlow.java:56) at weblogic.application.internal.flow.DeploymentCallb ackFlow.prepare(DeploymentCallbackFlow.java:46) at weblogic.application.internal.BaseDeployment$1.nex t(BaseDeployment.java:615) at weblogic.application.utils.StateMachineDriver.next State(StateMachineDriver.java:26) at weblogic.application.internal.BaseDeployment.prepa re(BaseDeployment.java:191) at weblogic.application.internal.DeploymentStateCheck er.prepare(DeploymentStateChecker.java:147) at weblogic.deploy.internal.targetserver.AppContainer Invoker.prepare(AppContainerInvoker.java:61) at weblogic.deploy.internal.targetserver.operations.A ctivateOperation.createAndPrepareContainer(Activat eOperation.java:189) at weblogic.deploy.internal.targetserver.operations.A ctivateOperation.doPrepare(ActivateOperation.java: 87) at weblogic.deploy.internal.targetserver.operations.A bstractOperation.prepare(AbstractOperation.java:21 7) at weblogic.deploy.internal.targetserver.DeploymentMa nager.handleDeploymentPrepare(DeploymentManager.ja va:718) at weblogic.deploy.internal.targetserver.DeploymentMa nager.prepareDeploymentList(DeploymentManager.java :1185) at weblogic.deploy.internal.targetserver.DeploymentMa nager.handlePrepare(DeploymentManager.java:247) at weblogic.deploy.internal.targetserver.DeploymentSe rviceDispatcher.prepare(DeploymentServiceDispatche r.java:157) at weblogic.deploy.service.internal.targetserver.Depl oymentReceiverCallbackDeliverer.doPrepareCallback( DeploymentReceiverCallbackDeliverer.java:157) at weblogic.deploy.service.internal.targetserver.Depl oymentReceiverCallbackDeliverer.access$000(Deploym entReceiverCallbackDeliverer.java:12) at weblogic.deploy.service.internal.targetserver.Depl oymentReceiverCallbackDeliverer$1.run(DeploymentRe ceiverCallbackDeliverer.java:45) at weblogic.work.ServerWorkManagerImpl$WorkAdapterImp l.run(ServerWorkManagerImpl.java:518) at weblogic.work.ExecuteThread.execute(ExecuteThread. java:209) at weblogic.work.ExecuteThread.run(ExecuteThread.java :181) and weblogic.ejb.container.compliance.ComplianceExcept ion: In EJB MyMdb, a Message-driven EJB must define an ejbCreate method that takes no parameters. At weblogic.ejb.container.compliance.MessageDrivenBea nClassChecker.checkEjbCreateMethod(MessageDrivenBe anClassChecker.java:401) at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:592) at weblogic.ejb.container.compliance.EJBComplianceChe cker.check(EJBComplianceChecker.java:262) at weblogic.ejb.container.compliance.EJBComplianceChe cker.checkDeploymentInfo(EJBComplianceChecker.java :216) at weblogic.ejb.container.ejbc.EJBCompiler.compliance CheckJar(EJBCompiler.java:875) at weblogic.ejb.container.ejbc.EJBCompiler.checkCompl iance(EJBCompiler.java:843) at weblogic.ejb.container.ejbc.EJBCompiler.doCompile( EJBCompiler.java:229) at weblogic.ejb.container.ejbc.EJBCompiler.compileEJB (EJBCompiler.java:497) at weblogic.ejb.container.ejbc.EJBCompiler.compileEJB (EJBCompiler.java:464) at weblogic.ejb.container.deployer.EJBDeployer.runEJB C(EJBDeployer.java:432) at weblogic.ejb.container.deployer.EJBDeployer.compil eJar(EJBDeployer.java:754) at weblogic.ejb.container.deployer.EJBDeployer.compil eIfNecessary(EJBDeployer.java:657) at weblogic.ejb.container.deployer.EJBDeployer.prepar e(EJBDeployer.java:1201) at weblogic.ejb.container.deployer.EJBModule.prepare( EJBModule.java:355) at weblogic.application.internal.flow.ModuleListenerI nvoker.prepare(ModuleListenerInvoker.java:93) at weblogic.application.internal.flow.DeploymentCallb ackFlow$1.next(DeploymentCallbackFlow.java:360) at weblogic.application.utils.StateMachineDriver.next State(StateMachineDriver.java:26) at weblogic.application.internal.flow.DeploymentCallb ackFlow.prepare(DeploymentCallbackFlow.java:56) at weblogic.application.internal.flow.DeploymentCallb ackFlow.prepare(DeploymentCallbackFlow.java:46) at weblogic.application.internal.BaseDeployment$1.nex t(BaseDeployment.java:615) at weblogic.application.utils.StateMachineDriver.next State(StateMachineDriver.java:26) at weblogic.application.internal.BaseDeployment.prepa re(BaseDeployment.java:191) at weblogic.application.internal.DeploymentStateCheck er.prepare(DeploymentStateChecker.java:147) at weblogic.deploy.internal.targetserver.AppContainer Invoker.prepare(AppContainerInvoker.java:61) at weblogic.deploy.internal.targetserver.operations.A ctivateOperation.createAndPrepareContainer(Activat eOperation.java:189) at weblogic.deploy.internal.targetserver.operations.A ctivateOperation.doPrepare(ActivateOperation.java: 87) at weblogic.deploy.internal.targetserver.operations.A bstractOperation.prepare(AbstractOperation.java:21 7) at weblogic.deploy.internal.targetserver.DeploymentMa nager.handleDeploymentPrepare(DeploymentManager.ja va:718) at weblogic.deploy.internal.targetserver.DeploymentMa nager.prepareDeploymentList(DeploymentManager.java :1185) at weblogic.deploy.internal.targetserver.DeploymentMa nager.handlePrepare(DeploymentManager.java:247) at weblogic.deploy.internal.targetserver.DeploymentSe rviceDispatcher.prepare(DeploymentServiceDispatche r.java:157) at weblogic.deploy.service.internal.targetserver.Depl oymentReceiverCallbackDeliverer.doPrepareCallback( DeploymentReceiverCallbackDeliverer.java:157) at weblogic.deploy.service.internal.targetserver.Depl oymentReceiverCallbackDeliverer.access$000(Deploym entReceiverCallbackDeliverer.java:12) at weblogic.deploy.service.internal.targetserver.Depl oymentReceiverCallbackDeliverer$1.run(DeploymentRe ceiverCallbackDeliverer.java:45) at weblogic.work.ServerWorkManagerImpl$WorkAdapterImp l.run(ServerWorkManagerImpl.java:518) at weblogic.work.ExecuteThread.execute(ExecuteThread. java:209) at weblogic.work.ExecuteThread.run(ExecuteThread.java :181)??
    ?? There are 2 nested errors: weblogic.ejb.container.compliance.ComplianceExcept ion: In EJB MyMdb, the message-driven bean class must implement the javax.ejb.MessageDrivenBean interface.?

Check out some similar questions!

Ask java questions live free [ 1 Answers ]

I am having trouble with this question "Design and write an algorithm that will read a single word from the keyboard and prints to the screen whether this word is a palindrome or not. A palindrome is a word; (or sentence, but for this question we are only dealing with a single word); that is spelt...

Forum to ask questions about java [ 0 Answers ]

Hi all, I need to read following xml using java.. could you please help me in this? <LINE>002:OR,004:0001,002:01,002:01,007:SCEM_02,000:,007:590,000,002:KG,002:PC;/</LINE>

Ask questions regarding java [ 0 Answers ]

) If any situation system is goes in deadlock condition,how you can recover from that situation programmitically. b) How you can decide when to use static class or interface. What is difference between the two. Which one is better to use in which situation.

Java questions - I need the answers [ 3 Answers ]

Declare each of the following: (a) a field of data type boolean and name isFound; (b) a local variable of data type String and name carModel; (c) a field of data type double and name weight; (d) a field of data type Employee and name secretary. 2. Write a declaration for an array variable...


View more questions Search
 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.