PicketLink integration with TomEE - apache-tomee

I'm trying to integrate PicketLink for the security needs of a JEE 7 webapp I'm developing with TomEE 7.0.1. I've implemented the basic example from PicketLink site. However, PicketLink is failing to authenticate the form input and logs "Account NOT FOUND for credentials ...". Here's my implementation:
public class SecurityConfiguration {
public void onInit(#Observes org.picketlink.event.SecurityConfigurationEvent event) {
org.picketlink.config.SecurityConfigurationBuilder builder = event.getBuilder();
builder
.http()
.allPaths()
.authenticateWith()
.form()
.authenticationUri("/login.xhtml")
.loginPage("/") // Invokes a servlet which forwards to login.xhtml
.errorPage("/")
.redirectTo("/index.xhtml")
// .restoreOriginalRequest()
.forPath("/javax.faces.resource/*")
.unprotected()
.forPath("/logout")
.logout()
.redirectTo("/")
.forPath("/register.xhtml")
.unprotected();
}
}
#Singleton
#Startup
public class SecurityInitializer {
#Inject
private PartitionManager partitionManager;
//#Inject
//private IdentityManager identityManager; // This didn't work either
#PostConstruct
public void create() {
IdentityManager identityManager = this.partitionManager.createIdentityManager();
User user = new User("jane");
user.setEmail("jane#doe.com");
user.setFirstName("Jane");
user.setLastName("Doe");
identityManager.add(user);
identityManager.updateCredential(user, new Password("1234"));
}
}
login.xhtml
<body id="loginform">
<h:panelGroup layout="block" styleClass="login">
<h:form prependId="false">
<h:inputText id="j_username" value="#{loginCredentials.userId}" required="true" pt:placeholder="Username" />
<h:inputSecret id="j_password" value="#{loginCredentials.password}" required="true" pt:placeholder="Password" />
<h:commandButton value="Sign In" action="#{identity.login}"/>
</h:form>
</h:panelGroup>
</body>
The log output:
Performing authentication using credentials [org.picketlink.idm.credential.Password#55f9cac7]. User id is [jane].
10:17:09.161 [http-nio-8080-exec-7] DEBUG org.picketlink - Firing event [org.picketlink.authentication.event.PreAuthenticateEvent#164f832e].
10:17:09.163 [http-nio-8080-exec-7] DEBUG org.picketlink.authentication - Authentication is going to be performed by authenticator [org.picketlink.authentication.internal.IdmAuthenticator#3a946b61]
10:17:09.163 [http-nio-8080-exec-7] DEBUG org.picketlink.authentication - Validating credentials [org.picketlink.idm.credential.UsernamePasswordCredentials#5028d9ee] using PicketLink IDM.
10:17:09.176 [http-nio-8080-exec-7] DEBUG org.picketlink - Initializing Identity Management Subsystem.
10:17:09.176 [http-nio-8080-exec-7] DEBUG org.picketlink - Creating PartitionManager.
10:17:09.176 [http-nio-8080-exec-7] DEBUG org.picketlink - Building identity management configuration.
10:17:09.176 [http-nio-8080-exec-7] DEBUG org.picketlink - IdentityConfiguration not provided by the application, creating a default IdentityConfigurationBuilder.
10:17:09.176 [http-nio-8080-exec-7] DEBUG org.picketlink - Firing event [org.picketlink.IdentityConfigurationEvent#465bebd2].
10:17:09.176 [http-nio-8080-exec-7] DEBUG org.picketlink - No configuration provided by the application. Configuring defaults.
10:17:09.181 [http-nio-8080-exec-7] DEBUG org.picketlink.common - Using logger implementation: org.picketlink.common.DefaultPicketLinkLogger
10:17:09.181 [http-nio-8080-exec-7] DEBUG org.picketlink - Auto configuring File Identity Store.
10:17:09.191 [http-nio-8080-exec-7] INFO org.picketlink.idm - PLIDM001000: Bootstrapping PicketLink IDM Partition Manager
10:17:09.196 [http-nio-8080-exec-7] DEBUG org.picketlink.idm - Identity Management Configuration: [
10:17:09.196 [http-nio-8080-exec-7] DEBUG org.picketlink.idm - Name: default
10:17:09.196 [http-nio-8080-exec-7] DEBUG org.picketlink.idm - Identity Store Configuration: [org.picketlink.idm.config.FileIdentityStoreConfiguration#f1f99fd]
10:17:09.196 [http-nio-8080-exec-7] DEBUG org.picketlink.idm - Supports Partition: true
10:17:09.196 [http-nio-8080-exec-7] DEBUG org.picketlink.idm - Supports Attribute: true
10:17:09.196 [http-nio-8080-exec-7] DEBUG org.picketlink.idm - Supports Credential: true
10:17:09.198 [http-nio-8080-exec-7] DEBUG org.picketlink.idm - Supports Permission: true
10:17:09.198 [http-nio-8080-exec-7] DEBUG org.picketlink.idm - Supported Types: [interface org.picketlink.idm.model.IdentityType, interface org.picketlink.idm.model.Relationship, class org.picketlink.idm.model.basic.GroupMembership, class org.picketlink.idm.model.basic.Agent, class org.picketlink.idm.model.basic.Group, interface org.picketlink.idm.model.Partition, class org.picketlink.idm.model.basic.GroupRole, class org.picketlink.idm.model.basic.Realm, class org.picketlink.idm.model.basic.Grant, class org.picketlink.idm.model.basic.User, class org.picketlink.idm.model.basic.Role]
10:17:09.198 [http-nio-8080-exec-7] DEBUG org.picketlink.idm - ]
10:17:09.198 [http-nio-8080-exec-7] INFO org.picketlink.idm.identity.store - PLIDM001001: Initializing Identity Store [class org.picketlink.idm.file.internal.FileIdentityStore]
10:17:09.198 [http-nio-8080-exec-7] DEBUG org.picketlink.idm.identity.store - [org.picketlink.idm.config.FileIdentityStoreConfiguration#f1f99fd]: [
10:17:09.198 [http-nio-8080-exec-7] DEBUG org.picketlink.idm.identity.store - Type: class org.picketlink.idm.file.internal.FileIdentityStore
10:17:09.198 [http-nio-8080-exec-7] DEBUG org.picketlink.idm.identity.store - Supports partition: true
10:17:09.198 [http-nio-8080-exec-7] DEBUG org.picketlink.idm.identity.store - Supports attribute: true
10:17:09.198 [http-nio-8080-exec-7] DEBUG org.picketlink.idm.identity.store - Supports credential: true
10:17:09.198 [http-nio-8080-exec-7] DEBUG org.picketlink.idm.identity.store - Credential Handlers: [class org.picketlink.idm.credential.handler.PasswordCredentialHandler, class org.picketlink.idm.credential.handler.X509CertificateCredentialHandler, class org.picketlink.idm.credential.handler.DigestCredentialHandler, class org.picketlink.idm.credential.handler.TOTPCredentialHandler, class org.picketlink.idm.credential.handler.TokenCredentialHandler]
10:17:09.248 [http-nio-8080-exec-7] DEBUG org.picketlink.idm.identity.store - Supported types: [interface org.picketlink.idm.model.IdentityType, interface org.picketlink.idm.model.Relationship, class org.picketlink.idm.model.basic.GroupMembership, class org.picketlink.idm.model.basic.Agent, class org.picketlink.idm.model.basic.Group, interface org.picketlink.idm.model.Partition, class org.picketlink.idm.model.basic.GroupRole, class org.picketlink.idm.model.basic.Realm, class org.picketlink.idm.model.basic.Grant, class org.picketlink.idm.model.basic.User, class org.picketlink.idm.model.basic.Role]
10:17:09.248 [http-nio-8080-exec-7] DEBUG org.picketlink.idm.identity.store - Unsupported types: []
10:17:09.248 [http-nio-8080-exec-7] DEBUG org.picketlink.idm.identity.store - Context Initializers: [org.picketlink.internal.AuthenticatedAccountContextInitializer#1a402a5]
10:17:09.256 [http-nio-8080-exec-7] DEBUG org.picketlink.idm.identity.store - ]
10:17:09.276 [http-nio-8080-exec-7] WARN o.picketlink.idm.identity.store.file - PLIDM001101: Working directory [C:\Everything Mine\bin\TomEE\apache-tomee-webprofile-7.0.1\temp\pl-idm] is marked to be always created. All your existing data will be lost.
10:17:09.328 [http-nio-8080-exec-7] INFO o.picketlink.idm.identity.store.file - PLIDM001100: Using working directory [C:\Everything Mine\bin\TomEE\apache-tomee-webprofile-7.0.1\temp\pl-idm].
10:17:09.331 [http-nio-8080-exec-7] DEBUG o.picketlink.idm.identity.store.file - No partitions to load from C:\Everything Mine\bin\TomEE\apache-tomee-webprofile-7.0.1\temp\pl-idm\pl-idm-partitions.db
10:17:09.333 [http-nio-8080-exec-7] DEBUG org.picketlink - Firing event [org.picketlink.PartitionManagerCreateEvent#27bddd38].
10:17:09.336 [http-nio-8080-exec-7] DEBUG org.picketlink - Creating default partition using [class org.picketlink.idm.model.basic.Realm] and name [default].
10:17:09.343 [http-nio-8080-exec-7] DEBUG o.picketlink.idm.identity.store.file - Initializing Partition [default] with id [f1dec0b1-f9b2-4f34-b638-2d174dd5a475].
10:17:09.346 [http-nio-8080-exec-7] DEBUG o.picketlink.idm.identity.store.file - Loaded Identity Types [0] for Partition [f1dec0b1-f9b2-4f34-b638-2d174dd5a475].
10:17:09.348 [http-nio-8080-exec-7] DEBUG o.picketlink.idm.identity.store.file - Loaded Credentials [0] for Partition [f1dec0b1-f9b2-4f34-b638-2d174dd5a475].
10:17:09.351 [http-nio-8080-exec-7] DEBUG o.picketlink.idm.identity.store.file - Loaded Permissions [0] for Partition [f1dec0b1-f9b2-4f34-b638-2d174dd5a475].
10:17:09.378 [http-nio-8080-exec-7] DEBUG org.picketlink - Firing event [org.picketlink.idm.event.PartitionCreatedEvent#6313ddb9].
10:17:09.381 [http-nio-8080-exec-7] DEBUG org.picketlink.idm.credential - Starting validation for credentials [class org.picketlink.idm.credential.UsernamePasswordCredentials][org.picketlink.idm.credential.UsernamePasswordCredentials#5028d9ee] using identity store [org.picketlink.idm.file.internal.FileIdentityStore#20439b63] and credential handler [org.picketlink.idm.credential.handler.PasswordCredentialHandler#35ecbf5c].
10:17:09.383 [http-nio-8080-exec-7] DEBUG org.picketlink.idm.credential - PLIDM001003: Trying to find account [jane] using default account type [class org.picketlink.idm.model.basic.Agent] with property [loginName].
10:17:09.383 [http-nio-8080-exec-7] DEBUG org.picketlink.idm.credential - PLIDM001003: Trying to find account [jane] using default account type [class org.picketlink.idm.model.basic.User] with property [loginName].
10:17:09.383 [http-nio-8080-exec-7] DEBUG org.picketlink.idm.credential - Account NOT FOUND for credentials [class org.picketlink.idm.credential.UsernamePasswordCredentials][org.picketlink.idm.credential.UsernamePasswordCredentials#5028d9ee].
10:17:09.383 [http-nio-8080-exec-7] DEBUG org.picketlink.idm.credential - Finishing validation for credential [class org.picketlink.idm.credential.UsernamePasswordCredentials][org.picketlink.idm.credential.UsernamePasswordCredentials#5028d9ee] validated using identity store [org.picketlink.idm.file.internal.FileIdentityStore#20439b63] and credential handler [org.picketlink.idm.credential.handler.PasswordCredentialHandler#35ecbf5c]. Status [INVALID]. Validated Account [null]
10:17:09.383 [http-nio-8080-exec-7] DEBUG org.picketlink.authentication - Credential status is [INVALID] and validated account [null]
10:17:09.386 [http-nio-8080-exec-7] WARN org.picketlink.authentication - PLINK002100: Authentication failed for account [jane].
10:17:09.386 [http-nio-8080-exec-7] DEBUG org.picketlink - Firing event [org.picketlink.authentication.event.LoginFailedEvent#13834ca3].
10:17:09.386 [http-nio-8080-exec-7] DEBUG org.picketlink.authentication - Authentication is finished using credentials [org.picketlink.idm.credential.Password#55f9cac7]. User id is [jane].
I'm unable to find any helpful documents to help me start off. Does anybody of you have any experience with integrating the two of these. What do I need to do to integrate PicketLink with TomEE based JSF app ? Alternatively, I also looked at KeyCloak but that too does not have any pointers on integrating with TomEE.

picketlink-authentication-form-with-jsf example provided by picketlink runs on tomee.
Here are the needed dependencies:
<dependency>
<groupId>org.picketlink</groupId>
<artifactId>picketlink-api</artifactId>
<version>${version.picketlink}</version>
</dependency>
<dependency>
<groupId>org.picketlink</groupId>
<artifactId>picketlink-impl</artifactId>
<version>${version.picketlink}</version>
</dependency>
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
<version>3.2.1.Final</version>
</dependency>
(don't forget jboss-logging which doesn't come transitively)
To run the example you also need javaee-api and myfaces-api to get EE dependencies but these two should be in scope provided.

Related

sentry expo logs error when enableInDevelopment is set to false or omitted

I have a react native expo managed app using react-native-sentry. According to the docs here: Sentry Expo Docs disabled by default in dev when encountering an error in dev it should be no op. I'm getting an error logged:
config Object {
"debug": true,
"defaultIntegrations": false,
"deployEnvironment": "default",
"dsn": "my-valid-dsn",
"environment": "local",
}
[sentry-expo] Disabled Sentry in development. Note you can set Sentry.init({ enableInExpoDevelopment: true });
Sentry Logger [Error]:, [SentryError: SDK not enabled, will not capture event.]
at http://192.168.0.110:19000/node_modules/expo/AppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:267225:41 in anonymous
at node_modules/sentry-expo/node_modules/#sentry/utils/dist/logger.js:26:4 in consoleSandbox
at http://192.168.0.110:19000/node_modules/expo/AppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:267222:20 in anonymous
at node_modules/sentry-expo/node_modules/#sentry/utils/dist/syncpromise.js:72:26 in cachedHandlers.forEach$argument_0
at node_modules/sentry-expo/node_modules/#sentry/utils/dist/syncpromise.js:67:12 in _executeHandlers
at http://192.168.0.110:19000/node_modules/expo/AppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:268617:30 in anonymous
at node_modules/sentry-expo/node_modules/#sentry/utils/dist/syncpromise.js:82:12 in SyncPromise
at http://192.168.0.110:19000/node_modules/expo/AppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:268594:28 in anonymous
at http://192.168.0.110:19000/node_modules/expo/AppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:274894:79 in anonymous
at node_modules/sentry-expo/node_modules/#sentry/hub/dist/hub.js:381:8 in Hub.prototype._invokeClient
at http://192.168.0.110:19000/node_modules/expo/AppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:274350:24 in anonymous
at node_modules/sentry-expo/node_modules/#sentry/minimal/dist/index.js:16:28 in callOnHub
at node_modules/sentry-expo/node_modules/#sentry/minimal/dist/index.js:30:8 in captureException
at App.js:34:2 in App
at App.js:46:27 in initStripe
- ... 16 more stack frames from framework internals
Code snippet:
export default function App() {
console.log('config', getConfig().sentry);
Sentry.init(getConfig().sentry);
Sentry.Native.captureException(new Error("Oops!"));
npm list sentry-expo
npm list sentry-expo
client# /Users/blah/Repositories/blah-blah/client
└── sentry-expo#4.2.0
I expected no logging. Any help or advice would be appreciated!

TestContainer Rabbitmq seems to release connection as soon as it is start

I am using testcontainers in a spring boot project (version : 1.17.2) and I am trying to spin up a rabbitmq container. It seems like rabbitmq container starts up successfully, but it releases connection as soon as it is up.
I can see some error in logs but after that I can see that the test container is started. I am kind of flummoxed as to why am I seeing this error and/or if the container is started or not ?
Pasting excerpt from logs :
15:00:44.007 [main] DEBUG org.testcontainers.containers.output.WaitingConsumer - STDOUT: 2022-06-29 05:00:24.477316+00:00 [info] <0.703.0> * rabbitmq_management_agent
15:00:44.007 [main] DEBUG org.testcontainers.containers.output.WaitingConsumer - STDOUT: 2022-06-29 05:00:24.477316+00:00 [info] <0.703.0> * rabbitmq_web_dispatch
15:00:44.007 [main] DEBUG org.testcontainers.containers.output.WaitingConsumer - STDOUT: 2022-06-29 05:00:24.477316+00:00 [info] <0.703.0> * rabbitmq_management
15:00:44.007 [main] DEBUG org.testcontainers.containers.output.WaitingConsumer - STDOUT: 2022-06-29 05:00:24.477316+00:00 [info] <0.703.0> * rabbitmq_prometheus
15:00:44.007 [main] DEBUG org.testcontainers.containers.output.WaitingConsumer - STDOUT: 2022-06-29 05:00:24.477316+00:00 [info] <0.703.0> Server startup complete; 4 plugins started.
15:00:44.007 [main] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.impl.classic.InternalHttpClient - ep-0000000C: cancel
15:00:44.007 [main] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.impl.io.DefaultManagedHttpClientConnection - http-outgoing-1: close connection IMMEDIATE
15:00:44.008 [main] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.impl.classic.InternalHttpClient - ep-0000000C: endpoint closed
15:00:44.008 [main] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.impl.classic.InternalHttpClient - ep-0000000C: discarding endpoint
15:00:44.008 [main] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager - ep-0000000C: releasing endpoint
15:00:44.008 [main] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager - ep-0000000C: connection is not kept alive
15:00:44.008 [docker-java-stream--540868428] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.wire - http-outgoing-1 << "end of stream"
15:00:44.008 [main] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager - ep-0000000C: connection released [route: {}->npipe://localhost:2375][total available: 0; route allocated: 0 of 2147483647; total allocated: 0 of 2147483647]
15:00:44.008 [main] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.wire - http-outgoing-1 << "[read] I/O error: java.nio.channels.ClosedChannelException"
15:00:44.008 [docker-java-stream--540868428] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.wire - http-outgoing-1 << "[read] I/O error: java.nio.channels.ClosedChannelException"
15:00:44.008 [docker-java-stream--540868428] DEBUG com.github.dockerjava.zerodep.ApacheDockerHttpClientImpl$ApacheResponse - Failed to close the response
java.io.IOException: java.nio.channels.ClosedChannelException
at java.base/java.nio.channels.Channels$2.read(Channels.java:240)
at com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.impl.io.LoggingInputStream.read(LoggingInputStream.java:81)
at com.github.dockerjava.zerodep.shaded.org.apache.hc.core5.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:149)
at com.github.dockerjava.zerodep.shaded.org.apache.hc.core5.http.impl.io.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:280)
at com.github.dockerjava.zerodep.shaded.org.apache.hc.core5.http.impl.io.ChunkedInputStream.getChunkSize(ChunkedInputStream.java:261)
at com.github.dockerjava.zerodep.shaded.org.apache.hc.core5.http.impl.io.ChunkedInputStream.nextChunk(ChunkedInputStream.java:222)
at com.github.dockerjava.zerodep.shaded.org.apache.hc.core5.http.impl.io.ChunkedInputStream.read(ChunkedInputStream.java:147)
at com.github.dockerjava.zerodep.shaded.org.apache.hc.core5.http.impl.io.ChunkedInputStream.close(ChunkedInputStream.java:314)
at com.github.dockerjava.zerodep.shaded.org.apache.hc.core5.io.Closer.close(Closer.java:48)
at com.github.dockerjava.zerodep.shaded.org.apache.hc.core5.http.impl.io.IncomingHttpEntity.close(IncomingHttpEntity.java:111)
at com.github.dockerjava.zerodep.shaded.org.apache.hc.core5.http.io.entity.HttpEntityWrapper.close(HttpEntityWrapper.java:120)
at com.github.dockerjava.zerodep.shaded.org.apache.hc.core5.io.Closer.close(Closer.java:48)
at com.github.dockerjava.zerodep.shaded.org.apache.hc.core5.http.message.BasicClassicHttpResponse.close(BasicClassicHttpResponse.java:93)
at com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.impl.classic.CloseableHttpResponse.close(CloseableHttpResponse.java:200)
at com.github.dockerjava.zerodep.ApacheDockerHttpClientImpl$ApacheResponse.close(ApacheDockerHttpClientImpl.java:256)
at org.testcontainers.shaded.com.github.dockerjava.core.DefaultInvocationBuilder.lambda$executeAndStream$1(DefaultInvocationBuilder.java:277)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.nio.channels.ClosedChannelException: null
....................................
15:00:44.009 [main] INFO 🐳 [rabbitmq:3.9.13-management-alpine] - Container rabbitmq:3.9.13-management-alpine started in PT7.8752359S
Config Java :
public abstract class RabbitMqTestContainerConfiguration {
private static final int RABBITMQ_DEFAULT_PORT = 5672;
#Container
public static RabbitMQContainer rabbitMQContainer = new RabbitMQContainer("rabbitmq:3.9.13-management-alpine")
.withExposedPorts(RABBITMQ_DEFAULT_PORT).withStartupTimeout(Duration.ofMinutes(3));
public static class Initializer implements ApplicationContextInitializer<ConfigurableApplicationContext> {
#Override
public void initialize(ConfigurableApplicationContext configurableApplicationContext) {
TestPropertySourceUtils.addInlinedPropertiesToEnvironment(configurableApplicationContext,
"spring.rabbitmq.host=" + rabbitMQContainer.getHost(),
"spring.rabbitmq.port=" + rabbitMQContainer.getMappedPort(RABBITMQ_DEFAULT_PORT),
"spring.rabbitmq.username=" + rabbitMQContainer.getAdminUsername(),
"spring.rabbitmq.password=" + rabbitMQContainer.getAdminPassword());
}
}
} ```

WebdriverIo is not able to initialize wdio-rerun-service : Getting below error

[0-13] 2022-05-25T04:33:05.332Z DEBUG #wdio/utils:initialiseServices: initialise service "selenium-standalone" as NPM package
[0-13] 2022-05-25T04:33:05.350Z DEBUG #wdio/utils:initialiseServices: initialise service "RerunService" as NPM package
[0-13] 2022-05-25T04:33:05.351Z ERROR #wdio/utils:initialiseServices: Error: Couldn't find plugin "RerunService" service, neither as wdio scoped package "#wdio/rerunservice-service" nor as community package "wdio-rerunservice-service". Please make sure you have it installed!
at Object.initialisePlugin [as default] (/Users//dotor/dot-or-automation/node_modules/#wdio/runner/node_modules/#wdio/utils/build/initialisePlugin.js:26:11)
at initialiseServices (/Users/****/dotor/dot-or-automation/node_modules/#wdio/runner/node_modules/#wdio/utils/build/initialiseServices.js:24:51)
at Object.initialiseWorkerService (/Users//dotor/dot-or-automation/node_modules/#wdio/runner/node_modules/#wdio/utils/build/initialiseServices.js:67:26)
at Runner.run (/Users/*******/dotor/dot-or-automation/node_modules/#wdio/runner/build/index.js:43:17)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
[0-13] Capabilities: {"maxInstances":2,"browserName":"chrome","acceptInsecureCerts":true,"goog:chromeOptions":{}}
[0-13] 2022-05-25T04:33:05.437Z DEBUG #wdio/sync: Finished to run "beforeSession" hook in 0ms
2022-05-25T04:33:05.800Z DEBUG #wdio/local-runner: Runner 0-13 finished with exit code 0
2022-05-25T04:33:05.800Z INFO #wdio/cli: [0-13] SKIPPED in chrome - /automation/features/ui/Others/setting-wheel.feature
2022-05-25T04:33:05.800Z INFO #wdio/cli:launcher: Run onWorkerEnd hook
Not sure if you already found your answer for this but if you haven't. The webdriverio doc explains it well.
// wdio.conf.js
const RerunService = require('wdio-rerun-service');
export.config = {
// ...
services: [RerunService, {
// ...
}]
};
This service is slightly configured differently compared to the other ones.
Note that we are importing the service and using it in the config object. Other services are usually called directly after installation, and the name of the service is usually a string example:
export.config = {
// ...
services: ["selenium-standalone", {
// ...
}]
};

"Unsupported case for discriminated type" when reading tag from Allen Bradley's Micro820 PLC, using Apache's PLC4X

I’m using Apache’s PLC4X library in order to read some tags from an Allen Bradley’s Micro820 PLC (2080-LC20-20QWB). So far, I am able to establish a connection with the device but when I try to execute a read request I’m getting the error shown in the stack trace bellow.
I’m running a Java maven based project with the following dependencies:
<dependency>
<groupId>org.apache.plc4x</groupId>
<artifactId>plc4j-api</artifactId>
<version>0.9.1</version>
</dependency>
<!-- Ethernet / IP driver -->
<dependency>
<groupId>org.apache.plc4x</groupId>
<artifactId>plc4j-driver-eip</artifactId>
<version>0.9.1</version>
</dependency>
This is the code I'm running on a Ubuntu 18.04 width JDK 11
package com.example.plctest;
import org.apache.plc4x.java.PlcDriverManager;
import org.apache.plc4x.java.api.PlcConnection;
import org.apache.plc4x.java.api.messages.PlcReadRequest;
import org.apache.plc4x.java.api.messages.PlcReadResponse;
import org.apache.plc4x.java.eip.readwrite.field.EipField;
import org.apache.plc4x.java.eip.readwrite.types.CIPDataTypeCode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ReadPlcDemo {
private static final Logger LOGGER = LoggerFactory.getLogger(ReadPlcDemo.class);
private static String connectionString = "eip://192.168.1.100?backplane=0&slot=0";
public static void main(String[] args) {
// Establish a connection with the PLC
try (PlcConnection connection = new PlcDriverManager().getConnection(connectionString)) {
if (connection.getMetadata().canRead()) {
LOGGER.info("PLC can read!");
}
// Create the read request
EipField field = new EipField("Sensor1", CIPDataTypeCode.BOOL);
// EipField field = new EipField("Sensor2", CIPDataTypeCode.SINT);
// EipField field = new EipField("Sensor3", CIPDataTypeCode.SINT);
PlcReadRequest.Builder builder = connection.readRequestBuilder();
builder.addItem("value-" + field.getTag(), field);
PlcReadRequest readRequest = builder.build();
// Execute the request
PlcReadResponse response;
try {
response = readRequest.execute().get();
} catch (Exception e) {
e.printStackTrace();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
This is the result from my stack trace, I set the log level to 'trace' in order to get a better insight of what's going on:
/home/ghinojosa/.jdks/corretto-11.0.14.1/bin/java -Dio.netty.tryReflectionSetAccessible=true --add-opens java.base/jdk.internal.misc=ALL-UNNAMED -javaagent:/home/ghinojosa/.local/share/JetBrains/Toolbox/apps/IDEA-C/ch-0/213.6777.52/lib/idea_rt.jar=44017:/home/ghinojosa/.local/share/JetBrains/Toolbox/apps/IDEA-C/ch-0/213.6777.52/bin -Dfile.encoding=UTF-8 -classpath /home/ghinojosa/IdeaProjects/plc-test/target/classes:/home/ghinojosa/Downloads/eeip-library.jar:/home/ghinojosa/.m2/repository/org/apache/plc4x/plc4j-api/0.9.1/plc4j-api-0.9.1.jar:/home/ghinojosa/.m2/repository/org/apache/commons/commons-lang3/3.12.0/commons-lang3-3.12.0.jar:/home/ghinojosa/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.12.5/jackson-annotations-2.12.5.jar:/home/ghinojosa/.m2/repository/org/apache/plc4x/plc4j-driver-eip/0.9.1/plc4j-driver-eip-0.9.1.jar:/home/ghinojosa/.m2/repository/org/apache/plc4x/plc4j-spi/0.9.1/plc4j-spi-0.9.1.jar:/home/ghinojosa/.m2/repository/io/netty/netty-codec/4.1.67.Final/netty-codec-4.1.67.Final.jar:/home/ghinojosa/.m2/repository/io/netty/netty-common/4.1.67.Final/netty-common-4.1.67.Final.jar:/home/ghinojosa/.m2/repository/io/netty/netty-transport/4.1.67.Final/netty-transport-4.1.67.Final.jar:/home/ghinojosa/.m2/repository/io/netty/netty-resolver/4.1.67.Final/netty-resolver-4.1.67.Final.jar:/home/ghinojosa/.m2/repository/commons-beanutils/commons-beanutils/1.9.4/commons-beanutils-1.9.4.jar:/home/ghinojosa/.m2/repository/commons-logging/commons-logging/1.2/commons-logging-1.2.jar:/home/ghinojosa/.m2/repository/commons-collections/commons-collections/3.2.2/commons-collections-3.2.2.jar:/home/ghinojosa/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.12.5/jackson-core-2.12.5.jar:/home/ghinojosa/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.12.5/jackson-databind-2.12.5.jar:/home/ghinojosa/.m2/repository/io/vavr/vavr/0.10.4/vavr-0.10.4.jar:/home/ghinojosa/.m2/repository/io/vavr/vavr-match/0.10.4/vavr-match-0.10.4.jar:/home/ghinojosa/.m2/repository/com/github/jinahya/bit-io/1.4.3/bit-io-1.4.3.jar:/home/ghinojosa/.m2/repository/commons-codec/commons-codec/1.15/commons-codec-1.15.jar:/home/ghinojosa/.m2/repository/org/apache/plc4x/plc4j-transport-tcp/0.9.1/plc4j-transport-tcp-0.9.1.jar:/home/ghinojosa/.m2/repository/io/netty/netty-buffer/4.1.67.Final/netty-buffer-4.1.67.Final.jar:/home/ghinojosa/.m2/repository/org/slf4j/slf4j-api/1.8.0-beta4/slf4j-api-1.8.0-beta4.jar:/home/ghinojosa/.m2/repository/org/slf4j/slf4j-simple/1.8.0-beta4/slf4j-simple-1.8.0-beta4.jar com.example.plctest.ReadPlcDemo
[main] INFO org.apache.plc4x.java.PlcDriverManager - Instantiating new PLC Driver Manager with class loader jdk.internal.loader.ClassLoaders$AppClassLoader#5c8da962
[main] INFO org.apache.plc4x.java.PlcDriverManager - Registering available drivers...
[main] INFO org.apache.plc4x.java.PlcDriverManager - Registering driver for Protocol eip (EthernetIP)
[main] DEBUG io.netty.util.internal.logging.InternalLoggerFactory - Using SLF4J as the default logging framework
[main] DEBUG io.netty.util.ResourceLeakDetector - -Dio.netty.leakDetection.level: simple
[main] DEBUG io.netty.util.ResourceLeakDetector - -Dio.netty.leakDetection.targetRecords: 4
[main] DEBUG io.netty.util.ResourceLeakDetectorFactory - Loaded default ResourceLeakDetector: io.netty.util.ResourceLeakDetector#4de5031f
[main] DEBUG io.netty.util.internal.PlatformDependent0 - -Dio.netty.noUnsafe: false
[main] DEBUG io.netty.util.internal.PlatformDependent0 - Java version: 11
[main] DEBUG io.netty.util.internal.PlatformDependent0 - sun.misc.Unsafe.theUnsafe: available
[main] DEBUG io.netty.util.internal.PlatformDependent0 - sun.misc.Unsafe.copyMemory: available
[main] DEBUG io.netty.util.internal.PlatformDependent0 - java.nio.Buffer.address: available
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by io.netty.util.internal.ReflectionUtil (file:/home/ghinojosa/.m2/repository/io/netty/netty-common/4.1.67.Final/netty-common-4.1.67.Final.jar) to constructor java.nio.DirectByteBuffer(long,int)
WARNING: Please consider reporting this to the maintainers of io.netty.util.internal.ReflectionUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[main] DEBUG io.netty.util.internal.PlatformDependent0 - direct buffer constructor: available
[main] DEBUG io.netty.util.internal.PlatformDependent0 - java.nio.Bits.unaligned: available, true
[main] DEBUG io.netty.util.internal.PlatformDependent0 - jdk.internal.misc.Unsafe.allocateUninitializedArray(int): available
[main] DEBUG io.netty.util.internal.PlatformDependent0 - java.nio.DirectByteBuffer.<init>(long, int): available
[main] DEBUG io.netty.util.internal.PlatformDependent - sun.misc.Unsafe: available
[main] DEBUG io.netty.util.internal.PlatformDependent - maxDirectMemory: 8390705152 bytes (maybe)
[main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.tmpdir: /tmp (java.io.tmpdir)
[main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.bitMode: 64 (sun.arch.data.model)
[main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.maxDirectMemory: 8390705152 bytes
[main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.uninitializedArrayAllocationThreshold: 1024
[main] DEBUG io.netty.util.internal.CleanerJava9 - java.nio.ByteBuffer.cleaner(): available
[main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.noPreferDirect: false
[main] DEBUG io.netty.util.internal.PlatformDependent - org.jctools-core.MpscChunkedArrayQueue: available
[main] DEBUG io.netty.channel.MultithreadEventLoopGroup - -Dio.netty.eventLoopThreads: 8
[main] DEBUG io.netty.util.internal.InternalThreadLocalMap - -Dio.netty.threadLocalMap.stringBuilder.initialSize: 1024
[main] DEBUG io.netty.util.internal.InternalThreadLocalMap - -Dio.netty.threadLocalMap.stringBuilder.maxSize: 4096
[main] DEBUG io.netty.channel.nio.NioEventLoop - -Dio.netty.noKeySetOptimization: false
[main] DEBUG io.netty.channel.nio.NioEventLoop - -Dio.netty.selectorAutoRebuildThreshold: 512
[main] TRACE io.netty.channel.nio.NioEventLoop - instrumented a special java.util.Set into: sun.nio.ch.EPollSelectorImpl#76505305
[main] TRACE io.netty.channel.nio.NioEventLoop - instrumented a special java.util.Set into: sun.nio.ch.EPollSelectorImpl#7b98f307
[main] TRACE io.netty.channel.nio.NioEventLoop - instrumented a special java.util.Set into: sun.nio.ch.EPollSelectorImpl#4802796d
[main] TRACE io.netty.channel.nio.NioEventLoop - instrumented a special java.util.Set into: sun.nio.ch.EPollSelectorImpl#34123d65
[main] TRACE io.netty.channel.nio.NioEventLoop - instrumented a special java.util.Set into: sun.nio.ch.EPollSelectorImpl#59474f18
[main] TRACE io.netty.channel.nio.NioEventLoop - instrumented a special java.util.Set into: sun.nio.ch.EPollSelectorImpl#65fb9ffc
[main] TRACE io.netty.channel.nio.NioEventLoop - instrumented a special java.util.Set into: sun.nio.ch.EPollSelectorImpl#3e694b3f
[main] TRACE io.netty.channel.nio.NioEventLoop - instrumented a special java.util.Set into: sun.nio.ch.EPollSelectorImpl#1bb5a082
[main] INFO org.apache.plc4x.java.transport.tcp.TcpChannelFactory - Configuring Bootstrap with org.apache.plc4x.java.eip.readwrite.configuration.EIPConfiguration#5aa9e4eb
[main] DEBUG io.netty.channel.DefaultChannelId - -Dio.netty.processId: 10908 (auto-detected)
[main] DEBUG io.netty.util.NetUtil - -Djava.net.preferIPv4Stack: false
[main] DEBUG io.netty.util.NetUtil - -Djava.net.preferIPv6Addresses: false
[main] DEBUG io.netty.util.NetUtilInitializations - Loopback interface: lo (lo, 0:0:0:0:0:0:0:1%lo)
[main] DEBUG io.netty.util.NetUtil - /proc/sys/net/core/somaxconn: 4096
[main] DEBUG io.netty.channel.DefaultChannelId - -Dio.netty.machineId: f4:06:69:ff:fe:d6:97:69 (auto-detected)
[main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.numHeapArenas: 8
[main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.numDirectArenas: 8
[main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.pageSize: 8192
[main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.maxOrder: 11
[main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.chunkSize: 16777216
[main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.smallCacheSize: 256
[main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.normalCacheSize: 64
[main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.maxCachedBufferCapacity: 32768
[main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.cacheTrimInterval: 8192
[main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.cacheTrimIntervalMillis: 0
[main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.useCacheForAllThreads: true
[main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.maxCachedByteBuffersPerChunk: 1023
[main] DEBUG io.netty.buffer.ByteBufUtil - -Dio.netty.allocator.type: pooled
[main] DEBUG io.netty.buffer.ByteBufUtil - -Dio.netty.threadLocalDirectBufferSize: 0
[main] DEBUG io.netty.buffer.ByteBufUtil - -Dio.netty.maxThreadLocalCharBufferSize: 16384
[main] TRACE org.apache.plc4x.java.spi.connection.DefaultNettyPlcConnection - Channel was created, firing ChannelCreated Event
[nioEventLoopGroup-2-1] DEBUG org.apache.plc4x.java.spi.Plc4xNettyWrapper - User Event triggered org.apache.plc4x.java.spi.events.ConnectEvent#645e8927
[nioEventLoopGroup-2-1] DEBUG org.apache.plc4x.java.eip.readwrite.protocol.EipProtocolLogic - Sending RegisterSession EIP Package
[nioEventLoopGroup-2-1] TRACE org.apache.plc4x.java.spi.Plc4xNettyWrapper - Adding Response Handler ...
[nioEventLoopGroup-2-1] TRACE org.apache.plc4x.java.spi.Plc4xNettyWrapper - Sending to wire EipConnectionRequest[sessionHandle=0,status=0,senderContext={0,0,0,0,0,0,0,0},options=0]
[nioEventLoopGroup-2-1] DEBUG org.apache.plc4x.java.spi.Plc4xNettyWrapper - Forwarding request to plc EipConnectionRequest[sessionHandle=0,status=0,senderContext={0,0,0,0,0,0,0,0},options=0]
[nioEventLoopGroup-2-1] DEBUG io.netty.util.Recycler - -Dio.netty.recycler.maxCapacityPerThread: 4096
[nioEventLoopGroup-2-1] DEBUG io.netty.util.Recycler - -Dio.netty.recycler.maxSharedCapacityFactor: 2
[nioEventLoopGroup-2-1] DEBUG io.netty.util.Recycler - -Dio.netty.recycler.linkCapacity: 16
[nioEventLoopGroup-2-1] DEBUG io.netty.util.Recycler - -Dio.netty.recycler.ratio: 8
[nioEventLoopGroup-2-1] DEBUG io.netty.util.Recycler - -Dio.netty.recycler.delayedQueue.ratio: 8
[nioEventLoopGroup-2-1] DEBUG io.netty.buffer.AbstractByteBuf - -Dio.netty.buffer.checkAccessible: true
[nioEventLoopGroup-2-1] DEBUG io.netty.buffer.AbstractByteBuf - -Dio.netty.buffer.checkBounds: true
[nioEventLoopGroup-2-1] DEBUG io.netty.util.ResourceLeakDetectorFactory - Loaded default ResourceLeakDetector: io.netty.util.ResourceLeakDetector#20edcbc7
[nioEventLoopGroup-2-1] DEBUG org.apache.plc4x.java.spi.GeneratedDriverByteToMessageCodec - Sending bytes to PLC for message EipConnectionRequest[sessionHandle=0,status=0,senderContext={0,0,0,0,0,0,0,0},options=0] as data 65000400000000000000000000000000000000000000000001000000
[nioEventLoopGroup-2-1] TRACE org.apache.plc4x.java.spi.GeneratedDriverByteToMessageCodec - Receiving bytes, trying to decode Message...
[nioEventLoopGroup-2-1] TRACE org.apache.plc4x.java.spi.Plc4xNettyWrapper - Decoding EipConnectionRequest[sessionHandle=3604940806,status=0,senderContext={0,0,0,0,0,0,0,0},options=0]
[nioEventLoopGroup-2-1] TRACE org.apache.plc4x.java.spi.Plc4xNettyWrapper - Checking handler HandlerRegistration#0 for Object of type EipConnectionRequest
[nioEventLoopGroup-2-1] TRACE org.apache.plc4x.java.spi.Plc4xNettyWrapper - Handler HandlerRegistration#0 has right expected type EipPacket, checking condition
[nioEventLoopGroup-2-1] TRACE org.apache.plc4x.java.spi.Plc4xNettyWrapper - Handler HandlerRegistration#0 accepts element EipConnectionRequest[sessionHandle=3604940806,status=0,senderContext={0,0,0,0,0,0,0,0},options=0], calling handle method
[nioEventLoopGroup-2-1] DEBUG org.apache.plc4x.java.eip.readwrite.protocol.EipProtocolLogic - Got assigned with Session 3604940806
[nioEventLoopGroup-2-1] TRACE org.apache.plc4x.java.spi.Plc4xNettyWrapper - Firing Connected!
[main] INFO com.example.plctest.ReadPlcDemo - PLC can read!
[main] TRACE org.apache.plc4x.java.spi.transaction.RequestTransactionManager - Submission of transaction 0
[pool-2-thread-1] TRACE org.apache.plc4x.java.spi.transaction.RequestTransactionManager - Start execution of transaction 0
[pool-2-thread-1] TRACE org.apache.plc4x.java.spi.Plc4xNettyWrapper - Adding Response Handler ...
[pool-2-thread-1] TRACE org.apache.plc4x.java.spi.transaction.RequestTransactionManager - Completed execution of transaction 0
[nioEventLoopGroup-2-1] DEBUG org.apache.plc4x.java.spi.Plc4xNettyWrapper - Forwarding request to plc CipRRData[sessionHandle=3604940806,status=0,senderContext={0,0,0,0,0,0,0,0},options=0,exchange=CipExchange[service=CipUnconnectedRequest[unconnectedService=CipReadRequest[RequestPathSize=5,tag={-111,7,83,101,110,115,111,114,49,0},elementNb=1],backPlane=0,slot=0]]]
[nioEventLoopGroup-2-1] DEBUG org.apache.plc4x.java.spi.GeneratedDriverByteToMessageCodec - Sending bytes to PLC for message CipRRData[sessionHandle=3604940806,status=0,senderContext={0,0,0,0,0,0,0,0},options=0,exchange=CipExchange[service=CipUnconnectedRequest[unconnectedService=CipReadRequest[RequestPathSize=5,tag={-111,7,83,101,110,115,111,114,49,0},elementNb=1],backPlane=0,slot=0]]] as data 6f002c000608dfd600000000000000000000000000000000000000000000020000000000b2001c00520220062401059d0e004c05910753656e736f723100010001000000
[nioEventLoopGroup-2-1] TRACE org.apache.plc4x.java.spi.GeneratedDriverByteToMessageCodec - Receiving bytes, trying to decode Message...
[nioEventLoopGroup-2-1] INFO org.apache.plc4x.java.eip.readwrite.io.CipRRDataIO - Expected constant value 0 but got 5 for reserved field.
[nioEventLoopGroup-2-1] WARN org.apache.plc4x.java.spi.GeneratedDriverByteToMessageCodec - Error decoding package with content [6f0016000608dfd600000000000000000000000000000000000000000500020000000000b2000600d20001011103]: Unsupported case for discriminated type
org.apache.plc4x.java.spi.generation.ParseException: Unsupported case for discriminated type
at org.apache.plc4x.java.eip.readwrite.io.CipServiceIO.staticParse(CipServiceIO.java:100)
at org.apache.plc4x.java.eip.readwrite.io.CipExchangeIO.staticParse(CipExchangeIO.java:96)
at org.apache.plc4x.java.eip.readwrite.io.CipRRDataIO.staticParse(CipRRDataIO.java:80)
at org.apache.plc4x.java.eip.readwrite.io.EipPacketIO.staticParse(EipPacketIO.java:101)
at org.apache.plc4x.java.eip.readwrite.io.EipPacketIO.parse(EipPacketIO.java:48)
at org.apache.plc4x.java.eip.readwrite.io.EipPacketIO.parse(EipPacketIO.java:42)
at org.apache.plc4x.java.spi.GeneratedDriverByteToMessageCodec.decode(GeneratedDriverByteToMessageCodec.java:79)
at io.netty.handler.codec.ByteToMessageCodec$1.decode(ByteToMessageCodec.java:42)
at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:507)
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:446)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276)
at io.netty.handler.codec.ByteToMessageCodec.channelRead(ByteToMessageCodec.java:103)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:719)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:655)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:581)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:829)
I'd appreciate any help or if someone could point me in the right direction, in terms of how to solve this. Thanks in advance!
Guillermo
For anyone having the same issue:
Apparently, from what I've read, the Micro820 series have limitations reading tags. In the case of the PLC I was using (2080-LC20-20QWB) I had to:
Establish a session by sending a "Forward_Open" request. The details of the request is in page 105 of the CIP specification.
Once the connection is established, multiple "Read Data" requests can be send with the names of the tags that you wish the read.
Finally, a "Forward_Close" request is send in order to close the connection.
And that's it.
I cloned this project and implemented the steps that I just described. You can find my version here.
And here's an example showing how to use it:
try {
EtherNetIP plc = new EtherNetIP("10.0.1.100", 0);
plc.connectTcp();
List<TagReadReply> tags = plc.connectAndReadTags("Sensor1", "Sensor2" , "Sensor10");
tags.forEach(each -> {
logger.info("Tag name:" + each.getTag() + " is valid ? " + each.isValid());
});
} catch (Exception e) {
e.printStackTrace();
logger.severe("Exception occurred:" + e.getMessage());
}

Cognito permission to lambda function using serverless framework

I tried giving my lambda function permission to access Cognito and also to invoke another lambda function using the following code in my serverless.yml file.
The code :
# NOTE: update this with your service name
service: xxxx
# Use the serverless-webpack plugin to transpile ES6
plugins:
- serverless-webpack
- serverless-offline
# serverless-webpack configuration
# Enable auto-packing of external modules
custom:
webpack:
webpackConfig: ./webpack.config.js
includeModules: true
provider:
name: aws
runtime: nodejs8.10
stage: dev
region: ap-south-1
environment:
MYSQLHOST: 'xxxx'
MYSQLPORT: 'xxxx'
MYSQLUSER: 'xxxx'
MYSQLPASS: 'xxxx'
MYSQLDATABASE: 'xxxx'
USERPOOLID: 'xxxx'
USERPOOLREGION: 'xxxx'
# To load environment variables externally
# rename env.example to env.yml and uncomment
# the following line. Also, make sure to not
# commit your env.yml.
#
#environment: ${file(env.yml):${self:provider.stage}}
Version: "2012-10-17"
iamRoleStatements:
- Effect: "Allow"
Action:
-cognito-identity:*
-cognito-sync:*
-cognito-idp:*
-lambda:*
Resource:
-"*"
functions:
# Defines an HTTP API endpoint that calls the main function in create.js
# - path: url path is /notes
# - method: POST request
# - cors: enabled CORS (Cross-Origin Resource Sharing) for browser cross
# domain api call
# - authorizer: authenticate using the AWS IAM role
createUser:
handler: createUser.main
events:
- http:
path: users/create
method: post
cors: true
authorizer: aws_iam
getUsers:
handler: getUsers.main
events:
- http:
path: getUsers
method: get
cors: true
authorizer: aws_iam
When I added the permissions for dynamodb , those got added to my lambda Role.But the cognito permissions arent getting attached to the role.
The Serverless Framework , handles the creation of role on its own , based on the yml file.
Once the role gets created , I can add the policy through the AWS console.
But the framework doesn't create them even after specifying.