Application Not Debugging in Eclipse - java

I am trying to run my Java application in debug mode in Eclipse, but it's not working. It was fine until yesterday when I could properly debug my application. I am able to run my application on the server ( Oracle OC4J Standalone Server 10.1.3) properly. Only while debugging, it continues for a long time and then shows a server time out error. I tried increasing the Server time out, but was of no use.
I also tried removing the Server and creating it again and restarting Eclipse. Is there something I could do about this?
Edit: Strack trace on trying to Run it as Remote Java Application
Exception Stack tace:
java.net.ConnectException: Connection refused: 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 org.eclipse.jdi.internal.connect.SocketTransportService$2.run(SocketTransportService.java:136)
at java.lang.Thread.run(Unknown Source)

There is an issue with OC4J's debug mode enabling. Sometimes I've noticed that after enabling it (via opmn.xml) it will work for a while then stop working. What I've found to actually work all the time is editing the /bin/oc4j.cmd file and adding the line:
set JVMARGS=-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=9009,suspend=y,server=y
then start a Remote debugging session from Eclipse on the port 9009

Related

Apache Ignite 2.7.5: server crash with "NoClassDefFoundError: sun/nio/ch/Invoker$2"

For the current moment, this error occurred only once. Ignite starts with one node in server mode and about 30 in client mode.
In the server's log, I found this stack trace:
Failed to reinitialize local partitions (rebalancing will be stopped):
...
java.lang.NoClassDefFoundError: sun/nio/ch/Invoker$2
...
at sun.nio.ch.Invoker.invokeIndirectly(Unknown Source)
at sun.nio.ch.Invoker.invoke(Unknown Source)
at sun.nio.ch.Invoker.invoke(Unknown Source)
at sun.nio.ch.WindowsAsynchronousFileChannelImpl$ReadTask.run(Unknown Source)
at sun.nio.ch.WindowsAsynchronousFileChannelImpl.implRead(Unknown Source)
at sun.nio.ch.AsynchronousFileChannelImpl.read(Unknown Source)
at org.apache.ignite.internal.processors.cache.persistence.file.AsyncFileIO.read(AsyncFileIO.java:77)
at org.apache.ignite.internal.processors.cache.persistence.file.AbstractFileIO$1.run(AbstractFileIO.java:82)
I inspected the rt.jar the server is used and found this Invoker$2.
Also I found this sun.nio.ch.Invoker$2 in the list of loaded classes in Java VisualVM.
So I don't understand at all what's the problem.

Eclipse won't open after Installing Windows Builder

I downloaded Eclipse's Windows Builder through this link which is from Eclipse org itself. After the installation was complete, my Eclipse just won't open anymore. There's no errors log, it will appear the loading screen and close. as you can see on this video.
How can I fix this problem? Thanks
EDIT: The last session was 2015-07-04 at 11:45. This was when I tried to download and install Windows Builder. It is filled with a bunch of "(something) will be ignored because a newer version is already installed" and at the very bottom this is the last thing that it shows
!MESSAGE Cannot complete the install because some dependencies are not satisfiable
!SUBENTRY 2 org.eclipse.equinox.p2.director 4 0 2015-07-04 11:54:38.763
!MESSAGE org.eclipse.actf.visualization.feature.group [1.2.0.R201406111357] cannot be installed in this environment because its filter is not applicable.
!ENTRY org.eclipse.equinox.p2.transport.ecf 2 0 2015-07-04 12:14:26.294
!MESSAGE Connection to http://ftp.osuosl.org/pub/eclipse/releases/luna/201409261001/plugins/org.eclipse.sphinx.emf.workspace.ui.source_0.8.1.201409171422.jar failed on Connection timed out: connect. Retry attempt 0 started
!STACK 0
java.net.ConnectException: Connection timed out: 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 org.eclipse.ecf.internal.provider.filetransfer.httpclient4.ECFHttpClientProtocolSocketFactory.connectSocket(ECFHttpClientProtocolSocketFactory.java:84)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:177)
at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:144)
at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:131)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:611)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:446)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.eclipse.ecf.provider.filetransfer.httpclient4.HttpClientRetrieveFileTransfer.performConnect(HttpClientRetrieveFileTransfer.java:1077)
at org.eclipse.ecf.provider.filetransfer.httpclient4.HttpClientRetrieveFileTransfer.access$0(HttpClientRetrieveFileTransfer.java:1068)
at org.eclipse.ecf.provider.filetransfer.httpclient4.HttpClientRetrieveFileTransfer$1.performFileTransfer(HttpClientRetrieveFileTransfer.java:1064)
at org.eclipse.ecf.filetransfer.FileTransferJob.run(FileTransferJob.java:73)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Sorry if it's disorganized
You will probably need to try to repeat the process with a clean installation of Eclipse.
One thing you can try changing is where it downloads the WindowBuilder plugin from (got that idea from here). Go to the WindowBuilder website and copy the "Release Version" "Update Site" link for your version of Eclipse. Paste that as the "source" in the "Install New Software" window.
The link for Eclipse Luna should be:
http://download.eclipse.org/windowbuilder/WB/release/R201506241200-1/4.4/

