DeploymentManagerCreationException - java

When I run the following code in command window
java weblogic.Deployer -adminurl localhost:7001 -user weblogic -password weblogic -start -name myTestDeployment"
I am getting the following error:
javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException at
weblogic.deploy.api.spi.deploy.WebLogicDeploymentManagerImpl.<init>(W
ebLogicDeploymentManagerImpl.java:121) at
weblogic.deploy.api.spi.factories.internal.DeploymentFactoryImpl.getD
eploymentManager(DeploymentFactoryImpl.java:84) at
weblogic.deploy.api.tools.SessionHelper.getDeploymentManager(SessionH elper.java:432) at
weblogic.deploy.api.tools.deployer.Jsr88Operation.connect(Jsr88Operat ion.java:304) at
weblogic.deploy.api.tools.deployer.Deployer.perform(Deployer.java:137 ) at
weblogic.deploy.api.tools.deployer.Deployer.runBody(Deployer.java:88) at
weblogic.utils.compiler.Tool.run(Tool.java:158) at
weblogic.utils.compiler.Tool.run(Tool.java:115) at
weblogic.Deployer.run(Deployer.java:70) at weblogic.Deployer.main(Deployer.java:54)
Caused by: weblogic.deploy.api.spi.exceptions.ServerConnectionException at
weblogic.deploy.api.spi.deploy.internal.ServerConnectionImpl.init(Ser
verConnectionImpl.java:143) at
weblogic.deploy.api.spi.deploy.WebLogicDeploymentManagerImpl.getNewCo
nnection(WebLogicDeploymentManagerImpl.java:148) at
weblogic.deploy.api.spi.deploy.WebLogicDeploymentManagerImpl.<init>(W
ebLogicDeploymentManagerImpl.java:118) ... 9 more Caused by:
javax.naming.CommunicationException [Root exception is java.net.Conne ctException:
localhost:7001: Destination unreachable; nested exception is : java.net.ConnectException:
Connection refused: connect; No available rou ter to destination] at
weblogic.jndi.internal.ExceptionTranslator.toNamingException(Exceptio nTranslator.java:40)
at weblogic.jndi.WLInitialContextFactoryDelegate.toNamingException(WLIni
tialContextFactoryDelegate.java:773) at
weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLIni
tialContextFactoryDelegate.java:363) at
weblogic.jndi.Environment.getContext(Environment.java:307) at
weblogic.jndi.Environment.getContext(Environment.java:277) at
weblogic.jndi.Environment.createInitialContext(Environment.java:200) at
weblogic.jndi.Environment.getInitialContext(Environment.java:184) at
weblogic.jndi.Environment.getInitialContext(Environment.java:162) at
weblogic.deploy.api.spi.deploy.internal.ServerConnectionImpl.getConte
xt(ServerConnectionImpl.java:330) at
weblogic.deploy.api.spi.deploy.internal.ServerConnectionImpl.getEnvir
onment(ServerConnectionImpl.java:302) at
weblogic.deploy.api.spi.deploy.internal.ServerConnectionImpl.init(Ser
verConnectionImpl.java:141) ... 11 more Caused by: java.net.ConnectException:
localhost:7001: Destination unreach able; nested exception is: java.net.ConnectException:
Connection refused: connect; No available rou ter to destination at
weblogic.rjvm.RJVMFinder.findOrCreate(RJVMFinder.java:204) at
weblogic.rjvm.ServerURL.findOrCreateRJVM(ServerURL.java:154) at
weblogic.jndi.WLInitialContextFactoryDelegate$1.run(WLInitialContextF
actoryDelegate.java:342) at
weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate dSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(Unknown Source) at
weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLIni
tialContextFactoryDelegate.java:337) ... 19 more Caused by: java.rmi.ConnectException:
Destination unreachable; nested exception is: java.net.ConnectException: Connection
refused: connect; No available rou ter to destination at
weblogic.rjvm.ConnectionManager.bootstrap(ConnectionManager.java:472) at
weblogic.rjvm.ConnectionManager.bootstrap(ConnectionManager.java:323) at
weblogic.rjvm.RJVMManager.findOrCreateRemoteInternal(RJVMManager.java :263) at
weblogic.rjvm.RJVMManager.findOrCreate(RJVMManager.java:206) at
weblogic.rjvm.RJVMFinder.findOrCreateRemoteServer(RJVMFinder.java:226 ) at
weblogic.rjvm.RJVMFinder.findOrCreateRemoteCluster(RJVMFinder.java:30 8) at
weblogic.rjvm.RJVMFinder.findOrCreate(RJVMFinder.java:194) ... 24 more Unable to connect
to 'localhost:7001': Destination unreachable; nested ex ception is:
java.net.ConnectException: Connection refused: connect; No available rou ter to
destination. Ensure the url represents a running admin server and that th e credentials
are correct. If using http protocol, tunneling must be enabled on the admin server.
Please help me to solve this problem.

