Practise remote debugging on local glassfish server? - eclipse

I tried to do remote debugging on a remote glassfish server for some time, using eclipse.
I want to do it on my local server which is in my own computer. I followed the same
instructions that one follows for setting up remote debugging. In eclipse, I set debug
configurations with info - host = localhost, port = 6767 and server in debug mode.
6767 is the port which I use to connect to the admin of my glassfish server.
This approach worked in the actual remote debugging. But it fails in local debugging.
I get the error - Failed to connect to remote VM. Connection timed out.
org.eclipse.jdi.TimeoutException
How do I fix this error ?
The log from the folder workspace dir > .metadata > .log is given below:
!ENTRY org.eclipse.jdt.launching
!MESSAGE Failed to connect to remote VM. Connection timed out.
!STACK 0
org.eclipse.jdi.TimeoutException
at org.eclipse.jdi.internal.connect.SocketTransportService.attach(SocketTransportService.java:162)
at org.eclipse.jdi.internal.connect.SocketTransportImpl.attach(SocketTransportImpl.java:45)
at org.eclipse.jdi.internal.connect.SocketAttachingConnectorImpl.attach(SocketAttachingConnectorImpl.java:134)
at org.eclipse.jdt.internal.launching.SocketAttachConnector.connect(SocketAttachConnector.java:141)
at org.eclipse.jdt.internal.launching.JavaRemoteApplicationLaunchConfigurationDelegate.launch(JavaRemoteApplicationLaunchConfigurationDelegate.java:84)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:858)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:707)
at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1018)
at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1222)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
I tried one solution which did not work -
open glassfish admin console in a browser > Configuration > server-config > JVM settings > Debug: Enable the checkbox

You do not debug a local application using the remote debugging method. Simply right click your project > debug as > debug on server > choose tomcat or glassfish etc.
Then, run your app from the web browser and see the debugging.

Related

Proxy configuration for SonarLint (vscode)

Using the vscode extension SonarLint, I'm unable to get it connect to our on-premise SonarQube server. I know that it is a proxy problem, since I can only connect to the SonarQube server using curl via proxy. The output of the SonarLint extension is like:
[Warn - 10:13:44.279] java.lang.IllegalStateException: org.apache.hc.client5.http.ConnectTimeoutException: Connect to https://my_server_url:443 [my_server_url/XXX.XXX.XXX.XXX] failed: 30 SECONDS
at org.sonarsource.sonarlint.ls.http.ApacheHttpClient.executeSync(ApacheHttpClient.java:86)
at org.sonarsource.sonarlint.ls.http.ApacheHttpClient.get(ApacheHttpClient.java:57)
at org.sonarsource.sonarlint.core.serverapi.ServerApiHelper.rawGet(ServerApiHelper.java:93)
at org.sonarsource.sonarlint.core.serverapi.developers.DevelopersApi.getEvents(DevelopersApi.java:57)
at org.sonarsource.sonarlint.core.notifications.NotificationChecker.request(NotificationChecker.java:44)
at org.sonarsource.sonarlint.core.notifications.NotificationTimerTask.requestForServer(NotificationTimerTask.java:78)
at org.sonarsource.sonarlint.core.notifications.NotificationTimerTask.run(NotificationTimerTask.java:62)
at java.base/java.util.TimerThread.mainLoop(Timer.java:566)
at java.base/java.util.TimerThread.run(Timer.java:516)
Caused by: org.apache.hc.client5.http.ConnectTimeoutException: Connect to https://my_server_url:443 [my_server_url/XXX.XXX.XXX.XXX] failed: 30 SECONDS
at org.apache.hc.core5.io.SocketTimeoutExceptionFactory.create(SocketTimeoutExceptionFactory.java:50)
at org.apache.hc.core5.reactor.InternalConnectChannel.onTimeout(InternalConnectChannel.java:93)
at org.apache.hc.core5.reactor.InternalChannel.checkTimeout(InternalChannel.java:67)
at org.apache.hc.core5.reactor.SingleCoreIOReactor.checkTimeout(SingleCoreIOReactor.java:241)
at org.apache.hc.core5.reactor.SingleCoreIOReactor.validateActiveChannels(SingleCoreIOReactor.java:168)
at org.apache.hc.core5.reactor.SingleCoreIOReactor.doExecute(SingleCoreIOReactor.java:130)
at org.apache.hc.core5.reactor.AbstractSingleCoreIOReactor.execute(AbstractSingleCoreIOReactor.java:85)
at org.apache.hc.core5.reactor.IOReactorWorker.run(IOReactorWorker.java:44)
at java.base/java.lang.Thread.run(Thread.java:833)
The IP address anonymized by me is as expected for said host.
I'm unable to find any information on proxy settings in:
vscode extension settings and corresponding help texts
reading https://www.sonarlint.org/visualstudio/
searching for "proxy" in https://github.com/SonarSource/sonarlint-visualstudio issues and wiki
Is there other documentation available? If not: how to configure the proxy?