File Transfer RMI

I am just following a tutorial on how to send files using RMI.
Tutorial: Link
I encounter an error when i try to run my server. The only change i have made different from the tutorial is i have changed my port to 1097 instead of the default 1099.
How can i resolve this error?
This is the error i receive:
C:\Program Files\Java\jdk1.7.0_09\bin\FT_RMI>java -Djava.security.policy=policy.
txt FileServer
FileServer: access denied ("java.net.SocketPermission" "127.0.0.1:1097" "connect
,resolve")
java.security.AccessControlException: access denied ("java.net.SocketPermission"
"127.0.0.1:1097" "connect,resolve")
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkConnect(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)
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.rebind(Unknown Source)
at java.rmi.Naming.rebind(Unknown Source)
at FileServer.main(FileServer.java:11)
Line 11 is Naming.rebind().
Here:
FileInterface fi = new FileImpl("FileServer");
Naming.rebind("//127.0.0.1:1097/FileServer", fi);
I have tried changing the address to localhost, but the same error occurs.
SOLUTION
Point to the specific java policy file, either in JRE folder or a specific policy file.
java -Djava.security.policy="C:\\FT_RMI\\java.policy" FileServer
You have to allow the socket connect on your security properties under JRE. You can see this under jre/lib/security/java.policy
You are running your server under a SecurityManager. Unless you are using the RMI codebase feature or you have another specific security requirement that dictates its use in the server, just remove it.

Linux bash: java.net.ConnectException: Connection refused

I have a java program Read which reads file from an URL looks like this:
file://myhost/system.log
On Windows I use this command:
java Read "file://myhost/system.log"
and it works flawlessly.
But on Linux when I try to use the same command it gives me this error:
Exception in thread "main" java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.net.ftp.impl.FtpClient.doConnect(Unknown Source)
at sun.net.ftp.impl.FtpClient.tryConnect(Unknown Source)
at sun.net.ftp.impl.FtpClient.connect(Unknown Source)
at sun.net.ftp.impl.FtpClient.connect(Unknown Source)
at sun.net.www.protocol.ftp.FtpURLConnection.connect(Unknown Source)
at sun.net.www.protocol.ftp.FtpURLConnection.getInputStream(Unknown Source)
at java.net.URL.openStream(Unknown Source)
at read.readInput(ReadHTML.java:53)
at read.readInput.main(ReadHTML.java:76)
Any ideas?
UPDATE:
I think I found the problem:
myhost is not mounted on the Linux machine so that it cannot connect to it by using file://...
Thanks for all the answers, guys!
This is because your program (by virtue of using a file URL on a Linux OS) is attempting to open an FTP connection to the host specified in the URL. The establishment of the FTP connection fails.
This could be due to a variety of issues. Try connecting with ftp directly:
ftp myhost
And I'm guessing it'd fail as well. Do you have an FTP server installed & running?
One of the possible reason can be that hosts.allow does not have entry of your machine.
I suspect you just need a third /. The correct syntax for file uris is file://[path] but [path] should begin with a /.

Java RMI (Server: TCP Connection Idle/Client: Unmarshalexception (EOFException))

I'm trying to implement Sun Tutorials RMI application that calculates Pi. I'm having some serious problems and I cant find the solution eventhough I've been searching the entire web and several javaskilled people.
I'm hoping you can put an end to my frustrations.
The crazy thing is that I can run the application from the cmd on my desktop computer. Trying the exact same thing with the exact same code in the exact same directories on my laptop produces the following errors. The problem occures when I try to connect the client to the server.
I don't believe that the error is due to my policyfile as I can run it on the desktop. It must be elsewhere. Have anyone tried the same and can you give me a hint as to where my problem is, please?
POLICYFILE SERVER:
grant
{
permission java.security.AllPermissions;
permission java.net.SocketPermission"*", "connect, resolve";
};
POLICYFILE CLIENT:
grant
{
permission java.security.AllPermissions;
permission java.net.SocketPermission"*", "connect, resolve";
};
______________________________________________
SERVERSIDE ERRORS:
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\Documents and Settings\STUDENT>cd\
C:\>start rmiregistry
C:\>java -cp c:\java;c:\java\compute.jar -Djava.rmi.server.codebase=file:/c:/jav
a/compute.jar -Djava.rmi.server.hostname=localhost -Djava.security.policy=c:/jav
a/servertest.policy engine.ComputeEngine
ComputeEngine bound
Exception in thread "RMI TCP Connection(idle)" java.security.AccessControlExcept
ion: access denied (java.net.SocketPermission 127.0.0.1:1440 accept,resolve)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkAccept(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.checkAcceptPermi
ssion(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport.checkAcceptPermission(Unknown Sour
ce)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Sou
rce)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Sour
ce)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source
)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
_______________________________
CLIENTSIDE ERRORS:
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\Documents and Settings\STUDENT>cd\
C:\>java -cp c:\java;c:\java\compute.jar -Djava.rmi.server.codebase=file:\C:\jav
a\files\ -Djava.security.policy=c:/java/clienttest.policy client.ComputePi local
host 45
ComputePi exception:
java.rmi.UnmarshalException: Error unmarshaling return header; nested exception
is:
java.io.EOFException
at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(Unkn
own Source)
at java.rmi.server.RemoteObjectInvocationHandler.invoke(Unknown Source)
at $Proxy0.executeTask(Unknown Source)
at client.ComputePi.main(ComputePi.java:18)
Caused by: java.io.EOFException
at java.io.DataInputStream.readByte(Unknown Source)
... 6 more
C:\>
Thanks in advance
Perry
Your server didn't have permission to accept a connection from that client.
Ergo your policy file wasn't where you said it was, or wasn't loaded for some other reason.
Run it with -Djava.security.debug=access,failure and you will see what protection domain you were in when the security exception occurred, and what permissions it had.
java -cp c:\java;c:\java\compute.jar -Djava.rmi.server.codebase=file:/c:/java/compute.jar -Djava.rmi.server.hostname=localhost -Djava.security.policy=c:/java/servertest.policy engine.ComputeEngine
NB a file: codebase cannot work if it refers to a local filesystem, unless the client is also in the same machine, which makes RMI fairly pointless. Codebase URLs need to refer to locations that are accessible by the client. You can use shared file systems but you must provide a URL that is usable by the client. The server doesn't use its own codebase URL at all.
I tried the same and I found that Java simply ignored the policy file, no matter where I put it or what I put into it or which option I used to make the VM pick it up.
In the end, I create my own SecurityManager in the code and did everything manually.

Categories

Resources