cancel
Showing results for 
Search instead for 
Did you mean: 

Setting a DATE property in a custom type.

marcog
Star Contributor
Star Contributor
I'm using Alfresco ECM 23.1 in Docker in Ubuntu Linux 18.04 building with Maven SDK AIO 4.7. I built a Java class for a folder rule that applies logic to rename the actionedUponNodeRef document after calculating and setting a DATE property in a custom type.
 
The problem I have is that the class works perfectly renaming the document but does not save the DATE property.
 
The DATE property does not need to be set every time and the name does not need to be set every time. Sometimes both values are set.
 
I set the name so:
 
FileInfo renamedFileInfo = serviceRegistry.getFileFolderService().rename(actionedUponNodeRef, newDocName);
 
I set the DATE property so:
 
nodeService.setProperty(actionedUponNodeRef, qnameProp, (Serializable)newDate);
 
newDate is type LocalDate. I also tied it without (Serializable) and also with "new Date()" (java.util.Date). I verified that qnameProp is the correct QName. No error is reported.
 
In the logic of the class I can read the property I set this way:
 
String newDateRead = nodeService.getProperty(actionedUponNodeRef, qnameProp).toString();
 
At the end of processing I always see this error and sometimes also during processing:
 
"proj-acs_1       | 2025-03-10T01:14:35,907 [] ERROR [repo.event2.EnqueuingEventSender] [eventAsyncDequeueThreadPool1] Unexpected error while dequeuing and sending repository event org.alfresco.error.AlfrescoRuntimeException: 02100041 Could not send event"
 
I suppose this is the reason the property is not set.
 
Any pointers of what I'm doing wrong?
 
Thanks
 
Marco Gianini
9 REPLIES 9

LeoMattioli
Employee
Employee

Hi Marco, do you have ActiveMQ running?

It seems to me that repo is trying to send the node update to ActiveMQ but it's failing.

Remember that if you don't want to send the events, in the alfresco-global.properties you can set

repo.event2.enabled=false

Hope this helps.


Leo Mattioli - Technical Account Manager @Hyland.

Hi LeoMattioli,
 
Thanks for the idea; it sounds very reasonable. 
 
I confirmed that ActiveMQ is running and I increased the time out in case my dev hardware is causing the problem:
 
In docker-compose.yml where the default timeout was 3000:

-Dmessaging.broker.url=\"failovernio://vli-activemq:61616)?timeout=10000&jms.useCompression=true\"
 
This is the console. Is there anything special I should look for? (I was upload the image of ActiveMQ).
 
I also tired it with alfresco-global.properties like this with true and false (in this case the name is also not saved):
 
repo.event2.enabled=false
 
The name is always saved correctly (except when repo.event2.enabled is false) even when the error message is shown.
 
If I comment out saving the date property the error message is still shown but the name is saved:
 
 2025-03-12T13:35:23,084 [] ERROR [repo.event2.EnqueuingEventSender] [eventAsyncDequeueThreadPool1] Unexpected error while dequeuing and sending repository event org.alfresco.error.AlfrescoRuntimeException: 02120046 Could not send event
 
I didn't notice the error message before when I was just saving the name because the result was ok.
 
Any ideas?
 
Thanks

LeoMattioli
Employee
Employee

Hi Marcog,

it still seems to me some ActiveMQ misconfiguration. In the docker-compose I use this setting

-Dmessaging.broker.url="failover:(nio://<your-activemq>:61616)?timeout=3000&jms.useCompression=true"

Is in your log any WARN or ERROR message related to ActiveMQ connection?

For a deep dive on ActiveMQ and Alfresco, check this blog. You can see there also how to completely disable the events generation, if you don't need them.

By the way: are you using a Community or an Enterprise? If you are an Enterprise customer, I encourage you to open a case on support portal.


Leo Mattioli - Technical Account Manager @Hyland.

Thanks Leo,

Nothing in my log.

I'll try this configuration that you send me.

Thanks

Hi Leo.

Not yet.

In my log of ActiveMQ there are:

