Java Firebase Admin SDK connect behind proxy - java

I am new in firebase development, I'am trying to save a data to realtime database, but it always throw an error when I connected behind my company proxy, I already tried this approach but still no luck,
here my stack trace :
4517 [firebase-websocket-worker] ERROR
com.google.firebase.database.connection.WebsocketConnection - [ws_1]
WebSocket error
io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection
refused: no further information: testing-
5786c.firebaseio.com/35.201.97.85:443
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(Unknown Source)
at io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:325)
at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:340)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:633)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:580)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:497)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:459)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:886)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.net.ConnectException: Connection refused: no further information
... 16 more
any suggestion?

Related

IBM DB2 Connection error with autoReconnect

I am using db2jcc4.jar version 4.19.26 and JDBC4 .
When I am adding autoReconnect=true in the connection URL ,
<datasource jta="true" jndi-name="java:/jdbc/Name" pool-name="Name" enabled="true" use-ccm="false">
<connection-url>jdbc:db2://host:port/db?autoReconnect=true</connection-url>
<driver-class>com.ibm.db2.jcc.DB2Driver</driver-class>
<driver>db2jcc4.jar</driver> ....
I am getting the following error :
Caused by: javax.resource.ResourceException: Could not create connection
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createLocalManagedConnection(LocalManagedConnectionFactory.java:347)
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:354)
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:288)
at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.createConnectionEventListener(SemaphoreArrayListManagedConnectionPool.java:1166)
at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.getConnection(SemaphoreArrayListManagedConnectionPool.java:446)
at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getTransactionNewConnection(AbstractPool.java:541)
at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getConnection(AbstractPool.java:442)
at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:379)
... 129 more
Caused by: com.ibm.db2.jcc.am.DisconnectNonTransientException: [jcc][t4][2034][11148][4.19.26] Execution failed due to a distribution protocol error that caused deallocation of the conversation.
A DRDA Data Stream Syntax Error was detected. Reason: 0x2110. ERRORCODE=-4499, SQLSTATE=58009
at com.ibm.db2.jcc.am.kd.a(Unknown Source)
at com.ibm.db2.jcc.am.kd.a(Unknown Source)
at com.ibm.db2.jcc.t4.y.j(Unknown Source)
at com.ibm.db2.jcc.t4.z.bb(Unknown Source)
at com.ibm.db2.jcc.t4.z.y(Unknown Source)
at com.ibm.db2.jcc.t4.z.T(Unknown Source)
at com.ibm.db2.jcc.t4.z.i(Unknown Source)
at com.ibm.db2.jcc.t4.z.a(Unknown Source)
at com.ibm.db2.jcc.t4.b.c(Unknown Source)
at com.ibm.db2.jcc.t4.b.b(Unknown Source)
at com.ibm.db2.jcc.t4.b.b(Unknown Source)
at com.ibm.db2.jcc.t4.b.a(Unknown Source)
at com.ibm.db2.jcc.t4.b.a(Unknown Source)
at com.ibm.db2.jcc.t4.b.a(Unknown Source)
at com.ibm.db2.jcc.t4.b.<init>(Unknown Source)
at com.ibm.db2.jcc.DB2SimpleDataSource.getConnection(Unknown Source)
at com.ibm.db2.jcc.DB2SimpleDataSource.getConnection(Unknown Source)
at com.ibm.db2.jcc.DB2Driver.connect(Unknown Source)
at com.ibm.db2.jcc.DB2Driver.connect(Unknown Source)
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createLocalManagedConnection(LocalManagedConnectionFactory.java:322)
... 136 more
IBM documentation shows that the resolution to this issue is to use a different version of the JCC jar, hope that this works out for you. You could've at least added what version of DB you are using in the question. Please check this solution if it works for your situation!
The solution suggested in this documentation is to:
Use JCC driver version 4.11.77 and above or upgrade to DB2 V9.5 FP7 or DB2 V9.7 FP3a and above.

Not able to connect to MSSQL using Schemacrawler

