简体   繁体   English

wso2 启用用户操作通知-模板路径错误

[英]wso2 Enabling Notifications for User Operations-template path error

i'm trying to enable notifactions for user operations on wso2-is 5.11 started via docker desktop on a windows11 machine.我正在尝试为通过 windows11 机器上的 docker 桌面启动的 wso2-is 5.11 上的用户操作启用通知。

somone can explain me what is wrong in that?有人可以向我解释那有什么问题吗? PS sorry for my english PS对不起我的英语

The problem is in runtime'cause the logs of docker displays the following error:问题出在运行时,因为 docker 的日志显示以下错误:

ERROR {org.wso2.carbon.identity.notification.mgt.NotificationMgtConfigBuilder} - Error while reading email template from location C:\Users\rocco\Documents\WSO2\docker-wso2\conf\is-as-km\repository\template.xml java.io.FileNotFoundException: C:\Users\rocco\Documents\WSO2\docker-wso2\conf\is-as-km\repository\template.xml (No such file or directory)错误 {org.wso2.carbon.identity.notification.mgt.NotificationMgtConfigBuilder} - 从位置 C:\Users\rocco\Documents\WSO2\docker-wso2\conf\is-as-km\repository\template 读取电子邮件模板时出错.xml java.io.FileNotFoundException: C:\Users\rocco\Documents\WSO2\docker-wso2\conf\is-as-km\repository\template.xml(没有这样的文件或目录)

msg-mgt.properties file: msg-mgt.properties 文件:

module.name.1=email
email.subscription.1=userOperation
email.subscription.userOperation.template=
C:\Users\rocco\Documents\WSO2\docker-wso2\conf\is-as- 
km\repository\template.xml
#email.subscription.userOperation.salutation=Admin
email.subscription.userOperation.subject=User operation 
change information
email.subscription.userOperation.endpoint.1=wso2iamtest
email.subscription.userOperation.endpoint.privateMail.address
=wso2iamtest@outlook.it
#email.subscription.userOperation.endpoint.privateMail
.salutation=Admin private mail
#email.subscription.userOperation.endpoint.privateMail
.subject= 
User operation change information to private mail
#

As per the error log, you have configured the wrong path for the email template location.根据错误日志,您为电子邮件模板位置配置了错误的路径。

Even though you use a Windows machine, wso2is is running as a docker instance.即使您使用的是 Windows 机器,wso2is 也是作为 docker 实例运行的。 WSO2 IS docker images are based on ubutu/ alpine/ centos OS base images (see the available variants here https://hub.docker.com/r/wso2/wso2is ). WSO2 IS docker 镜像基于 ubutu/alpine/centos OS 基础镜像(请参阅此处的可用变体https://hub.docker.com/r/wso2/wso2is )。 So, you also should have used one of them.所以,你也应该使用过其中之一。

When configuring the path for email.subscription.userOperation.template= , we have to give the absolute path inside the WSO2 IS server where the particular template file is located.在为email.subscription.userOperation.template=配置路径时,我们必须给出特定模板文件所在的 WSO2 IS 服务器内的绝对路径。

In order to find the exact path correctly,为了正确找到确切的路径,

  1. Log in to the docker container giving docker exec -it <container id> bash command使用docker exec -it <container id> bash命令登录到 docker 容器
  2. Once you logged in, you can see wso2is-5.11.0 folder natigate to the correct location where your template is placed, and give pwd command.登录后,您可以看到wso2is-5.11.0文件夹导航到放置模板的正确位置,并输入pwd命令。 You can get the path to the file.您可以获得文件的路径。 Then append the file name and put the value for email.subscription.userOperation.template= property.然后附加文件名并输入email.subscription.userOperation.template=属性的值。

As per the example, I created a file named template.txt .根据示例,我创建了一个名为template.txt的文件。 Added the following content to it.向其中添加了以下内容。

Hi {username}

This is a test mail to your private mail. The operation occurred was: {operation}.

Moved the created template into the docker container.将创建的模板移动到 docker 容器中。 Here you can see the path I have added the template file.在这里你可以看到我添加模板文件的路径。

在此处输入图像描述

According to my case, the msg-mgt.properties file should have the config as follows.根据我的情况,msg-mgt.properties 文件应具有如下配置。

email.subscription.userOperation.template=/home/wso2carbon/wso2is-5.11.0/repository/template.txt

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM