I'm having some problems when I try to connect with my openstack. I'm using jclouds and this is my code:
context = ContextBuilder.newBuilder("openstack-nova")
.endpoint("http://xxx.xxx.xxx.xxx:5000/v2.0/")
.credentials("tenantname:username", "password")
.modules(ImmutableSet.<Module> of(new SLF4JLoggingModule(), new SshjSshClientModule()))
.buildView(ComputeServiceContext.class);
service = context.getComputeService();
for(ComputeMetadata node: service.listNodes()) {
System.out.println("NODE: " + node.getId());
}
But always it return the following error:
DEBUG [org.jclouds.rest.internal.InvokeHttpMethod] [main] >> invoking AuthenticationApi.authenticateWithTenantNameAndCredentials
DEBUG [org.jclouds.http.internal.JavaUrlHttpCommandExecutorService] [main] Sending request -1502473400: POST http://xxx.xxx.xxx.xxx:5000/v2.0/tokens HTTP/1.1
ERROR [org.jclouds.http.internal.JavaUrlHttpCommandExecutorService] [main] Command not considered safe to retry because request method is POST: [method=org.jclouds.openstack.keystone.v2_0.AuthenticationApi.public abstract org.jclouds.openstack.keystone.v2_0.domain.Access org.jclouds.openstack.keystone.v2_0.AuthenticationApi.authenticateWithTenantNameAndCredentials(java.lang.String,org.jclouds.openstack.keystone.v2_0.domain.PasswordCredentials)[tenantname, PasswordCredentials{username=username, password=*****}], request=POST http://xxx.xxx.xxx.xxx:5000/v2.0/tokens HTTP/1.1]
I'm developing in eclipse and Intellij IDEA. I've been reviewing the proxy configuration, but everything is normal.
Please, can anyone help me?
Thanks!
The code looks good, but if you need to go through a proxy you may need to configure the proxy properties in jclouds. Something like the following, with the right values for your proxy:
Properties overrides = new Properties();
overrides.setProperty(Constants.PROPERTY_PROXY_HOST, "localhost");
overrides.setProperty(Constants.PROPERTY_PROXY_PORT, "8888");
You can pass the properties to the overrides method of the ContextBuilder.
You can also enable the jclouds.wire logs to see every request and response that are being sent. This will show the exact network error or the one returned by your OpenStack installation. Have a look at: http://jclouds.apache.org/reference/logging/
Related
I am getting below exception
org.springframework.amqp.AmqpAuthenticationException: com.rabbitmq.client.AuthenticationFailureException: ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile.
Configuration: RabbitMQ 3.3.5 on windows
On Config file in %APPDATA%\RabbitMQ\rabbit.config
I have done below change as per https://www.rabbitmq.com/access-control.html
[{rabbit, [{loopback_users, []}]}].
I also tried creating a user/pwd - test/test doesn't seem to make it work.
Tried the Steps from this post.
Other Configuration Details are as below:
Tomcat hosted Spring Application Context:
<!-- Rabbit MQ configuration Start -->
<!-- Connection Factory -->
<rabbit:connection-factory id="rabbitConnFactory" virtual-host="/" username="guest" password="guest" port="5672"/>
<!-- Spring AMQP Template -->
<rabbit:template id="rabbitTemplate" connection-factory="rabbitConnFactory" routing-key="ecl.down.queue" queue="ecl.down.queue" />
<!-- Spring AMQP Admin -->
<rabbit:admin id="admin" connection-factory="rabbitConnFactory"/>
<rabbit:queue id="ecl.down.queue" name="ecl.down.queue" />
<rabbit:direct-exchange name="ecl.down.exchange">
<rabbit:bindings>
<rabbit:binding key="ecl.down.key" queue="ecl.down.queue"/>
</rabbit:bindings>
</rabbit:direct-exchange>
In my Controller Class
#Autowired
RmqMessageSender rmqMessageSender;
//Inside a method
rmqMessageSender.submitToECLDown(orderInSession.getOrderNo());
In My Message sender:
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
#Component("messageSender")
public class RmqMessageSender {
#Autowired
AmqpTemplate rabbitTemplate;
public void submitToRMQ(String orderId){
try{
rabbitTemplate.convertAndSend("Hello World");
} catch (Exception e){
LOGGER.error(e.getMessage());
}
}
}
Above exception Block gives below Exception
org.springframework.amqp.AmqpAuthenticationException: com.rabbitmq.client.AuthenticationFailureException: ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile.
Error Log
=ERROR REPORT==== 7-Nov-2014::18:04:37 ===
closing AMQP connection <0.489.0> (10.1.XX.2XX:52298 -> 10.1.XX.2XX:5672):
{handshake_error,starting,0,
{amqp_error,access_refused,
"PLAIN login refused: user 'guest' can only connect via localhost",
'connection.start_ok'}}
Pls find below the pom.xml entry
<dependency>
<groupId>org.springframework.amqp</groupId>
<artifactId>spring-rabbit</artifactId>
<version>1.3.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-amqp</artifactId>
<version>4.0.4.RELEASE</version>
</dependency>
Please let me know if you have any thoughts/suggestions
I am sure what Artem Bilan has explained here might be one of the reasons for this error:
Caused by: com.rabbitmq.client.AuthenticationFailureException:
ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN.
For details see the
but the solution for me was that I logged in to rabbitMQ admin page (http://localhost:15672/#/users) with the default user name and password which is guest/guest then added a new user and for that new user I enabled the permission to access it from virtual host and then used the new user name and password instead of default guest and that cleared the error.
To complete #cpu-100 answer,
in case you don't want to enable/use web interface, you can create a new credentials using command line like below and use it in your code to connect to RabbitMQ.
$ rabbitmqctl add_user YOUR_USERNAME YOUR_PASSWORD
$ rabbitmqctl set_user_tags YOUR_USERNAME administrator
$ rabbitmqctl set_permissions -p / YOUR_USERNAME ".*" ".*" ".*"
user 'guest' can only connect via localhost
That's true since RabbitMQ 3.3.x. Hence you should upgrade to the same version the client library, or just upgrade Spring AMQP to the latest version (if you use dependency managent system).
Previous version of client used 127.0.0.1 as default value for the host option of ConnectionFactory.
The error
ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile.
can occur if the credentials that your application is trying to use to connect to RabbitMQ are incorrect or missing.
I had this happen when the RabbitMQ credentials stored in my ASP.NET application's web.config file had a value of "" for the password instead of the actual password string value.
To allow guest access remotely, write this
[{rabbit, [{loopback_users, []}]}].
to here
c:\Users\[your user name]\AppData\Roaming\RabbitMQ\rabbitmq.config
then restart the rabbitmq windows service (Source https://www.rabbitmq.com/access-control.html)
On localhost , By default use 'amqp://guest:guest#localhost:5672'
So on a remote or hosted RabbitMQ. Let's say you have the following credentials
username: niceboy
password: notnice
host: goxha.com
port : 1597
then the uri you should pass will be
amqp://niceboy:notnice#goxha.com:1597
following the template amqp://user:pass#host:10000
if you have a vhost you can do amqp://user:pass#host:10000/vhost where the trailing vhost will be the name of your vhost
New solution:
The node module can't handle : in a password properly. Even url encoded, like it would work normally, it does not work.
Don't use typicalspecial characters from an URL in the password!
Like one of the following: : . ? + %
Original, wrong answer:
The error message clearly complains about using PLAIN, it does not mean the crendentials are wrong, it means you must use encrypted data delivery (TLS) instead of plaintext.
Changing amqp:// in the connection string to amqps:// (note the s) solves this.
just add login password to connect to RabbitMq
CachingConnectionFactory connectionFactory =
new CachingConnectionFactory("rabbit_host");
connectionFactory.setUsername("login");
connectionFactory.setPassword("password");
For me the solution was simple: the user name is case sensitive. Failing to use the correct caps will also lead to the error.
if you use the number as your password, maybe you should try to change your password using string.
I can login using deltaqin:000000 on the website, but had this while running the program. then change the password to deltaiqn. and it works.
I made exactly what #grepit made.
But I had to made some changes in my Java code:
In Producer and Receiver project I altered:
ConnectionFactory factory = new ConnectionFactory();
factory.setHost("your-host-ip");
factory.setUsername("username-you-created");
factory.setPassword("username-password");
Doing that, you are connecting an specific host as the user you have created.
It works for me!
In my case I had this error, cuz of wrongly set password (I tried to use 5672, when the actual one in my system was 5676).
Maybe this will help someone to double check ports...
I was facing this issue due to empty space at the end of the password(spring.rabbitmq.password=rabbit ) in spring boot application.properties got resolved on removing the empty space. Hope this checklist helps some one facing this issue.
For C# coder, I tried below code and It worked, may be this can help someone so posting here.
scenario- RabbitMQ queue is running on another system in local area network but I was having same error.
by default there is a "guest" user exists. but you can not access remote server's queue (rabbitMq) using "guest" user so you need to create new user, Here I created "tester001" user to access data of remote server's queue.
ConnectionFactory factory = new ConnectionFactory();
factory.UserName = "tester001";
factory.Password = "testing";
factory.VirtualHost = "/";
factory.HostName = "192.168.1.101";
factory.Port = AmqpTcpEndpoint.UseDefaultPort;
If you tried all of these answers for your issue but you still got "ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN", maybe you should remove rabbitmq and install it with a newer version.
Newer version worked for me.
Add one user and pass and connect to them. You can add 1 user via env variables (e.g., useful when Rabbit initializes in a Docker): RABBITMQ_DEFAULT_USER and RABBITMQ_DEFAULT_PASS. See more details here:
https://stackoverflow.com/a/70676040/1200914
set ConnectionFactory or Connection hostname to localhost
I have a Hyperledger Fabric V1.0 network setup using Build Your First Network.
I have made the network up by running the command ./byfn.sh -m up.
Now all the Peers, Orderers and CAs(configured in docker-compose-e2e.yaml) are up and running.
This is my docker ps
And I am trying to connect to this network using fabric-sdk-java.
But when doing user registration using the following code
HFCAClient ca = sampleOrg.getCAClient();
final String orgName = sampleOrg.getName();
final String mspid = sampleOrg.getMSPID();
ca.setCryptoSuite(CryptoSuite.Factory.getCryptoSuite());
SampleUser admin = sampleStore.getMember("ädmin", orgName);
if (!admin.isEnrolled()) { //Preregistered admin only needs to be enrolled with Fabric caClient.
admin.setEnrollment(ca.enroll(admin.getName(), "adminpw"));
admin.setMspId(mspid);
}
sampleOrg.setAdmin(admin); // The admin of this org --
SampleUser user = sampleStore.getMember("user", sampleOrg.getName());
if (!user.isRegistered()) { // users need to be registered AND enrolled
RegistrationRequest rr = new RegistrationRequest(user.getName(), "org1.department1");
user.setEnrollmentSecret(ca.register(rr, admin// here comes the error
}
I am getting the error
2017-08-29 07:44:01,132 main ERROR HFCAClient:237 - com.test.blockchain.client.test.SampleUser#73846619
org.hyperledger.fabric_ca.sdk.exception.RegistrationException: Error while registering the user com.test.blockchain.client.test.SampleUser#73846619 url: https://192.168.99.100:7054 POST request to https://192.168.99.100:7054/api/v1/register failed request body {"id":"user1","type":"user","max_enrollments":0,"affiliation":"org1.department1","attrs":[]} with status code: 500. Response: {"success":false,"result":null,"errors":[{"code":0,"message":"Failed getting affiliation 'org1.department1': sql: no rows in result set"}],"messages":[]}
at org.hyperledger.fabric_ca.sdk.HFCAClient.register(HFCAClient.java:236)
at com.test.blockchain.client.test.Test.setup(Test.java:164)
at com.test.blockchain.client.test.Test.main(Test.java:982)
Caused by: java.lang.Exception: POST request to https://192.168.99.100:7054/api/v1/register failed request body {"id":"user1","type":"user","max_enrollments":0,"affiliation":"org1.department1","attrs":[]} with status code: 500. Response: {"success":false,"result":null,"errors":[{"code":0,"message":"Failed getting affiliation 'org1.department1': sql: no rows in result set"}],"messages":[]}
at org.hyperledger.fabric_ca.sdk.HFCAClient.httpPost(HFCAClient.java:609)
at org.hyperledger.fabric_ca.sdk.HFCAClient.register(HFCAClient.java:227)
... 2 more
I am referring the codes shown in the unit test class End2endIT.java
Someone please share your knowledge to find out where I am doing wrong.
Also I am not sure where it is configuring "affiliation":"org1.department1". Do I need to add anything in my .yaml file?
These are the affiliation which are bootstrapped for the any CA containers
> affiliations:
> org1:
> - department1
> - department2
> org2:
> - department1
But there function though which you can add New affiliation based on your organization
await caClient.newAffiliationService().create({ "name": "AFFILIATION_NAME }, adminObj)
You configure the affiliation when you create the crypto material. In your case when you generate the ./byfn.sh -m up command. You have created your keys (your certificates) when you executed the ./byfn.sh -m up, so you don't need to call the CA to register any user.
Also, your error code is the 500, so the cause of your error should be other. Could you try to invoke the chaincode?
Have you changed something in the crypto-config.yaml file? And in the docker-compose-e2e.yaml file?
I'm not sure about the error you are getting for org1.department1. But even I had faced this similar issue while creating new org3. I was getting error Failed getting affiliation 'org3.department1': : scode: 404, code: 63, msg: Failed to get Affiliation: sql: no rows in result set.
To answer where the setting of the Affiliation happens.
It is bootstrapped, which is defined the file /etc/hyperledger/fabric-ca-server/fabric-ca-client-config.yaml of CA Docker container
affiliations:
org1:
- department1
- department2
org2:
- department1
Link to the file : http://hyperledger-fabric-ca.readthedocs.io/en/latest/serverconfig.html
In line:
SampleUser admin = sampleStore.getMember("ädmin", orgName);
you may have to replace the ä in "ädmin".
I'm trying to send a mail using javax.mail. This is my code:
Properties props = new Properties();
props.setProperty("mail.smtp.host", host);
props.setProperty("mail.smtp.port", port);
props.setProperty("mail.user", user);
props.setProperty("mail.password", password);
Session session = Session.getDefaultInstance(props);
But I get this error:
javax.mail.MessagingException: Could not connect to SMTP host: smtp.wrong.server.com, port: 25;
The funny thing is that "smtp.wrong.server.com" isn't the value that I'm passing as host.
It is like Session.getDefaultInstance(props) is returning an already created session with the wrong host name.
There isn't any other place inside my EAR where javax.mail is used (at least not in my code, maybe inside a third party dependecy?).
This behaviour only happens, of course, in PRO environment. The same EAR deployed in DEV and TEST env works fine.
Any help would be appreciated
The problem was with Session.getDefaultInstance. I should use Session.getInstance
From javadoc:
getDefaultInstance
(...)the default session is potentially available to all code executing in the same Java virtual machine(...)Subsequent calls return the Session object that was created by the first call, and ignore the passed Properties object. Use the getInstance method to get a new Session object every time the method is called.
It seams your are not using the correct key for your proerties. see Javadoc for javax.mail.Session
It is expected that the client supplies values for the properties
listed in Appendix A of the JavaMail spec (particularly
mail.store.protocol, mail.transport.protocol, mail.host, mail.user,
and mail.from) as the defaults are unlikely to work in all cases.
I developing something with QuickFixJ and I meet a strange situation. We have a stub to simulate the fix acceptor, locally on my environment is working I can send/receive messages we use a custom message type the quickfixj jar is regenerated based on new dictionary, new message types...
Example message from my env. communication between the FIX initiator and FIX_STUB(acceptor) :
16:49:58.475 [http-8080-4] INFO quickfixj.msg.outgoing - FIXT.1.1:FIX->FIX_STUB: 8=FIXT.1.1|9=267|35=RQS|34=3|49=FIX|52=20160628-13:49:58.474|56=FIX_STUB|20000=1|20001={json string}|20002=1.0|10=171|
<20160628-13:49:58, FIXT.1.1:FIX_STUB->FIX, incoming> (8=FIXT.1.1|9=267|35=RQS|34=3|49=FIX|52=20160628-13:49:58.474|56=FIX_STUB|20000=1|20001={json string}|20002=1.0|10=171|)
16:49:58.476 [QFJ Message Processor] INFO c.r.fix.api.stub.FixApplication - FIX STUB MESSAGE TYPE:quickfix.fix50sp2.Request
<20160628-13:49:58, FIXT.1.1:FIX_STUB->FIX, outgoing> (8=FIXT.1.1|9=308|35=RSP|34=3|49=FIX_STUB|52=20160628-13:49:58.527|56=FIX|20000=1|20001={json string}||20002=1.0|10=240|)
16:49:58.528 [NioProcessor-2] INFO quickfixj.msg.incoming - FIXT.1.1:FIX->FIX_STUB: 8=FIXT.1.1|9=308|35=RSP|34=3|49=FIX_STUB|52=20160628-13:49:58.527|56=FIX|20000=1|20001={json string}||20002=1.0|10=240|
16:49:58.529 [QFJ Message Processor] INFO c....fix.engine.FixEngineImpl - FIX MESSAGE TYPE:quickfix.fix50sp2.Response
on Tomcat is working but when we try to use the exactly same code in a test environment and deploy to a Websphere server I get this error:
2016-06-28 11:17:44,196 appl="rtv" env="SYS" version="3.8.12" loglevel="INFO " message="FIXT.1.1:FIX->FIX_STUB: 8=FIXT.1.19=26735=RQS34=249=FIX52=20160628-09:17:44.19656=FIX_STUB20000=120001={json string}20002=1.010=147" thread="WebContainer : 1" logger="quickfixj.msg.outgoing"
2016-06-28 11:17:44,198 appl="rtv" env="SYS" version="3.8.12" loglevel="INFO " message="FIX STUB MESSAGE TYPE:quickfix.fix50sp2.Message" thread="QFJ Message Processor" logger="c.r.fix.api.stub.FixApplication"
2016-06-28 11:17:44,202 appl="rtv" env="SYS" version="3.8.12" loglevel="ERROR" message="FIX STUB MESSAGE CRACK FAILED" thread="QFJ Message Processor" logger="c.r.fix.api.stub.FixApplication"
quickfix.UnsupportedMessageType: null
at quickfix.fix50sp2.MessageCracker.onMessage(MessageCracker.java:39) ~[quickfixj-messages-all-1.6.2.jar:1.6.2]
at quickfix.fix50sp2.MessageCracker.crack50(MessageCracker.java:1787) ~[quickfixj-messages-all-1.6.2.jar:1.6.2]
at quickfix.fix50sp2.MessageCracker.crack(MessageCracker.java:1555) ~[quickfixj-messages-all-1.6.2.jar:1.6.2]
at com....fix.api.stub.FixApplication.fromApp(FixApplication.java:97) ~[rita-web-3.8.jar:na]
As you can see in the example the type(message sub class) it's handled correctly (quickfix.fix50sp2.Request,quickfix.fix50sp2.Response ) but on Websphere is NOT (quickfix.fix50sp2.Message). MessageCracker is used.
Can you help me to fix this issue, to find out why this is happening is related to OS, web server or some FIX configuration?
I fixed the issue... it was related to classloader and duplicate classes. The way that I got the jar files contained also the default messages(maven dependencies ...) on Tomcat the application pick up the right classes while the WebSphere took the default one this is why the application MessageCracker didn't handled properly the messages.
Hello guys i have such issue i make all thing like tutorial says. So now i want to lookup my Topics and connection factories that i configured but it do not see them. i make something like :
try {
Properties propertiesAMQ = new Properties();
propertiesAMQ.load(new FileInputStream("AMQ.properties"));
logger.info("Property file loaded succesfully...");
propertiesAMQ.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.activemq.jndi.ActiveMQInitialContextFactory");
propertiesAMQ.setProperty(Context.PROVIDER_URL,
"tcp://localhost:61616");
Context ctx = new InitialContext(propertiesAMQ);
javax.jms.TopicConnectionFactory factory = (javax.jms.TopicConnectionFactory) ctx
.lookup("amqpool");
javax.jms.Topic mytopic = (javax.jms.Topic) ctx.lookup("amqmsg")
}
And recieve NameNotFoundException. If i use name of connection factory such as "ConnectionFactory" it will be ok but then it will not see my Topic What i did wrong? Have u other examples of this subject? I'm using glassfish 3.0.1 and AMQ 5.5.0
Probably you are missing the namespace, you can look the exact name in the glassfish console, but most probably it should be;
javax.jms.Topic mytopic = (javax.jms.Topic) ctx.lookup("java:amqmsg")
How do you create your Topic resource? I had a similar problem and the solution was to create the Admin Resource Object using Glassfish command-line tool 'asadmin'. Creating it using the Glassfish admin console did not work (causing NameNotFoundException).
I ended up creating my Queu resource with the following command: 'create-admin-object –restype javax.jms.Queue –raname activemq-rar-5.7.0 –property PhysicalName=queueName queueName'