Check if the admin server is running on this server port 7001:
javax.naming.CommunicationException [Root exception is java.net.Conne ctException:
localhost:7001: Destination unreachable; nested exception is : java.net.ConnectException:
Connection refused: connect; No available rou ter to destination]

Related

How to connect to Oracle Database with JDBC [duplicate]

This question already has answers here:
java.net.ConnectException: Connection refused
(19 answers)
Closed 1 year ago.
I'm using Eclipse to connect to a remote database with the following details:
name: MSbdd**
Hostname 155.158.xxx.xx
Port: 1521
SID: olt*****
And the authentication type: Default
username: msbd**
password: haslo****
This is the code I have in Eclipse:
package net.codejava;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class JavaOracleTest {
public static void main(String[] args) {
String dbURL = "jdbc:oracle:thin:#localhost:1521:xe";
String username = "msbd**";
String password = "haslo****";
try {
Connection connection = DriverManager.getConnection(dbURL, username, password);
System.out.println("Połączono z serwerem Oracle");
} catch (SQLException e) {
System.out.println("Error");
e.printStackTrace();
}
}
}
And this is the error I get:
java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection (CONNECTION_ID=yV+3U5v4TK2js7gMFTixxA==)
Error
at oracle.jdbc.driver.T4CConnection.handleLogonNetException(T4CConnection.java:882)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:687)
at oracle.jdbc.driver.PhysicalConnection.connect(PhysicalConnection.java:1086)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:90)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:728)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:649)
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:677)
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:228)
at net.codejava.JavaOracleTest.main(JavaOracleTest.java:15)
Caused by: oracle.net.ns.NetException: The Network Adapter could not establish the connection (CONNECTION_ID=yV+3U5v4TK2js7gMFTixxA==)
at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:677)
at oracle.net.resolver.AddrResolution.resolveAndExecute(AddrResolution.java:568)
at oracle.net.ns.NSProtocol.establishConnection(NSProtocol.java:953)
at oracle.net.ns.NSProtocol.connect(NSProtocol.java:350)
at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:2155)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:652)
... 7 more
Caused by: java.io.IOException: Connection refused: connect, socket connect lapse 2003 ms. localhost 1521 0 (2/2) true
at oracle.net.nt.TcpNTAdapter.establishSocket(TcpNTAdapter.java:421)
at oracle.net.nt.TcpNTAdapter.doLocalDNSLookupConnect(TcpNTAdapter.java:303)
at oracle.net.nt.TcpNTAdapter.connect(TcpNTAdapter.java:265)
at oracle.net.nt.ConnOption.connect(ConnOption.java:238)
at oracle.net.nt.ConnStrategy.executeConnOption(ConnStrategy.java:902)
at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:638)
... 12 more
Caused by: java.net.ConnectException: Connection refused: connect
at java.base/sun.nio.ch.Net.connect0(Native Method)
at java.base/sun.nio.ch.Net.connect(Net.java:482)
at java.base/sun.nio.ch.Net.connect(Net.java:474)
at java.base/sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:694)
at java.base/java.nio.channels.SocketChannel.open(SocketChannel.java:194)
at oracle.net.nt.TimeoutSocketChannel.connect(TimeoutSocketChannel.java:184)
at oracle.net.nt.TimeoutSocketChannel.<init>(TimeoutSocketChannel.java:158)
at oracle.net.nt.TcpNTAdapter.establishSocket(TcpNTAdapter.java:380)
... 17 more
I've replaced some details with * because it's a database from school.
Your error is:
Caused by: java.net.ConnectException: Connection refused: connect
Check that you have:
The correct hostname.
For example, you say that the hostname is 155.158.xxx.xx but you are using:
String dbURL = "jdbc:oracle:thin:#localhost:1521:xe";
Should it be:
String dbURL = "jdbc:oracle:thin:#155.158.xxx.xx:1521:xe";
the correct port.
the correct SID.
For example, should it be:
String dbURL = "jdbc:oracle:thin:#155.158.xxx.xx:1521:olt*****";
the correct username and password.
access to the database.
I.e. you are running it on a network that can access the server and not from a network that cannot access the server (your school may require you to be directly connected to or logged in to their network to access the server and may refuse connections from unauthenticated users outside their network).

