I'm a newbie to spring integration and I'm using the following code,
package services.api;
public interface GreetingService {
public void greetUsers(String userName);
}
package services.impl;
import services.api.GreetingService;
public class GreetServiceImpl implements GreetingService {
#Override
public void greetUsers(String userName) {
if (userName != null && userName.trim().length() > 0) {
System.out.println("Hello " + userName);
}
}
}
package main;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.integration.Message;
import org.springframework.integration.MessageChannel;
import org.springframework.integration.support.MessageBuilder;
public class Main {
public static void main(String[] args)
{
ApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContext.xml");
MessageChannel messageChannel = applicationContext.getBean(MessageChannel.class);
Message<String> message = MessageBuilder.withPayload("World").build();
messageChannel.send(message);
}
}
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://springframework.org/schema/integration"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://springframework.org/schema/integration http://springframework.org/schema/integration/spring-integration.xsd">
<channel id="pushChannel" />
<service-activator input-channel="pushChannel" ref="service"
method="greetUsers" />
<beans:bean id="service" class="services.impl.GreetServiceImpl" />
</beans:beans>
I'm getting the following error, eventhough I've declared only one message channel
Mar 04, 2014 4:46:23 PM org.springframework.context.support.ClassPathXmlApplicationContext prepareRefresh
INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext#34d0cdd0: startup date [Tue Mar 04 16:46:23 IST 2014]; root of context hierarchy
Mar 04, 2014 4:46:23 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [applicationContext.xml]
Mar 04, 2014 4:46:23 PM org.springframework.beans.factory.config.PropertiesFactoryBean loadProperties
INFO: Loading properties file from URL [jar:file:/D:/Personal%20Data/Softwares/spring-framework-4.0.0.RELEASE-dist/SpringIntegration/spring-integration-3.0.0.RELEASE-dist/spring-integration-3.0.0.RELEASE/libs/spring-integration-core-3.0.0.RELEASE.jar!/META-INF/spring.integration.default.properties]
Mar 04, 2014 4:46:23 PM org.springframework.integration.config.xml.IntegrationNamespaceHandler registerHeaderChannelRegistry
INFO: No bean named 'integrationHeaderChannelRegistry' has been explicitly defined. Therefore, a default DefaultHeaderChannelRegistry will be created.
Mar 04, 2014 4:46:23 PM org.springframework.integration.config.xml.DefaultConfiguringBeanFactoryPostProcessor registerErrorChannel
INFO: No bean named 'errorChannel' has been explicitly defined. Therefore, a default PublishSubscribeChannel will be created.
Mar 04, 2014 4:46:23 PM org.springframework.integration.config.xml.DefaultConfiguringBeanFactoryPostProcessor registerTaskScheduler
INFO: No bean named 'taskScheduler' has been explicitly defined. Therefore, a default ThreadPoolTaskScheduler will be created.
Mar 04, 2014 4:46:23 PM org.springframework.beans.factory.config.PropertiesFactoryBean loadProperties
INFO: Loading properties file from URL [jar:file:/D:/Personal%20Data/Softwares/spring-framework-4.0.0.RELEASE-dist/SpringIntegration/spring-integration-3.0.0.RELEASE-dist/spring-integration-3.0.0.RELEASE/libs/spring-integration-core-3.0.0.RELEASE.jar!/META-INF/spring.integration.default.properties]
Mar 04, 2014 4:46:23 PM org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler initialize
INFO: Initializing ExecutorService 'taskScheduler'
Mar 04, 2014 4:46:23 PM org.springframework.context.support.DefaultLifecycleProcessor start
INFO: Starting beans in phase -2147483648
Mar 04, 2014 4:46:23 PM org.springframework.integration.endpoint.EventDrivenConsumer logComponentSubscriptionEvent
INFO: Adding {logging-channel-adapter:_org.springframework.integration.errorLogger} as a subscriber to the 'errorChannel' channel
Mar 04, 2014 4:46:23 PM org.springframework.integration.channel.PublishSubscribeChannel adjustCounterIfNecessary
INFO: Channel 'org.springframework.context.support.ClassPathXmlApplicationContext#34d0cdd0.errorChannel' has 1 subscriber(s).
Mar 04, 2014 4:46:23 PM org.springframework.integration.endpoint.EventDrivenConsumer start
INFO: started _org.springframework.integration.errorLogger
Mar 04, 2014 4:46:23 PM org.springframework.context.support.DefaultLifecycleProcessor start
INFO: Starting beans in phase 0
Mar 04, 2014 4:46:23 PM org.springframework.integration.endpoint.EventDrivenConsumer logComponentSubscriptionEvent
INFO: Adding {service-activator} as a subscriber to the 'pushChannel' channel
Mar 04, 2014 4:46:23 PM org.springframework.integration.channel.DirectChannel adjustCounterIfNecessary
INFO: Channel 'org.springframework.context.support.ClassPathXmlApplicationContext#34d0cdd0.pushChannel' has 1 subscriber(s).
Mar 04, 2014 4:46:23 PM org.springframework.integration.endpoint.EventDrivenConsumer start
INFO: started org.springframework.integration.config.ConsumerEndpointFactoryBean#0
Exception in thread "main" org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [org.springframework.integration.MessageChannel] is defined: expected single matching bean but found 3: pushChannel,nullChannel,errorChannel
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:312)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:985)
at main.Main.main(Main.java:17)
I suggest you to read more Docs:
http://docs.spring.io/spring-integration/docs/3.0.1.RELEASE/reference/html
http://www.manning.com/fisher
As you see the framework provides two explicit channels: nullChannel, errorChannel.
And they aren't the last beans which are populated by framework.
To fix your issue just provide the id of your channel to applicationContext.getBean
Related
I tried all the possible solutions available online. Changed my token with all permissions. Changed the gitlab connection with latest token. Still pipelines in gitlab shows the pending status. These are the logs from jenkins.
Mar 23, 2022 5:37:19 PM INFO com.dabsquared.gitlabjenkins.util.CommitStatusUpdater retrieveGitlabProjectIds
Retrieving gitlab project ids
Mar 23, 2022 5:37:19 PM WARNING com.dabsquared.gitlabjenkins.util.CommitStatusUpdater retrieveGitlabProjectIds
No gitlab client found.
Mar 23, 2022 5:38:13 PM INFO com.dabsquared.gitlabjenkins.util.CommitStatusUpdater retrieveGitlabProjectIds
Retrieving gitlab project ids
Mar 23, 2022 5:38:13 PM WARNING com.dabsquared.gitlabjenkins.util.CommitStatusUpdater retrieveGitlabProjectIds
No gitlab client found.
Mar 23, 2022 5:38:13 PM INFO com.dabsquared.gitlabjenkins.util.CommitStatusUpdater retrieveGitlabProjectIds
Retrieving gitlab project ids
Mar 23, 2022 5:38:13 PM WARNING com.dabsquared.gitlabjenkins.util.CommitStatusUpdater retrieveGitlabProjectIds
No gitlab client found.
Mar 23, 2022 5:38:14 PM INFO com.dabsquared.gitlabjenkins.util.CommitStatusUpdater retrieveGitlabProjectIds
Retrieving gitlab project ids
Mar 23, 2022 5:38:14 PM WARNING com.dabsquared.gitlabjenkins.util.CommitStatusUpdater retrieveGitlabProjectIds
No gitlab client found.
Mar 23, 2022 5:38:14 PM INFO com.dabsquared.gitlabjenkins.util.CommitStatusUpdater retrieveGitlabProjectIds
Retrieving gitlab project ids
Mar 23, 2022 5:38:14 PM WARNING com.dabsquared.gitlabjenkins.util.CommitStatusUpdater retrieveGitlabProjectIds
No gitlab client found.
Mar 23, 2022 5:38:14 PM INFO com.dabsquared.gitlabjenkins.util.CommitStatusUpdater retrieveGitlabProjectIds
Retrieving gitlab project ids
Mar 23, 2022 5:38:14 PM WARNING com.dabsquared.gitlabjenkins.util.CommitStatusUpdater retrieveGitlabProjectIds
No gitlab client found.
Mar 23, 2022 5:38:15 PM INFO org.jenkinsci.plugins.workflow.job.WorkflowRun finish
multi/pipelines-check #79 completed: SUCCESS
Mar 23, 2022 5:38:15 PM INFO io.jenkins.plugins.generic.event.HttpEventSender send
Skipped event sending due to receiver URL not set
Mar 23, 2022 5:38:16 PM WARNING jenkins.util.Listeners lambda$notify$0
null
java.lang.NullPointerException
at io.jenkins.plugins.gitlabbranchsource.helpers.GitLabPipelineStatusNotifier.lambda$getStatusName$0(GitLabPipelineStatusNotifier.java:102)
at java.logging/java.util.logging.Logger.log(Logger.java:1050)
at io.jenkins.plugins.gitlabbranchsource.helpers.GitLabPipelineStatusNotifier.getStatusName(GitLabPipelineStatusNotifier.java:101)
at io.jenkins.plugins.gitlabbranchsource.helpers.GitLabPipelineStatusNotifier.getStatusName(GitLabPipelineStatusNotifier.java:84)
at io.jenkins.plugins.gitlabbranchsource.helpers.GitLabPipelineStatusNotifier.logComment(GitLabPipelineStatusNotifier.java:178)
at io.jenkins.plugins.gitlabbranchsource.helpers.GitLabPipelineStatusNotifier.access$500(GitLabPipelineStatusNotifier.java:52)
at io.jenkins.plugins.gitlabbranchsource.helpers.GitLabPipelineStatusNotifier$JobCompletedListener.onCompleted(GitLabPipelineStatusNotifier.java:484)
at hudson.model.listeners.RunListener.lambda$fireCompleted$0(RunListener.java:207)
at jenkins.util.Listeners.lambda$notify$0(Listeners.java:59)
at jenkins.util.Listeners.notify(Listeners.java:67)
at hudson.model.listeners.RunListener.fireCompleted(RunListener.java:205)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.finish(WorkflowRun.java:627)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.access$800(WorkflowRun.java:138)
at org.jenkinsci.plugins.workflow.job.WorkflowRun$GraphL.onNewHead(WorkflowRun.java:1049)
at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.notifyListeners(CpsFlowExecution.java:1474)
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$3.run(CpsThreadGroup.java:497)
at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$1.run(CpsVmExecutorService.java:38)
at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:139)
at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:68)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
JENKINSFILE:
pipeline {
agent {label 'xxx'}
options {
gitLabConnection('xxx')
}
stages {
stage('Code') {
steps {
gitlabCommitStatus(connection: gitLabConnection(gitLabConnection: 'xxx', jobCredentialId: 'xxx-xxx-xxx-xxx-xxxxx', useAlternativeCredential: true), name: 'Code_checkout') {
checkout([$class: 'GitSCM', branches: [[name: '*/develop']], extensions: [[$class: 'GitLFSPull'], [$class: 'RelativeTargetDirectory', relativeTargetDir: 'xxxxxx']], userRemoteConfigs: [[url: 'git#gitlab.com:xxxxx/xxxxxx/root.git']]])
sh'''
cd xxxxxxxxx
git submodule update --init --recursive
cd /home/jenkins/jenkins_slave/workspace/ROOT/vds
git checkout develop
git pull
cd xxxxxxxxxxx
'''
}
}
}
stage('Testing') {
steps {
gitlabCommitStatus(connection: gitLabConnection(gitLabConnection: 'xxxxxx', jobCredentialId: 'xxxxxxx', useAlternativeCredential: true), name: 'Testing') {
echo "checking"
}
}
}
}
all the code checkout part and testing part is happening in shell
You can use these two parameters in optionsblock
options {
gitLabConnection('gitlab')
gitlabBuilds(builds: ['build'])
}
and in post section you can use the updateGitlabCommitStatus like this
post {
failure {
updateGitlabCommitStatus name: 'build', state: 'failed'
}
unstable {
updateGitlabCommitStatus name: 'build', state: 'failed'
}
aborted {
updateGitlabCommitStatus name: 'build', state: 'canceled'
}
success {
updateGitlabCommitStatus name: 'build', state: 'success'
}
always {
}
}
For info checkout this section https://github.com/jenkinsci/gitlab-plugin/blob/master/README.md
So I have function in Lambda. Function is connected to the api gateway and it should add EC2 instance. When im reaching the endpoint by api gateway method test, it returns status 200 but no instance has been added. Maybe the instance params are wrong? Basically the function is modified version of documentation example.
var AWS = require('aws-sdk');
AWS.config.update({region: 'us-east-2'});
exports.handler = function index(event, context, callback) {
// Load the AWS SDK for Node.js
// Load credentials and set region from JSON file
// Create EC2 service object
var ec2 = new AWS.EC2({apiVersion: '2016-11-15'});
// AMI is amzn-ami-2011.09.1.x86_64-ebs
var instanceParams = {
InstanceType: 't2.micro',
KeyName: 'firstkeypair',
ImageId: 'ami-0bbe28eb2173f6167'
};
// Create a promise on an EC2 service object
var instancePromise = new AWS.EC2({apiVersion: '2016-11-15'}).runInstances(instanceParams).promise();
// Handle promise's fulfilled/rejected states
instancePromise.then(
function(data) {
console.log(data);
var instanceId = data.Instances[0].InstanceId;
console.log("Created instance", instanceId);
// Add tags to the instance
tagParams = {Resources: [instanceId], Tags: [
{
Key: 'Name',
Value: 'SDK Sample'
}
]};
// Create a promise on an EC2 service object
var tagPromise = new AWS.EC2({apiVersion: '2016-11-15'}).createTags(tagParams).promise();
// Handle promise's fulfilled/rejected states
tagPromise.then(
function(data) {
console.log("Instance tagged");
}).catch(
function(err) {
console.error(err, err.stack);
});
}).catch(
function(err) {
console.error(err, err.stack);
});
}
AWS test logs:
Execution log for request a83bae6e-2fbf-4d88-ad70-a683a83bdc41
Sun Aug 16 16:56:00 UTC 2020 : Starting execution for request: a83bae6e-2fbf-4d88-ad70-a683a83bdc41
Sun Aug 16 16:56:00 UTC 2020 : HTTP Method: GET, Resource Path: /
Sun Aug 16 16:56:00 UTC 2020 : Method request path: {}
Sun Aug 16 16:56:00 UTC 2020 : Method request query string: {}
Sun Aug 16 16:56:00 UTC 2020 : Method request headers: {}
Sun Aug 16 16:56:00 UTC 2020 : Method request body before transformations:
Sun Aug 16 16:56:00 UTC 2020 : Endpoint request URI: https://lambda.us-east-2.amazonaws.com/2015-03-31/functions/arn:aws:lambda:us-east-2:081348884123:function:hello/invocations
Sun Aug 16 16:56:00 UTC 2020 : Endpoint request headers: {x-amzn-lambda-integration-tag=a83bae6e-2fbf-4d88-ad70-a683a83bdc41, Authorization=**************************************************************************************************************************************************************************************************************************************************************************************59de14, X-Amz-Date=20200816T165600Z, x-amzn-apigateway-api-id=o2hkrbm1o4, X-Amz-Source-Arn=arn:aws:execute-api:us-east-2:081348884123:o2hkrbm1o4/test-invoke-stage/GET/, Accept=application/json, User-Agent=AmazonAPIGateway_o2hkrbm1o4, X-Amz-Security-Token=IQoJb3JpZ2luX2VjEAAaCXVzLWVhc3QtMiJIMEYCIQCPi2S8PtDGsVK3w101D8B05/BCFGyUCzHeX8CT6tC7pAIhAJZCgpbZN94qCVdAgrQGlIIE+ABsO9MDkzh6Lf3WGq3IKr0DCNn//////////wEQARoMNzE4NzcwNDUzMTk1IgxILUqxpu50pB1cJmcqkQP/g+OuOqP7/zXYq8IAzTMolDThuprxjuzwDbmtAmS3adcmmHO25YxBQrId1XiR7ZEU7mq52k4A0nIFhBPkz2dZZIfr8MiLVCDx5tLok8j3lPZJOW+I3n7BVglTMtfQDpPYRSUcIQhOfsSnEEc+FKPzHyrzGsLeazIUHItf5L3xY4QO9tyDWnTXfcM2pp [TRUNCATED]
Sun Aug 16 16:56:00 UTC 2020 : Endpoint request body after transformations:
Sun Aug 16 16:56:00 UTC 2020 : Sending request to https://lambda.us-east-2.amazonaws.com/2015-03-31/functions/arn:aws:lambda:us-east-2:081348884123:function:hello/invocations
Sun Aug 16 16:56:02 UTC 2020 : Received response. Status: 200, Integration latency: 1952 ms
Sun Aug 16 16:56:02 UTC 2020 : Endpoint response headers: {Date=Sun, 16 Aug 2020 16:56:02 GMT, Content-Type=application/json, Content-Length=4, Connection=keep-alive, x-amzn-RequestId=f84212ea-38f8-40cc-b5c6-c12885e78392, x-amzn-Remapped-Content-Length=0, X-Amz-Executed-Version=$LATEST, X-Amzn-Trace-Id=root=1-5f396520-4d9dfcb6b965192c5fea0df6;sampled=0}
Sun Aug 16 16:56:02 UTC 2020 : Endpoint response body before transformations: null
Sun Aug 16 16:56:02 UTC 2020 : Method response body after transformations: null
Sun Aug 16 16:56:02 UTC 2020 : Method response headers: {X-Amzn-Trace-Id=Root=1-5f396520-4d9dfcb6b965192c5fea0df6;Sampled=0, Content-Type=application/json}
Sun Aug 16 16:56:02 UTC 2020 : Successfully completed execution
Sun Aug 16 16:56:02 UTC 2020 : Method completed with status: 200
Policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"iam:*",
"organizations:DescribeAccount",
"organizations:DescribeOrganization",
"organizations:DescribeOrganizationalUnit",
"organizations:DescribePolicy",
"organizations:ListChildren",
"organizations:ListParents",
"organizations:ListPoliciesForTarget",
"organizations:ListRoots",
"organizations:ListPolicies",
"organizations:ListTargetsForPolicy"
],
"Resource": "*"
}
]
}
Edit:
Solved by adding EC2 Full Access permission to Lambda Function.
There were 2 issues as discovered through the comments.
The first was that the RunInstances task was not including the MinCount and MaxCount properties which led to no instances being launched.
Once this was fixed the next issue was a permissions issue due to the lack of permissions to run ec2:RunInstance or e2:CreateTags.
It is worth stating the best practice with permissions is to scope down to the minimal permissions that you require to successfully run.
I have the following code on the hazelcast instance:
ITopic<String> topic;
HazelcastInstance hz = Hazelcast.newHazelcastInstance();
topic = hz.getTopic("data");
Data is repeatedly published to the topic
String event = "abc123"
topic.publish(event);
then on another machine on the LAN I run the client like this:
public class Listener implements MessageListener<String>
{
ClientConfig clientConfig = new ClientConfig();
clientConfig.getNetworkConfig().addAddress("192.168.21.89:5701");
HazelcastInstance client = HazelcastClient.newHazelcastClient(clientConfig);
ITopic<String> topic = client.getTopic("data");
topic.addMessageListener(new Listener());
public void onMessage(Message<String> m) {
System.out.println("onMessage");
}
}
The client finds the hz node and starts, but doesn't see any data message on the iTopic. I thought hz instances and clients would autodiscover each other in default? Do I have to configure hz for the network somehow?
The client log shows:
2015-09-01 15:43:05,518 INFO Listener [main] In main()
In main()
Sep 01, 2015 3:43:05 PM com.hazelcast.core.LifecycleService
INFO: HazelcastClient[hz.client_0_dev][3.5] is STARTING
Sep 01, 2015 3:43:05 PM com.hazelcast.core.LifecycleService
INFO: HazelcastClient[hz.client_0_dev][3.5] is STARTED
Sep 01, 2015 3:43:06 PM com.hazelcast.core.LifecycleService
INFO: HazelcastClient[hz.client_0_dev][3.5] is CLIENT_CONNECTED
Sep 01, 2015 3:43:06 PM com.hazelcast.client.spi.impl.ClientMembershipListener
INFO:
Members [1] {
Member [192.168.21.89]:5701
}
This was my own problem because I was not actually publishing the data I wanted to listen to. Aaargh!
In the documentation, it looks like I can set up a plain text password instead of an encrypted one.
com.iplanet.am.service.secret
When using a plain text password, set this to the password for the agent profile, and leave am.encryption.pwd blank.
So, I've set the following in my OpenSSOAgentBootstrap.properties:
com.iplanet.am.service.secret = myPlainTextPassword
am.encryption.pwd =
Accessing the agent application now gives me:
java.lang.RuntimeException: Failed to load configuration: Invalid application password specified
com.sun.identity.agents.arch.AgentConfiguration.bootStrapClientConfiguration(AgentConfiguration.java:790)
com.sun.identity.agents.arch.AgentConfiguration.initializeConfiguration(AgentConfiguration.java:1140)
com.sun.identity.agents.arch.AgentConfiguration.<clinit>(AgentConfiguration.java:1579)
com.sun.identity.agents.arch.Manager.<clinit>(Manager.java:675)
com.sun.identity.agents.filter.AmAgentBaseFilter.initializeFilter(AmAgentBaseFilter.java:274)
com.sun.identity.agents.filter.AmAgentBaseFilter.getAmFilterInstance(AmAgentBaseFilter.java:364)
com.sun.identity.agents.filter.AmAgentBaseFilter.doFilter(AmAgentBaseFilter.java:73)
I also saw from here that I should be using com.iplanet.am.service.password instead. This did not work either.
Is there something that must be set on the OpenAM server? Am I missing something on the agent side of things?
Edit 1
OpenAM Server is v12.0.0, and the Tomcat agent is v3.3.0.
Log entries before the exception:
2015-04-01 12:44:09,634 [localhost-startStop-1] INFO org.springframework.web.servlet.DispatcherServlet - FrameworkServlet 'myapp': initialization started
2015-04-01 12:44:09,634 [localhost-startStop-1] INFO org.springframework.web.context.support.XmlWebApplicationContext - Refreshing WebApplicationContext for namespace 'myapp': startup date [Wed Apr 01 12:44:09 PDT 2015]; parent: Root WebApplicationContext
2015-04-01 12:44:09,634 [localhost-startStop-1] INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/servlet-context.xml]
Apr 01, 2015 12:44:09 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'myapp'
2015-04-01 12:44:09,775 [localhost-startStop-1] INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Overriding bean definition for bean 'mvcContentNegotiationManager': replacing [Root bean: class [org.springframework.web.accept.ContentNegotiationManagerFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration; factoryMethodName=mvcContentNegotiationManager; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/web/servlet/config/annotation/DelegatingWebMvcConfiguration.class]]
2015-04-01 12:44:09,775 [localhost-startStop-1] INFO org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader - Skipping bean definition for [BeanMethod:name=mvcUriComponentsContributor,declaringClass=org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport]: a definition for bean 'mvcUriComponentsContributor' already exists. This top-level bean definition is considered as an override.
2015-04-01 12:44:09,994 [localhost-startStop-1] INFO org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter - Looking for #ControllerAdvice: WebApplicationContext for namespace 'myapp': startup date [Wed Apr 01 12:44:09 PDT 2015]; parent: Root WebApplicationContext
2015-04-01 12:44:10,135 [localhost-startStop-1] INFO org.springframework.web.servlet.handler.SimpleUrlHandlerMapping - Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler]
2015-04-01 12:44:10,182 [localhost-startStop-1] INFO org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter - Looking for #ControllerAdvice: WebApplicationContext for namespace 'myapp': startup date [Wed Apr 01 12:44:09 PDT 2015]; parent: Root WebApplicationContext
2015-04-01 12:44:10,213 [localhost-startStop-1] INFO org.apache.tiles.access.TilesAccess - Publishing TilesContext for context: org.springframework.web.servlet.view.tiles3.SpringWildcardServletTilesApplicationContext
2015-04-01 12:44:10,244 [localhost-startStop-1] INFO org.springframework.web.servlet.DispatcherServlet - FrameworkServlet 'myapp': initialization completed in 610 ms
Apr 01, 2015 12:44:10 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8081"]
Apr 01, 2015 12:44:10 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8081"]
java.lang.RuntimeException: Invalid application password specified
at com.sun.identity.agents.arch.AgentConfiguration.setApplicationPassword(AgentConfiguration.java:1030)
at com.sun.identity.agents.arch.AgentConfiguration.bootStrapClientConfiguration(AgentConfiguration.java:720)
at com.sun.identity.agents.arch.AgentConfiguration.initializeConfiguration(AgentConfiguration.java:1140)
at com.sun.identity.agents.arch.AgentConfiguration.<clinit>(AgentConfiguration.java:1579)
at com.sun.identity.agents.arch.Manager.<clinit>(Manager.java:675)
at com.sun.identity.agents.filter.AmAgentBaseFilter.initializeFilter(AmAgentBaseFilter.java:274)
at com.sun.identity.agents.filter.AmAgentBaseFilter.getAmFilterInstance(AmAgentBaseFilter.java:364)
at com.sun.identity.agents.filter.AmAgentBaseFilter.doFilter(AmAgentBaseFilter.java:73)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
The agent's debug.out shows:
amAgentCore:04/01/2015 12:44:35:314 PM PDT: Thread[http-bio-8081-exec-1,5,main]
**********************************************
amAgentCore:04/01/2015 12:44:35:314 PM PDT: Thread[http-bio-8081-exec-1,5,main]
AgentConfiguration.setOrganizationName: organization name for realm is set to: /
amAgentCore:04/01/2015 12:44:35:314 PM PDT: Thread[http-bio-8081-exec-1,5,main]
AgentConfiguration: service resolver set to: com.sun.identity.agents.tomcat.v6.AmTomcatAgentServiceResolver
amAgentCore:04/01/2015 12:44:35:314 PM PDT: Thread[http-bio-8081-exec-1,5,main]
AgentConfiguration: service resolver reports EJBContext available: false
amAgentCore:04/01/2015 12:44:35:314 PM PDT: Thread[http-bio-8081-exec-1,5,main]
AgentConfiguration: Application User: myAgent
amSDK:04/01/2015 12:44:35:329 PM PDT: Thread[http-bio-8081-exec-1,5,main]
**********************************************
amSDK:04/01/2015 12:44:35:329 PM PDT: Thread[http-bio-8081-exec-1,5,main]
ERROR: JCEEncryption:: failed to decrypt data
java.lang.NullPointerException
at com.iplanet.services.util.JCEEncryption.pbeDecrypt(JCEEncryption.java:246)
at com.iplanet.services.util.JCEEncryption.decrypt(JCEEncryption.java:141)
at com.iplanet.services.util.Crypt.decode(Crypt.java:343)
at com.iplanet.services.util.Crypt.decryptLocal(Crypt.java:238)
at com.sun.identity.agents.arch.AM70Crypt.decrypt(AM70Crypt.java:57)
at com.sun.identity.agents.arch.AgentConfiguration.setApplicationPassword(AgentConfiguration.java:1020)
at com.sun.identity.agents.arch.AgentConfiguration.bootStrapClientConfiguration(AgentConfiguration.java:720)
at com.sun.identity.agents.arch.AgentConfiguration.initializeConfiguration(AgentConfiguration.java:1140)
at com.sun.identity.agents.arch.AgentConfiguration.<clinit>(AgentConfiguration.java:1579)
at com.sun.identity.agents.arch.Manager.<clinit>(Manager.java:675)
at com.sun.identity.agents.filter.AmAgentBaseFilter.initializeFilter(AmAgentBaseFilter.java:274)
at com.sun.identity.agents.filter.AmAgentBaseFilter.getAmFilterInstance(AmAgentBaseFilter.java:364)
at com.sun.identity.agents.filter.AmAgentBaseFilter.doFilter(AmAgentBaseFilter.java:73)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Let us look at this source code taken from GitHub: OpenRock/OpenAM
private static synchronized void setApplicationPassword() {
if (!isInitialized()) {
try {
_crypt = ServiceFactory.getCryptProvider();
if(_crypt != null) {
String encodedPass = getProperty(SDKPROP_APP_PASSWORD);
_applicationPassword = _crypt.decrypt(encodedPass);
}
} catch (Exception ex) {
logError("AgentConfiguration: Unable to create new instance of " + "Crypt class with exception ", ex);
}
if (_applicationPassword == null || _applicationPassword.trim().length() == 0) {
throw new RuntimeException("Invalid application password specified");
}
}
}
The constant SDFSFD defined as:
public static final String SDKPROP_APP_PASSWORD = "com.iplanet.am.service.secret";
As you can see AgentConfiguration reads the password and stores it into encodedPass.
So I believe the method getCryptProvider returns broken Cryptprovider (_crypt). _crypt.decrypt(encodedPass) get NullPointerException and variable _applicationPassword get never initialized then RuntimeException will thrown.
Make sure your configuration allows or defines a CryptProvider.
ok i saw your edit
NullPointerException occurs here. Try to interpret that.
final Cipher pbeCipher = cipherProvider.getCipher(); // NPE
The documentation appears to be incorrect, from what I can tell based on the source code of AgentConfiguration, the password can be only provided in an encrypted format (which also means that am.encryption.pwd should be set up properly as well.
I am trying to use the distributed executor service for hazelcast 3.1 and find that i am unable to use submitToMember(task,member). In my example below 10.69.108.60 is my local machine and 170.194.100.111 is my remote machine. I am able to get return value in my future when the member is my local machine but gives me a TargetNotAMemberException if the member is remote machine.
Below is the code
public class DistExecutionTest {
public static void main(String args[]){
DistributedExecutor dex = new DistributedExecutor();
try {
Member member = new MemberImpl(new Address("170.194.100.111",5701), false );
String msg;
msg = dex.echoOnTheMember("Hey youuuu!", member);
System.out.println(msg);
} catch (UnknownHostException e1) {
e1.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
}catch (Exception e) {
e.printStackTrace();
}
}
}
and
public class DistributedExecutor {
Config config;
NetworkConfig network;
JoinConfig join;
DistributedExecutor(){
config = new Config();
network = config.getNetworkConfig();
// network.setPort(5701);
join = network.getJoin();
join.getMulticastConfig().setEnabled(false);
join.getTcpIpConfig().addMember("170.194.100.111").addMember("10.69.108.60").setEnabled(true);
network.getInterfaces().setEnabled(true).addInterface("170.194.100.*").addInterface("10.69.108.*");
}
public String echoOnTheMember(String input, Member member) throws Exception {
Callable<String> task = new DistObject(input);
HazelcastInstance hz = Hazelcast.newHazelcastInstance(config);
IExecutorService executorService = hz.getExecutorService("default");
Future<String> future = executorService.submitToMember(task, member);
String distObjectResult = future.get();
return distObjectResult;
}
}
and
public class Echo implements Callable<String>, Serializable, HazelcastInstanceAware {
private static final long serialVersionUID = -3164053990811643392L;
String message = null;
transient HazelcastInstance localInstance;
public Echo(String msg){
message = msg;
}
#Override
public String call() throws Exception {
return localInstance.toString() + message;
}
#Override
public void setHazelcastInstance(HazelcastInstance hazelcastInstance) {
this.localInstance = hazelcastInstance;
}
}
Here is the logging on local machine
Dec 17, 2013 1:03:20 PM com.hazelcast.instance.DefaultAddressPicker
INFO: Interfaces is enabled, trying to pick one address matching to one of: [162.124.194.*, 10.38.148.*]
Dec 17, 2013 1:03:20 PM com.hazelcast.instance.DefaultAddressPicker
INFO: Prefer IPv4 stack is true.
Dec 17, 2013 1:03:20 PM com.hazelcast.instance.DefaultAddressPicker
INFO: Picked Address[10.69.108.60]:5701, using socket ServerSocket[addr=/0:0:0:0:0:0:0:0,localport=5701], bind any local is true
Dec 17, 2013 1:03:21 PM com.hazelcast.system
INFO: [10.69.108.60]:5701 [dev] Hazelcast Community Edition 3.1 (20131011) starting at Address[10.69.108.60]:5701
Dec 17, 2013 1:03:21 PM com.hazelcast.system
INFO: [10.69.108.60]:5701 [dev] Copyright (C) 2008-2013 Hazelcast.com
Dec 17, 2013 1:03:21 PM com.hazelcast.instance.Node
INFO: [10.69.108.60]:5701 [dev] Creating TcpIpJoiner
Dec 17, 2013 1:03:21 PM com.hazelcast.core.LifecycleService
INFO: [10.69.108.60]:5701 [dev] Address[10.69.108.60]:5701 is STARTING
Dec 17, 2013 1:03:21 PM com.hazelcast.cluster.TcpIpJoiner
INFO: [10.69.108.60]:5701 [dev] Connecting to possible member: Address[10.69.108.60]:5703
Dec 17, 2013 1:03:21 PM com.hazelcast.cluster.TcpIpJoiner
INFO: [10.69.108.60]:5701 [dev] Connecting to possible member: Address[10.69.108.60]:5702
Dec 17, 2013 1:03:21 PM com.hazelcast.nio.SocketConnector
INFO: [10.69.108.60]:5701 [dev] Connecting to /10.69.108.60:5703, timeout: 0, bind-any: true
Dec 17, 2013 1:03:21 PM com.hazelcast.nio.SocketConnector
INFO: [10.69.108.60]:5701 [dev] Connecting to /10.69.108.60:5702, timeout: 0, bind-any: true
Dec 17, 2013 1:03:21 PM com.hazelcast.cluster.TcpIpJoiner
INFO: [10.69.108.60]:5701 [dev] Connecting to possible member: Address[170.194.100.111]:5703
Dec 17, 2013 1:03:21 PM com.hazelcast.cluster.TcpIpJoiner
INFO: [10.69.108.60]:5701 [dev] Connecting to possible member: Address[170.194.100.111]:5702
Dec 17, 2013 1:03:21 PM com.hazelcast.nio.SocketConnector
INFO: [10.69.108.60]:5701 [dev] Connecting to /170.194.100.111:5703, timeout: 0, bind-any: true
Dec 17, 2013 1:03:21 PM com.hazelcast.nio.SocketConnector
INFO: [10.69.108.60]:5701 [dev] Connecting to /170.194.100.111:5702, timeout: 0, bind-any: true
Dec 17, 2013 1:03:21 PM com.hazelcast.cluster.TcpIpJoiner
INFO: [10.69.108.60]:5701 [dev] Connecting to possible member: Address[170.194.100.111]:5701
Dec 17, 2013 1:03:21 PM com.hazelcast.nio.SocketConnector
INFO: [10.69.108.60]:5701 [dev] Connecting to /170.194.100.111:5701, timeout: 0, bind-any: true
Dec 17, 2013 1:03:22 PM com.hazelcast.nio.SocketConnector
INFO: [10.69.108.60]:5701 [dev] Could not connect to: /10.69.108.60:5703. Reason: SocketException[Connection refused: connect to address /10.69.108.60:5703]
Dec 17, 2013 1:03:22 PM com.hazelcast.nio.SocketConnector
INFO: [10.69.108.60]:5701 [dev] Could not connect to: /10.69.108.60:5702. Reason: SocketException[Connection refused: connect to address /10.69.108.60:5702]
Dec 17, 2013 1:03:22 PM com.hazelcast.nio.SocketConnector
INFO: [10.69.108.60]:5701 [dev] Could not connect to: /170.194.100.111:5703. Reason: SocketException[Connection refused: connect to address /170.194.100.111:5703]
Dec 17, 2013 1:03:22 PM com.hazelcast.nio.SocketConnector
INFO: [10.69.108.60]:5701 [dev] Could not connect to: /170.194.100.111:5702. Reason: SocketException[Connection refused: connect to address /170.194.100.111:5702]
Dec 17, 2013 1:03:22 PM com.hazelcast.nio.SocketConnector
INFO: [10.69.108.60]:5701 [dev] Could not connect to: /170.194.100.111:5701. Reason: SocketException[Connection refused: connect to address /170.194.100.111:5701]
Dec 17, 2013 1:03:23 PM com.hazelcast.cluster.TcpIpJoiner
INFO: [10.69.108.60]:5701 [dev]
Members [1] {
Member [10.69.108.60]:5701 this
}
Dec 17, 2013 1:03:23 PM com.hazelcast.core.LifecycleService
INFO: [10.69.108.60]:5701 [dev] Address[10.69.108.60]:5701 is STARTED
HazelcastInstance{name='_hzInstance_1_dev', node=Address[10.69.108.60]:5701}Hey youuuu!
The logging on the remote machine is on these lines.Couldnt paste all the logging.Managed to get the important part.
INFO: [10.69.108.60]:5701 [dev] Connecting to possible member: Address[10.38.148.60]:5703
Dec 17, 2013 1:03:21 PM com.hazelcast.cluster.TcpIpJoiner
INFO: [10.69.108.60]:5701 [dev] Connecting to possible member: Address[10.38.148.60]:5702
Dec 17, 2013 1:03:21 PM com.hazelcast.cluster.TcpIpJoiner
INFO: [10.69.108.60]:5701 [dev] Connecting to possible member: Address[10.38.148.60]:5701
Dec 17, 2013 1:03:21 PM com.hazelcast.cluster.TcpIpJoiner
INFO: [10.69.108.60]:5701 [dev] Connecting to possible member: Address[170.194.100.111]:5703
Dec 17, 2013 1:03:21 PM com.hazelcast.cluster.TcpIpJoiner
INFO: [10.69.108.60]:5701 [dev] Connecting to possible member: Address[170.194.100.111]:5702
Dec 17, 2013 1:03:21 PM com.hazelcast.nio.SocketConnector
Members [2] {
Member [10.69.108.60]:5701 this
Member [170.194.100.111]:5701
}
Instead of creating a member instance directly, could you get the member instance using the hz.getCluster().getMembers() method and select the one you want to send to? I want to see if it is caused by the way you are creating that member.
I can't format text in comments, so I'll put another answer.
So the problem you are suffering from is why your members don't form a cluster.
You should see logging like:
Members [2] {
Member [192.168.1.104]:5701 this
Member [192.168.1.104]:5702
}
That is why I need more logging that just your stacktrace, but that currently doesn't provide any more value. I need to see what Hazelcast says about joining other clusters.
I need to see something like this:
Dec 17, 2013 7:24:13 PM com.hazelcast.config.XmlConfigBuilder
INFO: Looking for hazelcast.xml config file in classpath.
Dec 17, 2013 7:24:13 PM com.hazelcast.config.XmlConfigBuilder
WARNING: Could not find hazelcast.xml in classpath.
Hazelcast will use hazelcast-default.xml config file in jar.
Dec 17, 2013 7:24:13 PM com.hazelcast.config.XmlConfigBuilder
INFO: Using configuration file /java/projects/Hazelcast/hazelcast/hazelcast/target/classes/hazelcast-default.xml in the classpath.
Dec 17, 2013 7:24:13 PM com.hazelcast.instance.DefaultAddressPicker
INFO: Prefer IPv4 stack is true.
Dec 17, 2013 7:24:13 PM com.hazelcast.instance.DefaultAddressPicker
INFO: Picked Address[192.168.1.102]:5701, using socket ServerSocket[addr=/0:0:0:0:0:0:0:0,localport=5701], bind any local is true
Dec 17, 2013 7:24:13 PM com.hazelcast.system
INFO: [192.168.1.102]:5701 [dev] [3.2-SNAPSHOT] Hazelcast Community Edition 3.2-SNAPSHOT (20131217) starting at Address[192.168.1.102]:5701
Dec 17, 2013 7:24:13 PM com.hazelcast.system
INFO: [192.168.1.102]:5701 [dev] [3.2-SNAPSHOT] Copyright (C) 2008-2013 Hazelcast.com
Dec 17, 2013 7:24:13 PM com.hazelcast.instance.Node
INFO: [192.168.1.102]:5701 [dev] [3.2-SNAPSHOT] Creating MulticastJoiner
Dec 17, 2013 7:24:13 PM com.hazelcast.core.LifecycleService
INFO: [192.168.1.102]:5701 [dev] [3.2-SNAPSHOT] Address[192.168.1.102]:5701 is STARTING
Dec 17, 2013 7:24:15 PM com.hazelcast.cluster.MulticastJoiner
INFO: [192.168.1.102]:5701 [dev] [3.2-SNAPSHOT]
Members [1] {
Member [192.168.1.102]:5701 this
}
Dec 17, 2013 7:24:16 PM com.hazelcast.core.LifecycleService
INFO: [192.168.1.102]:5701 [dev] [3.2-SNAPSHOT] Address[192.168.1.102]:5701 is STARTED
Dec 17, 2013 7:24:16 PM com.hazelcast.partition.PartitionService
INFO: [192.168.1.102]:5701 [dev] [3.2-SNAPSHOT] Initializing cluster partition table first arrangement...
I was also getting the same error.
It is due to this line in echoonthemember function
HazelcastInstance hz = Hazelcast.newHazelcastInstance(config);
It creates the new hazelcast instance of default or of cfg config. The member is searched in this instance of the hazelcast which is not actually present in it. Thus the error message is displayed as
TargetNotAMemberException.
To have it work properly, just pass the created instance in the echoonthemember function.
E.g by making it the member variable in class DistributedExecutor and setting it by the constructor.
then if your actual instance was 'abcdef', then
use as
IExecutorService executorService = abcdef.getExecutorService("default");
do not create new Hazelcast instance.