failed to find free socket port for process dispatcher when trying remote debug

Highlights:
windows 10 host machine
ubuntu vagrant box (virtualbox) as guest vm
using vagrant port forwarding as like this: config.vm.network "forwarded_port", guest: 1234, host: 12340
IDE: IntelliJ IDEA with Ruby plugin
The Issue:
I've tried to set up remote ruby debug following this guide and getting an error in IDE: "failed to find free socket port for process dispatcher". It looks this issue is not IntelliJ-specific, I was able to reproduce it with latest RubyMine as well.
From IDEA's log
2017-07-07 21:53:03,515 [8879188] INFO - tion.impl.ExecutionManagerImpl - Failed to find free socket port for process dispatcher
com.intellij.execution.ExecutionException: Failed to find free socket port for process dispatcher
at org.jetbrains.plugins.ruby.ruby.debugger.RubyProcessDispatcher.<init>(RubyProcessDispatcher.java:46)
at org.jetbrains.plugins.ruby.ruby.debugger.RubyRemoteDebugRunner.doExecute(RubyRemoteDebugRunner.java:62)
...
Caused by: java.net.BindException: Address already in use: JVM_Bind
at java.net.TwoStacksPlainSocketImpl.socketBind(Native Method)
at java.net.TwoStacksPlainSocketImpl.socketBind(TwoStacksPlainSocketImpl.java:137)
...
I can understand it says Address already in use: JVM_Bind, but how remote debug supposed to work at all then? (I mean Is there any way to access guest vm port not forwarding it before? Clearly no) Any help to solve this issue is much appreciated.
For me the issue was due to another debug session that was open in the background. To prevent that from happening again (and also close all other currently open sessions, once you run the configuration again) select "Single instance only" in the Debug Configuration:

Administrator access to EJBCA gives "intrerrupted while the page was loading" error