I have installed Java 8 and I have the SchemaCrawler folder on E: on my machine. I run SQL Server 2012.
The cmd command used is below
sc.cmd -c graph -host=10.52.136.168 -user=sa -database=MyDBName schemacrawler.Main -infolevel=detailed -schemas=dbo -tabletypes=TABLE -outputformat=pdf -outputfile=database-diagram.pdf %*
I have checked the suggestions given here
but no luck . I still get the below error
schemacrawler.schemacrawler.SchemaCrawlerSQLException: Could not connect to jdbc
:hsqldb:hsql://10.52.136.168:9001/DeliveryIntelligence;readonly=true;hsqldb.lock
_file=false, with properties {user=sa}
at schemacrawler.schemacrawler.BaseDatabaseConnectionOptions.getConnecti
on(BaseDatabaseConnectionOptions.java:122)
at schemacrawler.schemacrawler.BaseDatabaseConnectionOptions.getConnecti
on(BaseDatabaseConnectionOptions.java:70)
at schemacrawler.tools.commandline.SchemaCrawlerCommandLine.execute(Sche
maCrawlerCommandLine.java:176)
at schemacrawler.tools.commandline.SchemaCrawlerMain.main(SchemaCrawlerM
ain.java:78)
at schemacrawler.tools.hsqldb.Main.main(Main.java:43)
Caused by: java.sql.SQLTransientConnectionException: java.net.ConnectException:
Connection refused: connect
at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source)
at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source)
at org.hsqldb.jdbc.JDBCConnection.<init>(Unknown Source)
at org.hsqldb.jdbc.JDBCDriver.getConnection(Unknown Source)
at org.hsqldb.jdbc.JDBCDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at schemacrawler.schemacrawler.BaseDatabaseConnectionOptions.getConnecti
on(BaseDatabaseConnectionOptions.java:115)
... 4 more
Caused by: org.hsqldb.HsqlException: java.net.ConnectException: Connection refus
ed: connect
at org.hsqldb.ClientConnection.openConnection(Unknown Source)
at org.hsqldb.ClientConnection.initConnection(Unknown Source)
at org.hsqldb.ClientConnection.<init>(Unknown Source)
... 10 more
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at org.hsqldb.server.HsqlSocketFactory.createSocket(Unknown Source)
... 13 more
You are using SchemaCrawler for HyperSQL. Please download and use SchemaCrawler for SQL Server instead.
Sualeh Fatehi, SchemaCrawler

netty in applet throws AccessControlException

I am using netty 3 in applet and when I start it from a browser it gives me following stacktrace in Java Console, if I run from Eclipse Applet Viewer then this issue does not happen:
network: Cache entry not found [url: http://<IP address>/crossdomain.xml, version: null]
network: Connecting http://<IP address>/crossdomain.xml with proxy=DIRECT
network: Connecting http://<IP address>:80/ with proxy=DIRECT
java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.net.NetworkClient.doConnect(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.<init>(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
at com.sun.deploy.net.CrossDomainXML$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.deploy.net.CrossDomainXML.privilegedConnect(Unknown Source)
at com.sun.deploy.net.CrossDomainXML.check(Unknown Source)
at com.sun.deploy.net.CrossDomainXML.check(Unknown Source)
at sun.plugin2.applet.SecurityManagerHelper.checkConnectHelper(Unknown Source)
at sun.plugin2.applet.AWTAppletSecurityManager.checkConnect(Unknown Source)
at sun.nio.ch.SocketChannelImpl.connect(Unknown Source)
at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink.connect(NioClientSocketPipelineSink.java:150)
at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink.eventSunk(NioClientSocketPipelineSink.java:113)
at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendDownstream(DefaultChannelPipeline.java:771)
at org.jboss.netty.handler.codec.oneone.OneToOneEncoder.handleDownstream(OneToOneEncoder.java:60)
at org.jboss.netty.channel.DefaultChannelPipeline.sendDownstream(DefaultChannelPipeline.java:591)
at org.jboss.netty.channel.DefaultChannelPipeline.sendDownstream(DefaultChannelPipeline.java:582)
at org.jboss.netty.channel.Channels.connect(Channels.java:541)
at org.jboss.netty.channel.AbstractChannel.connect(AbstractChannel.java:210)
at org.jboss.netty.bootstrap.ClientBootstrap.connect(ClientBootstrap.java:227)
at org.jboss.netty.bootstrap.ClientBootstrap.connect(ClientBootstrap.java:188)
at org.mypackage.Myclass.connect(Client.java:80)
And also this
Exception caught: [id: 0x00498342] EXCEPTION: java.security.AccessControlException: access denied ("java.net.SocketPermission" "<IP address>:18090" "connect,resolve")
Exception caught: [id: 0x00498342] EXCEPTION: java.nio.channels.ClosedChannelException
I test at local PC but specify its IP address to connect.
This is line 80 in my connect method:
future = bootstrap.connect(new InetSocketAddress(host, port));
I have tried to surround it with no success
AccessController.doPrivileged(
new PrivilegedAction<Void>() {
public Void run () {
MyClass.connect(type, userId, secondValue);
return null;
}
}
);
Please, advice how can I solve it?
I was able to solve the problem.
First, I have tried to connect to 127.0.0.1, but for that I had to install Jetty and put my applet and hmtl inside jetty. So it started to work for localhost only.
Socket connection to originating server of an unsigned Java applet
It still didn't work for 10.x.y.z, so I had to sign applet
Is it possible to sign a java applet for free?
and also to create crossdomain.xml in jetty like here:
access denied (java.net.SocketPermission 127.0.0.1:8080 connect,resolve)

RMI with class files works but not with jars

When I test an RMI client and server with the class files it works without any issue on two different machines. Now when I do the same thing with a jar the client fails to connect to the RMIRegistry on the server. Then when I test with the jar on the same machine, the client can connect to the server (even over the network ip and not localhost).
I suspect this has something to do with the RMI registry, but i'm a total novice at RMI, so I have no clue...
I create an RMIRegistry like so:
rmiregistry = LocateRegistry.createRegistry(ServiceConstraints.REGISTRY_PORT);
rmiService = (RmiSubjectService) UnicastRemoteObject.exportObject(this,
ServiceConstraints.REGISTRY_PORT);
rmiregistry.rebind("RmiService", rmiService);
The client connects like this:
remoteService = (RmiSubjectService) Naming.lookup("/" + host + ":"+ port + "/RmiService");
The error I get on the client when running with a jar:
java.rmi.ConnectException: Connection refused to host: 192.168.2.132; nested exception is:
java.net.ConnectException: Connection timed out: connect
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source)
at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source)
at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source)
at sun.rmi.server.UnicastRef.newCall(Unknown Source)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at java.rmi.Naming.lookup(Unknown Source)
at ch.uzh.ifi.group10.client.Client.subscribe(Client.java:148)
at ch.uzh.ifi.group10.client.Client.main(Client.java:242)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoa
der.java:58)
Caused by: java.net.ConnectException: Connection timed out: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown S
ource)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown S
ource)
... 13 more
The problem did turn out to be the network. Specifically it was that I didn't realize that my firewall was blocking the socket, so I could not connect.

