Following the implementation guide from Spring on creating CouchbaseConfig by extending AbstractCouchbaseConfiguration.
Problem #1
My local Couch instance exists on "http://localhost:5984/" At application runtime the default port always results in the value "11210" which ultimatly results in connectivity failure.
Solution
To resolve this issue I am overriding the implementation which creates CouchbaseClient within my CouchbaseConfig component (Code snippet below)
public CouchbaseClient couchbaseClient() throws Exception {
CouchbaseClient client = null;
URI local=new URI("http://127.0.0.1:5984");
List<URI> baseURIs=new ArrayList<URI>();
baseURIs.add(local);
client = new CouchbaseClient(baseURIs, bucketValue, "");
......
I am still not able to locate the bucket I have setup in my local couch instance
http-bio-8080-exec-25] INFO 18:18:14,172 SLF4JLogger.log(87) - Could not fetch config from http seed nodes.
com.couchbase.client.vbucket.ConfigurationException: Configuration for bucket "bucketValue" was not found in server list ([http://127.0.0.1:5984]).
at com.couchbase.client.vbucket.ConfigurationProviderHTTP.readPools(ConfigurationProviderHTTP.java:271)
at com.couchbase.client.vbucket.ConfigurationProviderHTTP.getBucketConfiguration(ConfigurationProviderHTTP.java:143)
at com.couchbase.client.vbucket.provider.BucketConfigurationProvider.bootstrapHttp(BucketConfigurationProvider.java:351)
Any information on how to resolve this would be greatly appreciated.
So, I think what you have done here is confused Couchbase and CouchDb - they are entirely different platforms, even though they have confusingly-similar names.
You need to install a local instance of Couchbase if that is what you are trying to do, and get rid of Couchdb.
Related
I'm trying to create an object in Minio. Sometimes it works and sometimes no.
When I execute :
minioClient.makeBucket(bucketName); // bucketName es a random unique string
I don´t get error, but if If ask Minio if bucket exists:
minioClient.bucketExists(bucketName)
it returns false
After that, If I try to launch once again minioClient.makeBucket(bucketName) because minioClient.bucketExists(bucketName) is returning false, then I get this error (simplified):
BucketAlreadyOwnedByYou
So that, when I get previous error, I try to create object in Minio :
minioClient.putObject(bucketName, objectName, is,null,customMetaData,null, null ); // is is an InputStream of the file I want to store in Minio
But I get this error, saying bucket does not exist;
ErrorResponse(code=NoSuchBucket, message=The specified bucket does not exist, bucketName=888bf891-064f-4270-b0f0-85514c0eae02, objectName=L7aEmF8Ppk, resource=/888bf891-064f-4270-b0f0-85514c0eae02/L7aEmF8Ppk, requestId=16733C7840E6854D, hostId=null)
Any help will be appreciated.
I'm using version 6.0.13 of Minio Java API
This not how MinIO should behave. I have only seen this error where it was either a programming error or a setup error.
When it is a setup error, the root problem is that instead of creating 1 server pool with 4 distributed nodes, people have created 4 server pools each with a single node. This means that when your application gets load balanced, it will sometimes hit the server pool where you created the bucket and sometimes not.
Another cause can be an non-consistent filesystem used as backend. For example NFS with certain settings can have behavior like this. The recommended filesystem is XFS.
Without knowing more about your setup I cannot tell you which one it is.
I am working on golang version of fabcar smart contract while seeking to implement a Java-SDK API which enrolls an admin, registers a user and performs query-update value operations based on https://github.com/hyperledger/fabric-samples/tree/master/fabcar/java
I have successfully set up a 3 org-9 peers blockchain network, installed, instantiated and invoked chaincode on peers.
However, as i am working on implementing the relative API, i am only able to successfully query blockchain database, while getting a "Could not meet endorsement policy for chaincode mycc"
Please find below screenshot of relative error
Endorsement policy is "OR ('Org1MSP.member','Org2MSP.member', 'Org3MSP.member')".
Should registered user somehow get an Org1/Org2/Org3.member attribute? Any leads would be appreciated!
Like #Ikar Pohorský said, for me this got resolved after I used correct method name. Also, ensure that you delete 'wallet' folder in order to regenerate the user if your HLF n/w was recreated.
#Test
public void testMyMethodToBeInvoked() throws Exception {
deleteDirectory(".\\wallet");
EnrollAdmin.main(null);
RegisterUser.main(null);
// Load a file system based wallet for managing identities.
final Path walletPath = Paths.get("wallet");
final Wallet wallet = Wallet.createFileSystemWallet(walletPath);
// load a CCP
final Path networkConfigPath = Paths
.get("C:\\sw\\hlf146-2\\fabric-samples\\first-network\\connection-org1.yaml");
final Gateway.Builder builder = Gateway.createBuilder();
builder.identity(wallet, "user1").networkConfig(networkConfigPath).discovery(true);
// create a gateway connection
try (Gateway gateway = builder.connect()) {
final Network network = gateway.getNetwork("mychannel");
final Contract contract = network.getContract("mycc");
String myJSONString="{\"a\":\"b\"}";
byte[] result;
// Following did NOT work. Control goes directly to 'invoke' when 'submitTransaction' is done directly. 'invoke' need not be mentioned here.
// result = contract.submitTransaction("invoke", myJSONString);
// Following DID work. In chaincode (my chain code was Java) I had a method named 'myMethodToBeInvoked'. The chain code was written similar to https://github.com/hyperledger/fabric-samples/blob/release-1.4/chaincode/chaincode_example02/java/src/main/java/org/hyperledger/fabric/example/SimpleChaincode.java
result = contract.submitTransaction("myMethodToBeInvoked", my);
System.out.println(new String(result));
}
}
EDIT: Also, please remember that if your chaincode throws errorResponse, even then we can have this endorsement fail issue. So, check if your chain code is working without any issues.
I'm trying to start a new MySql Instance on Amazon RDS using the Java API and the following code:
CreateDBInstanceRequest createDBInstanceRequest = new CreateDBInstanceRequest();
createDBInstanceRequest.setEngine("MySQL");
createDBInstanceRequest.setLicenseModel("general-public-license");
createDBInstanceRequest.setEngineVersion("5.5.25a");
createDBInstanceRequest.setDBInstanceClass("db.t1.micro");
createDBInstanceRequest.setMultiAZ(false);
createDBInstanceRequest.setAutoMinorVersionUpgrade(true);
createDBInstanceRequest.setAllocatedStorage(5);
createDBInstanceRequest.setDBInstanceIdentifier("mydbinstance");
createDBInstanceRequest.setMasterUsername("master");
createDBInstanceRequest.setMasterUserPassword("password");
createDBInstanceRequest.setDBName("dbname");
createDBInstanceRequest.setPort(3306);
createDBInstanceRequest.setDBParameterGroupName("default.mysql5.5");
createDBInstanceRequest.setDBSubnetGroupName("dev");
createDBInstanceRequest.setBackupRetentionPeriod(1);
DBInstance dbInstance = RDS.createDBInstance(createDBInstanceRequest);
The problem is that this always results in the following error:
AWS Error Code: InsufficientDBInstanceCapacity, AWS Error Message:
Cannot create a database instance because there is no availability
zone with sufficient capacity. Please try your request again at a
later time.
As suggested, I tried at a later time but have never been able to launch a new instance programatically but when I try to launch an instance using the Amazon Mgmt Console, using exactly the same parameters, it launches instantly.
I have also noticed that this problem only occurs with DB Instance Class "db.t1.micro".
Is this instance class not available through the API?
Are you certain this exact version of MySQL is available in any of the availability zones in your region?
I would suggest to execute DescribeOrderableDBInstanceOptions for your engine of choice first, filter using your own criteria (e.g. DBInstanceClass="db.t1.micro") and then select the version from that.
I'm trying to start a Amazon EC2 cloud machine with [startInstance][2] method using aws-sdk in Java. My code is as follows.
public String startInstance(String instanceId) throws Exception {
List<String> instanceIds = new ArrayList<String>();
instanceIds.add(instanceId);
StartInstancesRequest startRequest = new StartInstancesRequest(
instanceIds);
startRequest.setRequestCredentials(getCredentials());
StartInstancesResult startResult = ec2.startInstances(startRequest);
List<InstanceStateChange> stateChangeList = startResult
.getStartingInstances();
log.trace("Starting instance '{}':", instanceId);
// Wait for the instance to be started
return waitForTransitionCompletion(stateChangeList, "running",
instanceId);
}
When I run the above code, i'm getting the following AWS error:
Status Code: 400, AWS Request ID: e1bd4795-a609-44d1-9e80-43611e80006b, AWS Erro
r Code: InvalidInstanceID.NotFound, AWS Error Message: The instance ID 'i-2b97ac
2f' does not exist
at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpCli
ent.java:538)
at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.ja
va:283)
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:168
)
at com.amazonaws.services.ec2.AmazonEC2Client.invoke(AmazonEC2Client.jav
a:5208)
at com.amazonaws.services.ec2.AmazonEC2Client.startInstances(AmazonEC2Cl
ient.java:2426)
AWS Error Message: The instance ID 'i-2b97ac2f' does not exist
You'll have to take the AWS response for granted here, i.e. the instance does not exist ;)
But seriously: Presumably you have already verified that you are actually running an instance with this ID in your account? Then this is most likely caused by targeting the wrong API endpoint, insofar an instance ID is only valid within a specific region (if not specified, the region defaults to 'us-east-1', see below).
In this case you need to specify the actual instance region via the setEndpoint() method of the AmazonEC2Client object within the apparently global ec2 variable before calling startInstances().
There are some examples regarding Using Regions with the AWS SDKs and all currently available AWS regional endpoint URLs are listed in Regions and Endpoints, specifically the Amazon Elastic Compute Cloud (EC2) defaults to 'us-east-1':
If you just specify the general endpoint (ec2.amazonaws.com), Amazon
EC2 directs your request to the us-east-1 endpoint.
We run a service (Qubole) that frequently spawns and then tags (and in some cases terminates) AWS instances immediately.
We have found that Amazon will, every once in a while, claim an instanceid as invalid - even though it has just created it. Retrying a few times with some sleep time thrown in usually solves the problem. Even a total retry interval of 15s proved insufficient in rare cases.
This experience comes from the useast region. We do not make api calls to different regions - so that is not an explanation. More likely - this is the infamous eventual consistency at work - where AWS is unable to provide read-after-write consistency for these api calls.
I am using the AWS ruby api and I noticed the same issue when creating an AMI image and its status is pending when I look in the AWS console but after a while the image is available for use.
Here is my script
image = ec2.images.create(:name => image_name, :instance_id => ami_id, :description => desc)
sleep 5 while image.state != :available
I sleep for about 5 sec for image to be in available but I get the error saying that the "AWS Error Message: InvalidInstanceID.NotFound". During my testing this is fine but most of the time this seems to be failing during continuous integration builds.
InvalidInstanceID.NotFound means the specified instance does not exist.
Ensure that you have indicated the region in which the instance is located, if it's not in the default region.
This error may occur because the ID of a recently created instance has not propagated through the system. For more information, see Eventual Consistency.
I am using openid4java library for implementing the 'login with google' functionality in a spring-mvc application.
It works fine on my local tomcat server but on the remote server it has suddenly stopped working. It was working fine before there too.
After doing some logging in catalina.out I found that the verification of the response fails after google redirects to the return url
VerificationResult verification = openIdService.getConsumerManager().verify(
receivingURL.toString(),
response, discovered);
Identifier verified = verification.getVerifiedId(); //Null
The value of verified is null on the remote server. On local server its an uri
I am aware that while handling the response, ConsumerManager needs to be the same
instance used to place the authentication request.
The rest of the code is implemented as follows
There is an OpenIdController in which OpenIdService is Autowired.
The OpenIdServiceImpl implements OpenIdService and has the getConsumerManager method which returns the consumerManager instance.
In the construct of the OpenIdServiceImpl, an instance of ConsumerManager is created.
The actions that create the form for submission and handle the response are written in the
OpenIdController and access the consumerManager instance using the getConsumerManager method.
Edit:
I tried logging the Discovery information before the form submission and in the call back here it the output
Debugging OpenId: Discovered (before) OpenID2
OP-endpoint:https://www.google.com/accounts/o8/ud
ClaimedID:null
Delegate:null
Debugging OpenId: Discovered (after) OpenID2
OP-endpoint:https://www.google.com/accounts/o8/ud
ClaimedID:null
Delegate:nul
Am I doing anything wrong here ? But it works on local server!
Or something to do with tomcat configuration on the remote server ?
Any help is appreciated. I can post code if required.
Thanks.
I could resolve this problem by adding the following lines after creating an instance of ConsumerManager.
consumerManager.setAssociations(new InMemoryConsumerAssociationStore());
consumerManager.setNonceVerifier(new InMemoryNonceVerifier(5000));
consumerManager.setMinAssocSessEnc(AssociationSessionType.DH_SHA256);
I found it mentioned it in one of the comments to the SampleConsumer example here - http://code.google.com/p/openid4java/wiki/SampleConsumer
see response #3 from the bottom.
Haven't yet tried to figure out what it does, but hope its the right way to solve it :)