I want ot use EJBCA with Wildfly (JBoss) application server as PKI infrastructure.
I can access
http://127.0.0.1:8080/ejbca/
https://127.0.0.1:8442/ejbca/
but not
https://127.0.0.1:8443/ejbca/adminweb/
Then I will get with Firefox:
The connection to 127.0.0.1:8443 was interrupted while the was loading
With wireshark I can see the FIN ACKs of the application server.
I am using Ubuntu 16.04.2 LTS AMD64 virtual machine with Java
java -version
openjdk version “1.8.0_131”
OpenJDK Runtime Environment (build 1.8.0_131-8u131-b11-0ubuntu1.16.04.2-b11)
OpenJDK 64-Bit Server VM (build 25.131-b11, mixed mode)
and with EJBCA ejbca_ce_6_5.0.5.zip
and with Wildfly (JBoss) application server wildfly-10.0.0.Final.zip
and with MariaDB which seems to work well except above mentioned Administration access in the GUI.
The configuration is similar to this I found on the EJBCA install page. It seems, that the part with port 8443 was not correctly configured. Do you have a hint for me to find a solution for my problem?
Regards
drnie
For configuration details please have a look at the following lines:
----------------------- BEGIN CONFIG -----------------------
configuring MariaDB
after unzipping as User ejbca
configured the following files
setting the keystore password
$EJBCA_HOME /conf/cesecore.properties
setting database properties (DB name, DB url, DB driver, DB user name and DB password)
$EJBCA_HOME /conf/database.properties
setting cms keystore password and app server home
$EJBCA_HOME /conf/ejbca.properties
kept all settings ...
$EJBCA_HOME /conf/install.properties
Added Management user with
cd /home/ejbca/wildfly-10.0.0.Final/bin/
./add-user.sh
started Wildfly app server
--- Add datasource ---
opened the Call Level Interface
/home/ejbca/wildfly-10.0.0.Final/bin/jboss-cli.sh -c
entered the commands
data-source add --name=ejbcads --driver-name="mariadb-java-client-1.2.0.jar" --connection-url="jdbc:mysql://127.0.0.1:3306/ejbca" --jndi-name="java:/EjbcaDS" --use-ccm=true --driver-class="org.mariadb.jdbc.Driver" --user-name="ejbca" --password="ejbca" --validate-on-match=true --background-validation=false --prepared-statements-cache-size=50 --share-prepared-statements=true --min-pool-size=5 --max-pool-size=150 --pool-prefill=true --transaction-isolation=TRANSACTION_READ_COMMITTED --check-valid-connection-sql="select 1;"
:reload
--- Configure WildFly Remoting ---
/subsystem=remoting/http-connector=http-remoting-connector:remove
/subsystem=remoting/http-connector=http-remoting-connector:add(connector-ref="remoting",security-realm="ApplicationRealm")
/socket-binding-group=standard-sockets/socket-binding=remoting:add(port="4447")
/subsystem=undertow/server=default-server/http-listener=remoting:add(socket-binding=remoting)
:reload
--- Configure logging ---
/subsystem=logging/logger=org.ejbca:add
/subsystem=logging/logger=org.ejbca:write-attribute(name=level, value=DEBUG)
/subsystem=logging/logger=org.cesecore:add
/subsystem=logging/logger=org.cesecore:write-attribute(name=level, value=DEBUG)
:reload
--- Remove existing TLS and HTTP configuration ---
/subsystem=undertow/server=default-server/http-listener=default:remove
/subsystem=undertow/server=default-server/https-listener=https:remove
/socket-binding-group=standard-sockets/socket-binding=http:remove
/socket-binding-group=standard-sockets/socket-binding=https:remove
:reload
quitting CLI shell
restarted wildfly app server
--- Deploy EJBCA ---
ant clean deployear
--- Run install ---
ant runinstall
--- Deploy TLS keystores to WildFly ---
ant deploy-keystore
in the CLI shell
/interface=http:add(inet-address="0.0.0.0")
/interface=httpspub:add(inet-address="0.0.0.0")
/interface=httpspriv:add(inet-address="0.0.0.0")
/socket-binding-group=standard-sockets/socket-binding=http:add(port="8080",interface="http")
/subsystem=undertow/server=default-server/http-listener=http:add(socket-binding=http)
/subsystem=undertow/server=default-server/http-listener=http:write-attribute(name=redirect-socket, value="httpspriv")
:reload
waiting for reload to complete
Configure identities and socket bindings:
/core-service=management/security-realm=SSLRealm:add()
/core-service=management/security-realm=SSLRealm/server-identity=ssl:add(keystore-path="${jboss.server.config.dir}/keystore/keystore.jks", keystore-password="serverpwd", alias="localhost")
/core-service=management/security-realm=SSLRealm/authentication=truststore:add(keystore-path="${jboss.server.config.dir}/keystore/truststore.jks", keystore-password="changeit")
/socket-binding-group=standard-sockets/socket-binding=httpspriv:add(port="8443",interface="httpspriv")
/socket-binding-group=standard-sockets/socket-binding=httpspub:add(port="8442", interface="httpspub")
restart the application server completely and then
/subsystem=undertow/server=default-server/https-listener=httpspriv:add(socket-binding=httpspriv, security-realm="SSLRealm", verify-client=REQUIRED)
/subsystem=undertow/server=default-server/https-listener=httpspub:add(socket-binding=httpspub, security-realm="SSLRealm")
:reload
--- Finalize Wildfly configurations ---
/system-property=org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH:add(value=true)
/system-property=org.apache.catalina.connector.CoyoteAdapter.ALLOW_BACKSLASH:add(value=true)
/system-property=org.apache.catalina.connector.URI_ENCODING:add(value="UTF-8")
/system-property=org.apache.catalina.connector.USE_BODY_ENCODING_FOR_QUERY_STRING:add(value=true)
/subsystem=webservices:write-attribute(name=wsdl-host, value=jbossws.undefined.host)
/subsystem=webservices:write-attribute(name=modify-wsdl-address, value=true)
:reload
----------------------- END CONFIG -----------------------
I know this is old, but I am betting you did not have the hostname set in web.properties. You need to set httpsserver.hostname=myejbcaservername (default is localhost).
Also, try using FireFox. It has its own certificate store (separate from the OS certificate store) and works better when managing PKIs.
Also, restart your browser if you do have the superadmin certificate installed. If you have hit cancel or done something it will genernally not renegotiate until you use a private browsing window or restart your browser.