Connection refused when trying to use rest over https

I'm having trouble trying to use https rest on my remote server. I have a remote server deployed using jelastic that is working in https. Im going to host another server in jelastic that would act as the client.But when I try to run this code:
String result;
Client client = ClientBuilder.newClient();
WebTarget target = client
.target("https://myresturi/Test");
Invocation invocation = target.request().buildGet();
Response response = invocation.invoke();
result = (String) response.readEntity(new GenericType<String>() {});
I get :
Caused by: javax.ws.rs.ProcessingException: RESTEASY004655: Unable to invoke request: org.apache.http.conn.HttpHostConnectException: Connect to mysecreturi:443 [mysecreturi/10.1.4.83] failed: Connection refused (Connection refused)
at org.jboss.resteasy.resteasy-jaxrs#3.13.2.Final//org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine.invoke(ApacheHttpClient4Engine.java:328)
at org.jboss.resteasy.resteasy-jaxrs#3.13.2.Final//org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.invoke(ClientInvocation.java:443)
at org.jboss.resteasy.resteasy-jaxrs#3.13.2.Final//org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.invoke(ClientInvocation.java:63)
at deployment.ROOT.ear.socio-logistico-web.war//laboratorio.tse.AutenticacionBean.autenticar(AutenticacionBean.java:36)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at javax.el.api#2.0.0.Final//javax.el.ELUtil.invokeMethod(ELUtil.java:245)
at javax.el.api#2.0.0.Final//javax.el.BeanELResolver.invoke(BeanELResolver.java:338)
at javax.el.api#2.0.0.Final//javax.el.CompositeELResolver.invoke(CompositeELResolver.java:198)
at org.glassfish.jakarta.el#3.0.3.jbossorg-2//com.sun.el.parser.AstValue.getValue(AstValue.java:110)
at org.glassfish.jakarta.el#3.0.3.jbossorg-2//com.sun.el.parser.AstValue.getValue(AstValue.java:177)
at org.glassfish.jakarta.el#3.0.3.jbossorg-2//com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:183)
at org.jboss.weld.core#3.1.5.Final//org.jboss.weld.module.web.el.WeldValueExpression.getValue(WeldValueExpression.java:50)
at org.jboss.weld.core#3.1.5.Final//org.jboss.weld.module.web.el.WeldValueExpression.getValue(WeldValueExpression.java:50)
at com.sun.jsf-impl#2.3.14.SP01//com.sun.faces.facelets.el.ELText$ELTextVariable.toString(ELText.java:205)
at com.sun.jsf-impl#2.3.14.SP01//com.sun.faces.facelets.el.ELText$ELTextComposite.toString(ELText.java:131)
at com.sun.jsf-impl#2.3.14.SP01//com.sun.faces.facelets.compiler.CommentInstruction.write(CommentInstruction.java:36)
at com.sun.jsf-impl#2.3.14.SP01//com.sun.faces.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:41)
at com.sun.jsf-impl#2.3.14.SP01//com.sun.faces.facelets.compiler.UILeaf.encodeAll(UILeaf.java:169)
at javax.faces.api#3.0.0.SP04//javax.faces.component.UIComponent.encodeAll(UIComponent.java:1650)
at com.sun.jsf-impl#2.3.14.SP01//com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:468)
at com.sun.jsf-impl#2.3.14.SP01//com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:170)
at javax.faces.api#3.0.0.SP04//javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:132)
at javax.faces.api#3.0.0.SP04//javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:132)
at com.sun.jsf-impl#2.3.14.SP01//com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:102)
at com.sun.jsf-impl#2.3.14.SP01//com.sun.faces.lifecycle.Phase.doPhase(Phase.java:76)
at com.sun.jsf-impl#2.3.14.SP01//com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:199)
at javax.faces.api#3.0.0.SP04//javax.faces.webapp.FacesServlet.executeLifecyle(FacesServlet.java:708)
... 51 more
Caused by: org.apache.http.conn.HttpHostConnectException: Connect to mysecreturi:443 [mysecreturi/10.1.4.83] failed: Connection refused (Connection refused)
at org.apache.httpcomponents.core//org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:156)
at org.apache.httpcomponents.core//org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:376)
at org.apache.httpcomponents.core//org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:393)
at org.apache.httpcomponents.core//org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
at org.apache.httpcomponents.core//org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186)
at org.apache.httpcomponents.core//org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
at org.apache.httpcomponents.core//org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.httpcomponents.core//org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
at org.apache.httpcomponents.core//org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
at org.apache.httpcomponents.core//org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56)
at org.jboss.resteasy.resteasy-jaxrs#3.13.2.Final//org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine.invoke(ApacheHttpClient4Engine.java:323)
... 80 more
Caused by: java.net.ConnectException: Connection refused (Connection refused)
at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399)
at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242)
at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224)
at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.base/java.net.Socket.connect(Socket.java:609)
at java.base/sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:289)
at org.apache.httpcomponents.core//org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:368)
at org.apache.httpcomponents.core//org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142)
What is weird is that if I try to run this code localy in ecliple it works fine, and if I try using https://reqbin.com/ it works fine as well. If I try using http instead of https it works remotely as well

