You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Ghazanfar Ali (Jira)" <ji...@apache.org> on 2023/03/27 09:15:00 UTC

[jira] [Comment Edited] (CAMEL-19199) Unable to start PLC4X route in camel-plc4x

    [ https://issues.apache.org/jira/browse/CAMEL-19199?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17705255#comment-17705255 ] 

Ghazanfar Ali edited comment on CAMEL-19199 at 3/27/23 9:15 AM:
----------------------------------------------------------------

Just for clarification, so this would work in the next release i.e. 3.20.4?
Or this should work in 3.20.2 as well?

I tried this as below but still not working:
{code:java}
from("plc4x:modbus-tcp://localhost:502?tag=value-1=holding-register:1"){code}
The tags attribute is still null.
!image-2023-03-27-11-14-56-624.png!

 

*There is a requirement in my project that the endpoint should be String i.e. all the configurations should be in URI only and not as of type Endpoint.*


was (Author: JIRAUSER299536):
Just for clarification, so this would work in the next release i.e. 3.20.4?
Or this should work in 3.20.2 as well?

I tried this as below but still not working:
{code:java}
from("plc4x:modbus-tcp://localhost:502?tag=value-1=holding-register:1"){code}
The tags attribute is still null.
!image-2023-03-27-11-11-20-518.png|width=482,height=350!

 

*There is a requirement in my project that the endpoint should be String i.e. all the configurations should be in URI only and not as of type Endpoint.*

> Unable to start PLC4X route in camel-plc4x
> ------------------------------------------
>
>                 Key: CAMEL-19199
>                 URL: https://issues.apache.org/jira/browse/CAMEL-19199
>             Project: Camel
>          Issue Type: Bug
>    Affects Versions: 3.20.2
>         Environment: Camel core version : 3.20.2 Camel-PLC4X version : 3.20.2
> IDE - Eclipse, OS - Windows 10, Java 11
>            Reporter: Ghazanfar Ali
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 3.20.4, 3.21.0, 4.0-M3, 4.0
>
>         Attachments: image-2023-03-27-11-11-20-518.png, image-2023-03-27-11-14-56-624.png
>
>
> I am using [ModbusPal|https://plc4x.apache.org/users/getting-started/virtual-modbus.html] to create the Virtual modbus.
> I am using the endpoint URI as:
>  
> {code:java}
> plc4x:modbus-tcp://localhost:502?unitId=1&dataType=holding-register&addresses=1{code}
> Following is the screenshot of Modbus holding registers:
> !https://user-images.githubusercontent.com/62088117/227714761-e6486993-f44a-4482-a7be-e76e5a94b49c.png|width=354,height=350!
> But when starting camel context it throws NullPointerException.
>  
> {code:java}
> java.lang.NullPointerException
>     at org.apache.camel.component.plc4x.Plc4XConsumer.startUnTriggered(Plc4XConsumer.java:89)
>     at org.apache.camel.component.plc4x.Plc4XConsumer.doStart(Plc4XConsumer.java:81)
>     at org.apache.camel.support.service.BaseService.start(BaseService.java:119) {code}
> I debugged it and found the problem is with this line in PLC4XConsumer line 89:
>  
> {code:java}
> for (Map.Entry<String, Object> tag : tags.entrySet()) {{code}
>  
> Here *tags* are null, so it might be that I am not configuring the endpoint correctly.
> So, I tried by configuring the endpoint by creating an instance of Plc4XEndpoint and then configuring the tags there, it works like:
> {code:java}
> Map<String, Object> map = new HashMap<>();
>             map.put("value-1", "holding-register:1");
>             
>             Plc4XEndpoint plc4xEndpoint = new Plc4XEndpoint("plc4x:modbus-tcp://localhost:502",
>                     getContext().getComponent("plc4x"));
>             plc4xEndpoint.setTags(map);
>             from(plc4xEndpoint).log("value : ${body}"); {code}
> But why it is not working if I configure the endpoint as just String?
> Note:
> I tried with below endpoint and it is also not working:
> {code:java}
> plc4x:modbus-tcp://localhost:502?tags={unitId=1&dataType=holding-register&addresses=1} {code}
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)