Glassfish debug from command line - glassfish-3

I'm running Glassfish on a remote machine. Is there a command to start GF in debug mode from the command prompt? The remote machine runs Ubuntu 10.04, my machine runs Windows 7 (not sure if this is important).
I connect without a problem and know the commands to start and stop the server remotely. I even found this documentation. Unfortunately, I think the answer to my question is "no", but I wanted to put it to the SO community before giving up hope.

The start-domain command has a debug option:
asadmin start-domain --debug=true

Related

Docker containers do not work when run from command line

I have been working on an ASP.NET application using Docker, and when I launch it through Visual Studio it works great! However, if I try to run anything from the command line (or powershell, or VS's CLI/Powershell) it will run, but the container it generates refuses all connections.
I am on Windows 10 NT with Docker Desktop installed trying to run an ubuntu:18.04 image (i've tried Alpine, ubuntu:16.04 as well).
Steps to reproduce:
-Create a default ASP.NET application in Visual Studio
-Add Docker Support
-Run with 'Docker' selected
-Open browser, navigate to localhost:[YourPort]
-Success! Works as intended.
Then, either using the same image or a downloaded one (I tried dockersamples/static-site to confirm it wasn't a problem with the specific project):
-Open CMD
-Run docker run -p [HostPort]:[ContainerPort] [SameImageVSUses:tag] on a different port
-See that docker ps shows both containers running next to each other
-Open browser (Firefox), get error
The connection was reset
Update
I changed the ASP.NET app's program class to use 0.0.0.0 instead of localhost, I believe this was necessary but now I see
Secure Connection Failed
PR_END_OF_FILE_ERROR_
If I curl localhost:[MyPort], I get (52) empty reply from server
/Update
Well, maybe Visual Studio does more that I'm not aware of.
A little bit of digging shows yes, it throws in a ton of extra arguments! Using the copy/pasted command Visual Studio does gives me... the exact same error.
To clarify, the containers still run from the command line, I can ssh in or docker inspect them (in fact, the VS-started and CMD-started containers' docker inspect is identical other than network addresses it's bound to). I get no error messages at all from the process of building and starting the container, so if some part of it is failing it is doing so silently.
I'm relatively new to Docker but I can't seem to find a fix for this, or even a reason behind it. What is Visual Studio doing that I'm not? I've tried everything I'm aware of, I even had to wipe my machine (unrelated) and the exact same thing happened when I got everything reinstalled. My gut tells me it's something on my machine, but then the VS-launched one should fail too, right?
I can't find anything that tells me to flip a magic switch if I'm running CLI stuff, and nothing I do to the dockerfile or command arguments seems to work. I've never used VirtualBox or Docker Toolbox, this shouldn't be a wonky configuration screwed up by an old program because It works fine when launched from Visual Studio! Agh!
I hope that this is indeed a magic switch I haven't flipped, otherwise there is something very basic that I don't understand about what I'm working with.
If you are trying to run recent VS template you just need to follow this instruction:
Go to the Api project directory:
cd ./src/YourApiDirectory
Build Command:
docker build -f ./Dockerfile --force-rm -t yourapiimage:dev ..
Run Command:
docker run -it --rm -e "ASPNETCORE_ENVIRONMENT=Development" -p 58817:80 --name yourapiname yourapiimage:dev
please note that "-it" flag in last command will run your image in "interactive" mode. Also please note I am using only http connection via port 58817.
Thank you for the suggestions, it ended up being something rather frustrating. I think that it was a combination of two problems:
This stuff could be causing problems for others but I was mistaken, this did not work for me
First and foremost, no amount of docker configuration tells your website to listen for anything inside the container. I believe the website wasn't listening for anything when I initially tried most fixes.
The real problem was that the launchSettings.json in the .csproj Properties folder apparently overrides arguments from the command line!
Remember how I said '...run it alongside the first...'? That means I was never running the website on the correct set of ports. Apparently, -p 8001:443 -e ASPNETCORE_HTTPS_PORT=443 is not enough to make the site listen on 443. You must also set the sslPort in the launchSettings.json. Such is life, I suppose.
This is what finally worked
I ran docker-compose up in the solution directory. That's it. I didn't see a docker-compose.yml when I was looking in VS so I didn't think about it, but that's only because VS doesn't show solution-level items. I guess the thing that VS was doing that I wasn't was running docker-compose instead of individual commands.
When directly launch with Docker profile which is done via docker-compose file in Visual Studio, visual studio behind the screen merges different override files and does different tasks and one of them is attaching remote debugger in the container etc.
To help you I've created a sample asp.net core api via Visual Studio 2019 selecting .Net Core 3.0.
The following is the docker-compose that VS2019 generated on my machine when I launched my API via VS2019.
docker-compose -f "C:\Users\myuser\source\repos\testwebcore\docker-compose.yml" -f "C:\Users\myuser\source\repos\testwebcore\docker-compose.override.yml" -f "C:\Users\myuser\source\repos\testwebcore\obj\Docker\docker-compose.vs.debug.g.yml" -p dockercompose14364360289538262671 --no-ansi up -d --build --force-recreate --remove-orphans
I can get it work directly on powershell by running the following command, here I am using the same settings used in the override file by default created by VS2019. You have to run this command from parent folder outside the project folder.
docker-compose -f "C:\Users\myuser\source\repos\testwebcore\docker-compose.yml" -f "C:\Users\myuser\source\repos\testwebcore\docker-compose.override.yml" up
If you have directly build and run with the docker file instead of docker-compose
You can build with the following command and like before should run from outside folder of the project file.
docker build -f testwebcore/Dockerfile -t testcore
After building the image, you can run it with the below command but before that you need to create a certificate and pass couple of environment variables to the run command. The details of this is mentioned in the following page.. Especially the section Windows subsystem for Linux. I am running Linux containers on my Windows 10 laptop.
So you have to run the following command to generate certificate
dotnet dev-certs https -ep %USERPROFILE%\.aspnet\https\aspnetapp.pfx -p testpassword
So the complete run command with environment variables and certificate generated above the command is as follows.
docker run --rm -it -p 8000:80 -p 8001:443 -e ASPNETCORE_URLS="https://+;http://+" -e ASPNETCORE_HTTPS_PORT=8001 -e ASPNETCORE_Kestrel__Certificates__Default__Password="testpassword" -e ASPNETCORE_Kestrel__Certificates__Default__Path=/https/aspnetapp.pfx -v c:\users\myuser\.aspnet\https:/https/ testcore:latest

Error connecting to Jupyter notebook localhost

I've tried looking this up, found something similar but not quite. I'm new so if I've posted something commonly posted, my apologies!
When I run jupiter notebook on terminal, this shows up:
Serving notebooks from local directory: /home/myname/Jupyter
0 active kernels
The Jupyter Notebook is running at: http://localhost:8888/?token=9da2454c0873c8989e93c42f9cc0ee5892da4da6e02fd9b5
Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
No web browser found: could not locate runnable browser.
Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://localhost:8888/?token=9da2454c0873c8989e93c42f9cc0ee5892da4da6e02fd9b5
And then when I paste the link to google chrome it says
Safari can't open the page "http://localhost:8888/?token=9da2454c0873c8989e93c42f9cc0ee5892da4da6e02fd9b5" because Safari can't connect to the server "localhost."
I've looked at some other similar issues but I can't find a definite solution other than that port 8888 is being used? Any advice appreciated!
Notes: I've tried this on a Mac running OS X El Capitan version 10.11.6
I had the same issue. What I did was following.
Step 1: Go to Windows start menu and search for Anaconda Prompt (Anaconda3)
Step 2: Type "jupyter notebook" and click "Enter" btn
Step 3: Instead of using localhost use port 127.0.0.1.
Note: Port may be different for you, so just check before you try.

sftp put -r not working, terminal prints "Entering myDirectory" and then nothing happens

I am trying to upload a directory from my local machine to a Digital Ocean droplet, ubuntu 14.04, using the command "put -r myDirectory". Initially I had the "unable to canonicalize path" issue, but I created a remote 'myDirectory' as instructed and the error message disappeared.
However, "put -r myDirectory" still doesn't work - the console prints "Uploading myDirectory/ to /remote/path/myDirectory, Entering myDirectory/" and then nothing happens. I am new to sftp but I'm very puzzled as I can't find my problem on the internet.
Well - I'm currently running into the same problem.
It seems that this OpenSSH bug report may have a lot to do with it:
http://lists.mindrot.org/pipermail/openssh-bugs/2016-January/015929.html
I'm running on Ubuntu 15.10, OpenSSH version 6.9p1. They seem to have fixed it in this commit from Feb 11, but I'm not sure yet how to get it running in my current environment.
Using
put /mydir/*
worked for me.

Java program doesn't start on Unix machine

When I start Java application from command line on AIX 6.1 machine the application just doesn't start. All I get is a blinking cursor, hitting CTRL+C doesn't help. It seats in the list of processes all the time.
Even running the following command produces the same result so I don't think it is program related.
java -version
Cursor is blinking on the next line and nothing happens. When I open second session and type
ps -ef
I get the following:
tomcat 32243914 31850686 0 13:50:27 pts/7 0:00 -ksh
tomcat 5439538 32243914 1 13:50:50 pts/7 0:00 /usr/java6/jre/bin/java -version
On Windows my program runs just fine. So I think it is JRE or Unix related.
I'm not a Unix expert so I would appreciate any suggestions on how to trouble shoot this.
sounds strange , it seems that your process does not give hands back... No return
Do you have top binary installed on your AIX machine ?
Could you check that this machine follows the long list of requirements to run the java binary ? You may find useful information on the IBM java package webpage I guess...
Do you have lsof binaries or any other standard debuging tool ? lsof would point to any problem related to your AIX machine
HTH
Jerome
We have an intermittent similar issue with Java on Solaris. Sometimes rebooting the machine helps. Other times we have to remove the .java file from the user's home directory. Very random and annoying. The box can be up for months before it happens, or mere hours...

Unable to use aspnet_regiis encrypt web.config in windows 7/2008 environment

I used aspnet_regiis successfully encrypted web.config file which running on windows 2003 server. However it doesn't work in IIS 7 on Windows 7/2008 server.
When I try to run the followng command in 64bit Windows 2008 server, it always shows the aspnet_regiis options help. The same thing is in windows 7 OS.
C:\Windows\Microsoft.Net\Framework64\v2.0.50727\aspnet_regiis –pe “appSettings” –app “/ConnectionTest” –site 4
If I open Visual Studio 2008 command in windows 7 and run the following command, I got those. I use the site Id from iis manager.
aspnet_regiis –pe “appSettings” –app “/ConnectionTest” –site 4
Failed to resolve the site ID for '4'
Failed!
Have you tried running a command window "As Administrator"? This just caught me out for a moment too but running as admin fixed it.
I was getting this error even after running command prompt as an administrator. But I observed that the virtual directory in my case had multiple words separated by dot. Like "Web.Api.XYZApi".
I changed the virtual directory name to "XYZApi" (without the dots) and tried encrypting and it worked. But I'm still not sure why that should be an issue.

Resources