How to configure Connection to RabbitMQ broker

I have been trying to connect to an RabbitMQ when the broker is in a shutdown state. So far I have:
com.rabbitmq.client.ConnectionFactory factory = new
com.rabbitmq.client.ConnectionFactory();
factory.setHost("localhost");
factory.setPort(5672);
factory.setAutomaticRecoveryEnabled(true);
factory.setNetworkRecoveryInterval(100000);
factory.setConnectionTimeout(100000);
factory.setHandshakeTimeout(100000);
return factory.newConnection();
However when factory.newConnection() is executed when the application startup. Here is the stacktrace:
Caused by: java.io.IOException
at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:124)
at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:120)
at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:362)
at com.rabbitmq.client.impl.recovery.RecoveryAwareAMQConnectionFactory.newConnection(RecoveryAwareAMQConnectionFactory.java:63)
at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.init(AutorecoveringConnection.java:99)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:918)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:877)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:835)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:987)
at com.app.RabbitMqConectionFactory.provide(RabbitMqConectionFactory.java:41)
... 75 more
Caused by: com.rabbitmq.client.ShutdownSignalException: connection error
at com.rabbitmq.utility.ValueOrException.getValue(ValueOrException.java:66)
at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:36)
at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:443)
at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:306)
... 82 more
Caused by: java.io.EOFException
at java.io.DataInputStream.readUnsignedByte(DataInputStream.java:290)
at com.rabbitmq.client.impl.Frame.readFrom(Frame.java:91)
at com.rabbitmq.client.impl.SocketFrameHandler.readFrame(SocketFrameHandler.java:164)
at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:580)
at java.lang.Thread.run(Thread.java:745)

Cassandra cluster giving connection refused error when writing from hadoop using CQLOutputformat