proj-activemq_1 | INFO: Loading '/opt/activemq/bin/env'
proj-activemq_1 | INFO: Using java '/usr/lib/jvm/jre/bin/java'
proj-activemq_1 | INFO: Starting in foreground, this is just for debugging purposes (stop process by pressing CTRL+C)
proj-activemq_1 | INFO: Creating pidfile /opt/activemq/data/activemq.pid
proj-activemq_1 | Java Runtime: Red Hat, Inc. 11.0.12 /usr/lib/jvm/java-11-openjdk-11.0.12.0.7-0.el7_9.x86_64
proj-activemq_1 | Heap sizes: current=63360k free=56369k max=1013632k
proj-activemq_1 | JVM args: -Xms64M -Xmx1G -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=/opt/activemq/conf/login.config -Dcom.sun.management.jmxremote -Djava.awt.headless=true -Djava.io.tmpdir=/opt/activemq/tmp --add-reads=java.xml=java.logging --add-opens=java.base/java.security=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.naming/javax.naming.spi=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED --add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED --add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED -Dactivemq.classpath=/opt/activemq/conf:/opt/activemq/../lib/: -Dactivemq.home=/opt/activemq -Dactivemq.base=/opt/activemq -Dactivemq.conf=/opt/activemq/conf -Dactivemq.data=/opt/activemq/data
proj-activemq_1 | Extensions classpath:
proj-activemq_1 | [/opt/activemq/lib,/opt/activemq/lib/camel,/opt/activemq/lib/optional,/opt/activemq/lib/web,/opt/activemq/lib/extra]
proj-activemq_1 | ACTIVEMQ_HOME: /opt/activemq
proj-activemq_1 | ACTIVEMQ_BASE: /opt/activemq
proj-activemq_1 | ACTIVEMQ_CONF: /opt/activemq/conf
proj-activemq_1 | ACTIVEMQ_DATA: /opt/activemq/data
proj-activemq_1 | Loading message broker from: xbean:activemq.xml
proj-activemq_1 | INFO | Refreshing org.apache.activemq.xbean.XBeanBrokerFactory$1@76505305: startup date [Wed Mar 12 14:56:34 UTC 2025]; root of context hierarchy
proj-activemq_1 | INFO | Using Persistence Adapter: KahaDBPersistenceAdapter[/opt/activemq/data/kahadb]
proj-activemq_1 | INFO | PListStore:[/opt/activemq/data/localhost/tmp_storage] started
proj-activemq_1 | INFO | Apache ActiveMQ 5.16.1 (localhost, ID:6c8cd7c01c96-39609-1741791407447-0:1) is starting
proj-activemq_1 | INFO | Listening for connections at: tcp://6c8cd7c01c96:61616?maximumConnections=1000&wireFormat.maxFrameSize=104857600
proj-activemq_1 | INFO | Connector openwire started
proj-activemq_1 | INFO | Listening for connections at: amqp://6c8cd7c01c96:5672?maximumConnections=1000&wireFormat.maxFrameSize=104857600
proj-activemq_1 | INFO | Connector amqp started
proj-activemq_1 | INFO | Listening for connections at: stomp://6c8cd7c01c96:61613?maximumConnections=1000&wireFormat.maxFrameSize=104857600
proj-activemq_1 | INFO | Connector stomp started
proj-activemq_1 | INFO | Listening for connections at: mqtt://6c8cd7c01c96:1883?maximumConnections=1000&wireFormat.maxFrameSize=104857600
proj-activemq_1 | INFO | Connector mqtt started
proj-activemq_1 | INFO | Starting Jetty server
proj-activemq_1 | INFO | Creating Jetty connector
proj-activemq_1 | WARN | ServletContext@o.e.j.s.ServletContextHandler@298d9a05{/,null,STARTING} has uncovered http methods for path: /
proj-activemq_1 | INFO | Listening for connections at ws://6c8cd7c01c96:61614?maximumConnections=1000&wireFormat.maxFrameSize=104857600
proj-activemq_1 | INFO | Connector ws started
proj-activemq_1 | INFO | Apache ActiveMQ 5.16.1 (localhost, ID:6c8cd7c01c96-39609-1741791407447-0:1) started
proj-activemq_1 | INFO | For help or more information please see: http://activemq.apache.org
proj-activemq_1 | WARN | Store limit is 102400 mb (current store usage is 0 mb). The data directory: /opt/activemq/data/kahadb only has 47269 mb of usable space. - resetting to maximum available disk space: 47269 mb
proj-activemq_1 | WARN | Temporary Store limit is 51200 mb (current store usage is 0 mb). The data directory: /opt/activemq/data only has 47269 mb of usable space. - resetting to maximum available disk space: 47269 mb
proj-activemq_1 | INFO | ActiveMQ WebConsole available at http://0.0.0.0:8161/
proj-activemq_1 | INFO | ActiveMQ Jolokia REST API available at http://0.0.0.0:8161/api/jolokia/

Nobody errors.

Thanks

LeoMattioli
Employee
Employee

Hi Marcog,

I see now that you wrote

The name is always saved correctly (except when repo.event2.enabled is false)

this means that if you disable event2 generation the name is not saved?

However, I don't think that event sending is causing the issue, as the events are sent asynchronously or after the transaction that caused them (see docs), so the node properties should be already saved.

Do you have some custom behavior on your installation? 

 

 


Leo Mattioli - Technical Account Manager @Hyland.

Hi Leo, thanks for information.

I created a small  test class to set just the document name and the property. The code has this (in attachment).
 
In the log I see this:
 
proj-acs_1       | property set
proj-acs_1       | name set
 
Notice that there is no error about repo.event2.
 
This class sets the property and the name. However, if the property is type DATE it does not set it. So I suppose the problem is related to the format of the date value to be set. Any pointers about that?
 
Apart from this, I'll build on this class for the rest because it has no errors associated with it and seems like a good place to start.
 

marcog
Star Contributor
Star Contributor

Hi Leo,

After testing different formats I could set the date property like this:
 
String value = "2025-07-10T00:00:00";
nodeService.setProperty(actionedUponNodeRef, qnameProp, data);
 
Thanks for your help. I'm closing this incident."
 
 

marcog
Star Contributor
Star Contributor

This correct configuration are:

nodeService.setProperty(actionedUponNodeRef, qnameProp, value);