Publishing to GlassFish 4 at localhost [domain 1] has encountered a ...., Cannot deploy abconlinetest

I have no idea how step over this problem:
**After amending some code where Glasfish provide an reasonable error message i got this useless message:
"Publishing to GlassFish 4 at localhost [domain 1] has encountered a problem, Cannot deploy abconlinetest" without any other expanation. Even after removing my corrections to force Glassfish to produce the old error message is not possible. Glashfish sticks with this message.
I got this message several times in the past and started always from scratch to set up the application step by step to get into a stable environment.
Below are the start messages from GlashFish.
Glassfish stops always at: 2015-01-16T18:54:02.309+0100|Information:
HV000001: Hibernate Validator 5.0.0.Final Then the messages appears
thhat glassFish is unable to deply the application.
Application uses JSF 2.2 writing the content of two formulars to an
Oracle database.
100|Information: Running GlassFish Version: GlassFish Server Open
Source Edition 4.1 (build 13)
2015-01-16T18:53:56.909+0100|Information: Server log file is using
Formatter class: com.sun.enterprise.server.logging.ODLLogFormatter
2015-01-16T18:53:56.987+0100|Information: Realm [admin-realm] of
classtype [com.sun.enterprise.security.auth.realm.file.FileRealm]
successfully created. 2015-01-16T18:53:56.987+0100|Information: Realm
[file] of classtype
[com.sun.enterprise.security.auth.realm.file.FileRealm] successfully
created. 2015-01-16T18:53:56.987+0100|Information: Realm [certificate]
of classtype
[com.sun.enterprise.security.auth.realm.certificate.CertificateRealm]
successfully created. 2015-01-16T18:53:57.159+0100|Information:
Authorization Service has successfully initialized.
2015-01-16T18:53:57.159+0100|Information: Registered
org.glassfish.ha.store.adapter.cache.ShoalBackingStoreProxy for
persistence-type = replicated in BackingStoreFactoryRegistry
2015-01-16T18:53:57.503+0100|Information: Grizzly Framework 2.3.15
started in: 47ms - bound to [/127.0.0.1:8080]
2015-01-16T18:53:57.534+0100|Information: Grizzly Framework 2.3.15
started in: 0ms - bound to [/127.0.0.1:8181]
2015-01-16T18:53:57.550+0100|Information: Grizzly Framework 2.3.15
started in: 0ms - bound to [/0.0.0.0:4848]
2015-01-16T18:53:57.565+0100|Information: Grizzly Framework 2.3.15
started in: 0ms - bound to [/0.0.0.0:3700]
2015-01-16T18:53:57.565+0100|Information: GlassFish Server Open Source
Edition 4.1 (13) startup time : Felix (1.346ms), startup
services(734ms), total(2.080ms)
2015-01-16T18:53:57.737+0100|Information: Grizzly Framework 2.3.15
started in: 15ms - bound to [/0.0.0.0:7676]
2015-01-16T18:53:57.753+0100|Information: Registered
com.sun.enterprise.glassfish.bootstrap.osgi.EmbeddedOSGiGlassFishImpl#3b0ee03a
as OSGi service registration:
org.apache.felix.framework.ServiceRegistrationImpl#2bf94401.
2015-01-16T18:53:57.753+0100|Information: Binding RMI port to single
IP address = 127.0.0.1, port 8.686
2015-01-16T18:53:57.800+0100|Information: JMXStartupService has
started JMXConnector on JMXService URL
service:jmx:rmi://127.0.0.1:8686/jndi/rmi://127.0.0.1:8686/jmxrmi
2015-01-16T18:54:02.309+0100|Information: HV000001: Hibernate
Validator 5.0.0.Final
This worked for me.
Go to Servers.
Expand GlassFish 4 at localhost [domain1].
Expand GlassFish Management.
Right click on your project name and press Delete.
Now run the Project again on Glassfish 4.
Hope it helps.
Approach1:
Removing application from server
GlassFish 4 at localhost [domain1] Right click ---> Stop
Expand application list under server: GlassFish 4 at localhost [domain1]
Right click on the project
Select Remove
Click Yes
GlassFish 4 at localhost [domain1] Right click ---> Clean
GlassFish 4 at localhost [domain1] Right click ---> Publish
Re running project
Project ---> Clean
Project ---> Refresh F5
Project Run As ---> Run on Server
Select GlassFish 4 at localhost [domain1]
Click Next
Select the Project
Click Finish
running the project again, it fixes the error.
Approach2:
Same error, and the detailed error message shows:
cannot Deploy project: java.util.concurrent.TimeoutException
For TimeoutException errors, by increasing the timeout limit for server, will work:
Right click on GlassFish 4 at localhost [domain1] ---> Properties ---> Timeouts ---> Start (seconds) ---> increase the timeout limit in seconds ---> Save
Run the project again with the same steps mentioned above.