I have a single node cassandra cluster which is NOT colocated with my hadoop cluster. I'm using this hadoop cluster to bulk load data into a Cassandra cluster using CqlOutputFormat with following job configuration.
Job job = new Job(conf);
Configuration jobConf = job.getConfiguration();
ConfigHelper.setOutputInitialAddress(jobConf, "10.27.124.73");
ConfigHelper.setInputInitialAddress(jobConf, "10.27.124.73");
//ConfigHelper.setOutputRpcPort(jobConf, "9160"); I tried setting the ports. Doesn't help.
//ConfigHelper.setInputRpcPort(jobConf, "9160");
ConfigHelper.setOutputPartitioner(jobConf,"Murmur3Partitioner");
ConfigHelper.setInputPartitioner(jobConf, "Murmur3Partitioner");
ConfigHelper.setInputColumnFamily(jobConf, "pinspace", "pinseries");
ConfigHelper.setOutputColumnFamily(jobConf, "pinspace", "pinseries");
System.out.println(ConfigHelper.getOutputColumnFamily(jobConf));
String query = "update pinspace.pinseries set timeseries = ?";
CqlConfigHelper.setOutputCql(jobConf, query);
CqlConfigHelper.setInputCQLPageRowSize(jobConf, "3");
job.setInputFormatClass(BoomInputFormat.class);
job.setMapperClass(GrepMapper.class);
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(IntWritable.class);
job.setReducerClass(GrepReducer.class);
job.setNumReduceTasks(1024);
job.setOutputFormatClass(CqlOutputFormat.class);
I get Connection refused error with the following stacktrace:
Error: java.io.IOException: org.apache.thrift.transport.TTransportException: java.net.ConnectException: Connection refused
at org.apache.cassandra.hadoop.cql3.CqlRecordWriter$RangeClient.run(CqlRecordWriter.java:280)
Caused by: org.apache.thrift.transport.TTransportException: java.net.ConnectException: Connection refused
at org.apache.thrift.transport.TSocket.open(TSocket.java:187)
at org.apache.thrift.transport.TFramedTransport.open(TFramedTransport.java:81)
at org.apache.cassandra.thrift.TFramedTransportFactory.openTransport(TFramedTransportFactory.java:41)
at org.apache.cassandra.hadoop.AbstractColumnFamilyOutputFormat.createAuthenticatedClient(AbstractColumnFamilyOutputFormat.java:123)
at org.apache.cassandra.hadoop.cql3.CqlRecordWriter$RangeClient.run(CqlRecordWriter.java:271)
Caused by: java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:579)
at org.apache.thrift.transport.TSocket.open(TSocket.java:182)
... 4 more
I'm using cassandra-driver-core 2.1.5 and cassandra-all 2.1.3.
The server is pingable using the given IP from the datanodes and telnet 10.27.124.73 9160 and telnet 10.27.124.73 9042 works.
EDIT:
I tried setting 9042 port in the code using,
ConfigHelper.setOutputRpcPort(jobConf, "9042");
Then the error changed to:
Error: java.lang.RuntimeException: org.apache.thrift.transport.TTransportException: Read a negative frame size (-2097152000)!
at org.apache.cassandra.hadoop.cql3.CqlRecordWriter.<init>(CqlRecordWriter.java:130)
at org.apache.cassandra.hadoop.cql3.CqlRecordWriter.<init>(CqlRecordWriter.java:88)
at org.apache.cassandra.hadoop.cql3.CqlOutputFormat.getRecordWriter(CqlOutputFormat.java:74)
at org.apache.cassandra.hadoop.cql3.CqlOutputFormat.getRecordWriter(CqlOutputFormat.java:55)
at org.apache.hadoop.mapred.ReduceTask$NewTrackingRecordWriter.<init>(ReduceTask.java:540)
at org.apache.hadoop.mapred.ReduceTask.runNewReducer(ReduceTask.java:614)
at org.apache.hadoop.mapred.ReduceTask.run(ReduceTask.java:389)
at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:167)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:415)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1548)
at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:162)
Caused by: org.apache.thrift.transport.TTransportException: Read a negative frame size (-2097152000)!
at org.apache.thrift.transport.TFramedTransport.readFrame(TFramedTransport.java:133)
at org.apache.thrift.transport.TFramedTransport.read(TFramedTransport.java:101)
at org.apache.thrift.transport.TTransport.readAll(TTransport.java:86)
at org.apache.thrift.protocol.TBinaryProtocol.readAll(TBinaryProtocol.java:429)
at org.apache.thrift.protocol.TBinaryProtocol.readI32(TBinaryProtocol.java:318)
at org.apache.thrift.protocol.TBinaryProtocol.readMessageBegin(TBinaryProtocol.java:219)
at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:69)
at org.apache.cassandra.thrift.Cassandra$Client.recv_set_keyspace(Cassandra.java:608)
at org.apache.cassandra.thrift.Cassandra$Client.set_keyspace(Cassandra.java:595)
at org.apache.cassandra.hadoop.cql3.CqlRecordWriter.<init>(CqlRecordWriter.java:108)
... 11 more