Linkedin Desktop application using Linkedin-j?

I am using LinkedIn-j api for making a Linkedin application.The problem that I am facing is that I want to develop a simple desktop application. Rather I must say a console application. The problem comes where I get this error
Exception in thread "main" com.google.code.linkedinapi.client.oauth.LinkedInOAuthServiceException: oauth.signpost.exception.OAuthCommunicationException: Communication with the service provider failed: api.linkedin.com
at com.google.code.linkedinapi.client.oauth.LinkedInOAuthServiceImpl.getOAuthRequestToken(LinkedInOAuthServiceImpl.java:159)
at com.lineedapp.common.LinkedinApp.main(LinkedinApp.java:17)
Caused by: oauth.signpost.exception.OAuthCommunicationException: Communication with the service provider failed: api.linkedin.com
at oauth.signpost.AbstractOAuthProvider.retrieveToken(AbstractOAuthProvider.java:214)
at oauth.signpost.AbstractOAuthProvider.retrieveRequestToken(AbstractOAuthProvider.java:69)
at com.google.code.linkedinapi.client.oauth.LinkedInOAuthServiceImpl.getOAuthRequestToken(LinkedInOAuthServiceImpl.java:148)
... 1 more
Caused by: java.net.UnknownHostException: api.linkedin.com
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(Unknown Source)
at com.sun.net.ssl.internal.ssl.BaseSSLSocketImpl.connect(Unknown Source)
at sun.net.NetworkClient.doConnect(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.protocol.https.HttpsClient.<init>(Unknown Source)
at sun.net.www.protocol.https.HttpsClient.New(Unknown Source)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(Unknown Source)
at oauth.signpost.basic.DefaultOAuthProvider.sendRequest(DefaultOAuthProvider.java:48)
at oauth.signpost.AbstractOAuthProvider.retrieveToken(AbstractOAuthProvider.java:177)
... 3 more
I suppose I am not able to provide a host in the application registration form. I did Provide Local host but its not working. Please Help??
Caused by: java.net.UnknownHostException: api.linkedin.com
It looks like you don't have network access to api.linkedin.com. Make sure that, if you are behind a proxy or not, you have access to https://api.linkedin.com.
The java.net.UnknownHostException: api.linkedin.com means that you are not able to reach the server.
Check that your are not behind a proxy. If so, you have to find a way to bypass this proxy in the linkedin API.

Categories

Resources