Should I worry about DDMS console log messages "Can't bind to local nnnn for debugger"?

I'm new to Android programming (and Eclipse IDE and Android emulator). I've got Hello World and some of Notepad working, but I'm still constantly getting quite a few DDMS console log messages (shown below) about not being able to bind locals for debugger.
[2010-05-29 21:03:16 - ddms] Can't bind to local 8601 for debugger
[2010-05-29 21:05:26 - Device] Failed to delete temporary package: device (emulator-5556) request rejected: device not found
[2010-05-29 21:06:47 - ddms] Can't bind to local 8600 for debugger
[2010-05-29 21:07:05 - ddms] Can't bind to local 8601 for debugger
[2010-05-29 21:07:05 - ddms] Can't bind to local 8602 for debugger
And so on. Is this a problem? Can I get rid of these messages somehow?
In Eclipse, goto
1) Windows->Preference
2) Expand Android menu in the side of the Preference Window.
3) Now select DDMS from it.
4) Then Set the Base local debugger port to "8601" and enable "Use ADBHOST" checkbox and the ABDHOST value should be "127.0.0.1".
5) Click apply and ok.
6) Now you have to restart your ADB, for this you have to login as root user(Assuming linux user) and navigate to Platfrom tools folder of your Android SDK. Then execute,
./adb kill-server
./adb start-server
You will be able to see the message "Daemon started Successfully" . If not repeat step 6 once again until you see the success message.
You can get rid of the the messages by adding following to your hosts file:
127.0.0.1 localhost
ps. hosts file can be found from c:\windows\system32\drivers\etc\hosts
or if you are on linux /etc/hosts
In my situation the problem has been solved by a uninstalling all Java 7. The debugger is now working again!