Creating an RMI Connector Client

I am trying to connect to MBean server. I need to write JMX Client application. This is the code used for client application. But I have got an exception related to this
Failed to retrieve RMIServer stub:
javax.naming.ServiceUnavailableException [Root exception is
java.rmi.ConnectException: Connection refused to host: localhost;
nested exception is:
Can somebody help me to fix this.
import java.io.IOException;
import javax.management.MBeanServerConnection;
import javax.management.MBeanServerInvocationHandler;
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
import javax.management.remote.JMXConnector;
import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXServiceURL;
public class SystemConfigClient {
public static final String HOST = "localhost";
public static final String PORT = "1099";
public static void main(String[] args) throws IOException, MalformedObjectNameException {
JMXServiceURL url =new JMXServiceURL("service:jmx:rmi:///jndi/rmi://" + HOST + ":" +PORT+ "/jmxrmi");
JMXConnector jmxConnector = JMXConnectorFactory.connect(url);
MBeanServerConnection mbeanServerConnection = jmxConnector.getMBeanServerConnection();
//ObjectName should be same as your MBean name
ObjectName mbeanName = new ObjectName("ifs.demo1.jmx:type=SystemConfig");
//Get MBean proxy instance that will be used to make calls to registered MBean
SystemConfigMBean mbeanProxy =
(SystemConfigMBean) MBeanServerInvocationHandler.newProxyInstance(
mbeanServerConnection, mbeanName, SystemConfigMBean.class, true);
//let's make some calls to mbean through proxy and see the results.
System.out.println("Current SystemConfig::" + mbeanProxy.doConfig());
mbeanProxy.setSchemaName("NewSchema");
mbeanProxy.setThreadCount(5);
System.out.println("New SystemConfig::" + mbeanProxy.doConfig());
//let's terminate the mbean by making thread count as 0
mbeanProxy.setThreadCount(0);
//close the connection
jmxConnector.close();
}
}
I have run this code with following arguments.
Dcom.sun.management.jmxremote Dcom.sun.management.jmxremote.port=1099
Dcom.sun.management.jmxremote.authenticate=false
Dcom.sun.management.jmxremote.ssl=false
but I got the exception of
Exception in thread "main" java.io.IOException: Failed to retrieve
RMIServer stub: javax.naming.ServiceUnavailableException [Root
exception is java.rmi.ConnectException: Connection refused to host:
localhost; nested exception is: java.net.ConnectException:
Connection refused: connect] at
javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:338)
at
javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:248)
at
javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:207)
at com.demo1.jmx.SystemConfigClient.main(SystemConfigClient.java:29)
Caused by: javax.naming.ServiceUnavailableException [Root exception is
java.rmi.ConnectException: Connection refused to host: localhost;
nested exception is: java.net.ConnectException: Connection refused:
connect] at
com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:101)
at
com.sun.jndi.toolkit.url.GenericURLContext.lookup(GenericURLContext.java:185)
at javax.naming.InitialContext.lookup(InitialContext.java:392) at
javax.management.remote.rmi.RMIConnector.findRMIServerJNDI(RMIConnector.java:1886)
at
javax.management.remote.rmi.RMIConnector.findRMIServer(RMIConnector.java:1856)
at
javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:257)
... 3 more Caused by: java.rmi.ConnectException: Connection refused
to host: localhost; nested exception is: java.net.ConnectException:
Connection refused: connect at
sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:601) at
sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:198)
at
sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:184)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:322) at
sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source) at
com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:97)
... 8 more Caused by: java.net.ConnectException: Connection refused:
connect at java.net.PlainSocketImpl.socketConnect(Native Method) at
java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333) at
java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182) at
java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366) at
java.net.Socket.connect(Socket.java:529) at
java.net.Socket.connect(Socket.java:478) at
java.net.Socket.(Socket.java:375) at
java.net.Socket.(Socket.java:189) at
sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
at
sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:595)
... 13 more Java Result: 1
Have you noticed that you are using the VM arguments with "D" and not "-D"? Or is it just a typo?
The correct would be:
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=1099
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false

Categories