Friday, January 23, 2026

Building Jakarta EE JMS MDB project for WebLogic Server 14.1.2 with Maven

 

HOWTO


See also

Git



Create Java EE project using Maven archetype


dave@dave:/git/weblogic/dave-basic-project-14.1.2$ mvn archetype:generate     -DarchetypeGroupId=com.oracle.weblogic.archetype     -DarchetypeArtifactId=basic-mdb     -DarchetypeVersion=14.1.2-0-0     -DgroupId=dave     -DartifactId=dave-basic-mdb-project     -Dversion=1.0-SNAPSHOT
[INFO] Scanning for projects...
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-assembly-plugin/3.7.1/maven-assembly-plugin-3.7.1.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-assembly-plugin/3.7.1/maven-assembly-plugin-3.7.1.pom (15 kB at 50 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-assembly-plugin/3.7.1/maven-assembly-plugin-3.7.1.jar
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-assembly-plugin/3.7.1/maven-assembly-plugin-3.7.1.jar (240 kB at 3.0 MB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-dependency-plugin/3.7.0/maven-dependency-plugin-3.7.0.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-dependency-plugin/3.7.0/maven-dependency-plugin-3.7.0.pom (19 kB at 622 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-dependency-plugin/3.7.0/maven-dependency-plugin-3.7.0.jar
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-dependency-plugin/3.7.0/maven-dependency-plugin-3.7.0.jar (207 kB at 4.0 MB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml (14 kB at 230 kB/s)
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml (21 kB at 264 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-archetype-plugin/maven-metadata.xml
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-archetype-plugin/maven-metadata.xml (1.1 kB at 39 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-archetype-plugin/3.4.1/maven-archetype-plugin-3.4.1.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-archetype-plugin/3.4.1/maven-archetype-plugin-3.4.1.pom (11 kB at 313 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/archetype/maven-archetype/3.4.1/maven-archetype-3.4.1.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/archetype/maven-archetype/3.4.1/maven-archetype-3.4.1.pom (9.8 kB at 308 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-parent/45/maven-parent-45.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-parent/45/maven-parent-45.pom (53 kB at 1.8 MB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/apache/35/apache-35.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/apache/35/apache-35.pom (24 kB at 782 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/groovy/groovy-bom/4.0.28/groovy-bom-4.0.28.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/groovy/groovy-bom/4.0.28/groovy-bom-4.0.28.pom (27 kB at 941 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/junit/junit-bom/5.13.1/junit-bom-5.13.1.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/junit/junit-bom/5.13.1/junit-bom-5.13.1.pom (5.6 kB at 182 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-archetype-plugin/3.4.1/maven-archetype-plugin-3.4.1.jar
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-archetype-plugin/3.4.1/maven-archetype-plugin-3.4.1.jar (100 kB at 2.7 MB/s)
[INFO] 
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO] 
[INFO] >>> archetype:3.4.1:generate (default-cli) > generate-sources @ standalone-pom >>>
[INFO] 
[INFO] <<< archetype:3.4.1:generate (default-cli) < generate-sources @ standalone-pom <<<
[INFO] 
[INFO] 
[INFO] --- archetype:3.4.1:generate (default-cli) @ standalone-pom ---
D[INFO] Generating project in Interactive mode
Downloading from central: https://repo.maven.apache.org/maven2/archetype-catalog.xml
Downloaded from central: https://repo.maven.apache.org/maven2/archetype-catalog.xml (18 MB at 57 MB/s)
[WARNING] Archetype not found in any catalog. Falling back to central repository.
[WARNING] Add a repository with id 'archetype' in your settings.xml if archetype's repository is elsewhere.
[INFO] Using property: groupId = dave
[INFO] Using property: artifactId = dave-basic-mdb-project
[INFO] Using property: version = 1.0-SNAPSHOT
[INFO] Using property: package = dave
Confirm properties configuration:
groupId: dave
artifactId: dave-basic-mdb-project
version: 1.0-SNAPSHOT
package: dave
 Y: 
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Archetype: basic-mdb:14.1.2-0-0
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: dave
[INFO] Parameter: artifactId, Value: dave-basic-mdb-project
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: package, Value: dave
[INFO] Parameter: packageInPathFormat, Value: dave
[INFO] Parameter: package, Value: dave
[INFO] Parameter: groupId, Value: dave
[INFO] Parameter: artifactId, Value: dave-basic-mdb-project
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Project created from Archetype in dir: /git/weblogic/dave-basic-project-14.1.2/dave-basic-mdb-project
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  7.442 s
[INFO] Finished at: 2026-01-23T20:47:42+01:00
[INFO] ------------------------------------------------------------------------



Send to queue 

  @Resource(mappedName = "myConnectionFactory")
  private ConnectionFactory connectionFactory;

  @Resource(mappedName = "myJmsQueue")
  private Queue accountQueue;

  public void depositJms() throws JMSException{
    try{
      javax.jms.Connection connection = connectionFactory.createConnection();
      Session accountSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
      MessageProducer messageProducer = accountSession.createProducer(accountQueue);
      
      Message message = accountSession.createMessage();
      message.setStringProperty("name", name);
      message.setFloatProperty("amount", amount);
      
      messageProducer.send(message);
    } catch (JMSException e) {
      e.printStackTrace();
      throw e;
    }
    
    msg = "A message with the deposit request has been sent, please check the console output of the server to verify it was received";
  }

MDB



package dave.jms.destination;

import java.text.NumberFormat;
import javax.annotation.Resource;
import javax.ejb.ActivationConfigProperty;
import javax.ejb.MessageDriven;
import javax.ejb.MessageDrivenContext;
import javax.jms.Message;
import javax.jms.MessageListener;

/**
 * @author Copyright (c) 2011,2013, Oracle and/or its affiliates. All rights reserved.
 *
 * Message driven bean used to process messages.
 */

@MessageDriven(
  mappedName = "myJmsQueue",
  activationConfig = {
    @ActivationConfigProperty(
      propertyName  = "destinationType", 
      propertyValue = "javax.jms.Queue"),   
      
    @ActivationConfigProperty(
      propertyName  = "acknowledgeMode",
      propertyValue = "Auto-acknowledge")
  }
)
public class QueueMDB implements MessageListener {
    
  private final NumberFormat currencyFormatter = NumberFormat.getCurrencyInstance();    
  
  @Resource
  private MessageDrivenContext mdctx;
  
  public QueueMDB() {
    
  }
  
  public void onMessage(Message message) {
    try{
      System.out.println("The money has been deposited to " + message.getStringProperty("name") +  ", for the amount of " + currencyFormatter.format(message.getFloatProperty("amount")));
        
    } catch (Exception e) {
      e.printStackTrace();
      mdctx.setRollbackOnly();
    }
  }

}


List Weblogic JMS queue configuration

  /app/weblogic-14.1.2/oracle_common/common/bin/wlst.sh src/main/scripts/list_queue_attrs.py

Initializing WebLogic Scripting Tool (WLST) ...

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

Connecting to t3://127.0.0.1:7001 with userid weblogic ...
Successfully connected to Admin Server "AdminServer" that belongs to domain "dave_domain".

Warning: An insecure protocol was used to connect to the server. 
To ensure on-the-wire security, the SSL port or Admin port should be used instead.

Location changed to edit tree.   
This is a writable tree with DomainMBean as the root.    
To make changes you will need to start an edit session via startEdit(). 
For more help, use help('edit').
You already have an edit session in progress and hence WLST will 
continue with your edit session.

Starting an edit session ...
Started edit session, be sure to save and activate your changes once you are done.
dr--   DeliveryFailureParams
dr--   DeliveryParamsOverrides
dr--   MessageLoggingParams
dr--   Quota
dr--   Template
dr--   Thresholds

-rw-   AttachSender                                 supports
-rw-   ConsumptionPausedAtStartup                   false
-rw-   DefaultTargetingEnabled                      false
-rw-   DefaultUnitOfOrder                           false
-rw-   DestinationKeys                              null
-rw-   ForwardDelay                                 -1
-r--   Id                                           0
-rw-   IncompleteWorkExpirationTime                 -1
-rw-   InsertionPausedAtStartup                     false
-rw-   JMSCreateDestinationIdentifier               null
-rw-   JNDIName                                     myJmsQueue
-rw-   LoadBalancingPolicy                          Round-Robin
-rw-   LocalJNDIName                                null
-rw-   MaximumMessageSize                           2147483647
-rw-   MessagingPerformancePreference               25
-rw-   Name                                         myJmsQueue
-rw-   Notes                                        null
-rw-   ProductionPausedAtStartup                    false
-rw-   Quota                                        null
-rw-   ResetDeliveryCountOnForward                  true
-rw-   SAFExportPolicy                              All
-rw-   SubDeploymentName                            subDep
-rw-   Template                                     null
-rw-   UnitOfOrderRouting                           Hash
-rw-   UnitOfWorkHandlingPolicy                     PassThrough

-r-x   addDestinationKey                            Void : String(destinationKey)
-r-x   isSet                                        Boolean : String(propertyName)
-r-x   removeDestinationKey                         Void : String(destinationKey)
-r-x   unSet                                        Void : String(propertyName)

Edit session is cancelled successfully.
Disconnected from weblogic server: AdminServer


Exiting WebLogic Scripting Tool.

Enable JMS logging

$ cat   /app/weblogic-14.1.2/oracle_common/common/bin/wlst.sh src/main/scripts/enable_logging_final.py
#!/bin/sh

SCRIPTNAME=$0
SCRIPTPATH=`dirname "${SCRIPTNAME}"`
MW_HOME=`cd "${SCRIPTPATH}/../../.." ; pwd`
export MW_HOME
# Delegate to the common delegation script ...
"${SCRIPTPATH}/fmwconfig_common.sh" wlst_internal.sh "$@"


try:
    connect('weblogic', 'weblogic123', 't3://127.0.0.1:7001')
    edit()
    startEdit()
    
    queuePath = '/JMSSystemResources/myJmsSystemResource/JMSResource/myJmsSystemResource/Queues/myJmsQueue/MessageLoggingParams/myJmsQueue'
    
    print("Navigating to MessageLoggingParams...")
    try:
        cd(queuePath)
    except:
        print("Direct path failed, trying list...")
        cd('/JMSSystemResources/myJmsSystemResource/JMSResource/myJmsSystemResource/Queues/myJmsQueue/MessageLoggingParams')
        ls()
        # Assume the single child is the one we want
        # In WLST, sometimes we need to pick the specific name if it wasn't auto-named
        kids = cmo.getMessageLoggingParams()
        # But in edit tree we cd.
        # Let's try cd to the first child found in ls() if possible, but manual is safer
        cd('myJmsQueue')
        
    print("Enabling Message Logging...")
    cmo.setMessageLoggingEnabled(True)
    cmo.setMessageLoggingFormat("%header%,%properties%")
    
    save()
    activate()
    print("JMS Queue Message Logging enabled successfully.")
    
except Exception as e:
    print("Error: " + str(e))
    cancelEdit('y')
    exit(exitcode=1)

disconnect()
exit()

Show JMS log


dave@dave:/git/weblogic/dave-basic-project-14.1.2/dave-basic-webapp-ejb-project$  ls -l /app/domains/dave_domain/servers/AdminServer/logs/jmsservers/myJMSServer/
total 4
-rw-r-----. 1 dave dave 2389 Jan 23 23:07 myJMSServer-jms.messages.log
dave@dave:/git/weblogic/dave-basic-project-14.1.2/dave-basic-webapp-ejb-project$  tail -n 20 /app/domains/dave_domain/servers/AdminServer/logs/jmsservers/myJMSServer/myJMSServer-jms.messages.log
####<Jan 23, 2026, 11:07:31,902 PM Central European Standard Time> <> <> <1769206051902> <116244> <ID:<974816.1769206051889.0>> <> <myJmsSystemResource!myJmsQueue> <Produced> <weblogic> <> <&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;mes:WLJMSMessage xmlns:mes="http://www.bea.com/WLS/JMS/Message"&gt;&lt;mes:Header&gt;&lt;mes:JMSDeliveryMode&gt;PERSISTENT&lt;/mes:JMSDeliveryMode&gt;&lt;mes:JMSExpiration&gt;0&lt;/mes:JMSExpiration&gt;&lt;mes:JMSPriority&gt;4&lt;/mes:JMSPriority&gt;&lt;mes:JMSRedelivered&gt;false&lt;/mes:JMSRedelivered&gt;&lt;mes:JMSTimestamp&gt;1769206051889&lt;/mes:JMSTimestamp&gt;&lt;mes:Properties&gt;&lt;mes:property name="amount"&gt;&lt;mes:Float&gt;100.5&lt;/mes:Float&gt;&lt;/mes:property&gt;&lt;mes:property name="name"&gt;&lt;mes:String&gt;john.doe&lt;/mes:String&gt;&lt;/mes:property&gt;&lt;mes:property name="JMS_BEA_DeliveryTime"&gt;&lt;mes:Long&gt;1769206051889&lt;/mes:Long&gt;&lt;/mes:property&gt;&lt;mes:property name="JMSXDeliveryCount"&gt;&lt;mes:Int&gt;0&lt;/mes:Int&gt;&lt;/mes:property&gt;&lt;/mes:Properties&gt;&lt;/mes:Header&gt;&lt;/mes:WLJMSMessage&gt;> <> 
####<Jan 23, 2026, 11:07:31,967 PM Central European Standard Time> <BEA1-64B3874E479C50BE51E2-574C53746F72655F646176655F646F6D61696E5F5F574C535F41646D696E536572766572> <> <1769206051967> <308200> <ID:<974816.1769206051889.0>> <> <myJmsSystemResource!myJmsQueue> <Consumed> <<anonymous>> <MC:CA(local):OAMI(AdminServer.jms.connection30.session74.consumer76)> <&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;mes:WLJMSMessage xmlns:mes="http://www.bea.com/WLS/JMS/Message"&gt;&lt;mes:Header&gt;&lt;mes:JMSDeliveryMode&gt;PERSISTENT&lt;/mes:JMSDeliveryMode&gt;&lt;mes:JMSExpiration&gt;0&lt;/mes:JMSExpiration&gt;&lt;mes:JMSPriority&gt;4&lt;/mes:JMSPriority&gt;&lt;mes:JMSRedelivered&gt;false&lt;/mes:JMSRedelivered&gt;&lt;mes:JMSTimestamp&gt;1769206051889&lt;/mes:JMSTimestamp&gt;&lt;mes:Properties&gt;&lt;mes:property name="amount"&gt;&lt;mes:Float&gt;100.5&lt;/mes:Float&gt;&lt;/mes:property&gt;&lt;mes:property name="name"&gt;&lt;mes:String&gt;john.doe&lt;/mes:String&gt;&lt;/mes:property&gt;&lt;mes:property name="JMS_BEA_DeliveryTime"&gt;&lt;mes:Long&gt;1769206051889&lt;/mes:Long&gt;&lt;/mes:property&gt;&lt;mes:property name="JMSXDeliveryCount"&gt;&lt;mes:Int&gt;1&lt;/mes:Int&gt;&lt;/mes:property&gt;&lt;/mes:Properties&gt;&lt;/mes:Header&gt;&lt;/mes:WLJMSMessage&gt;> <> 
dave@dave:/git/weblogic/dave-basic-project-14.1.2/dave-basic-webapp-ejb-project$