Deployment of play 2.2.3 application in glassfish 3.1 - glassfish-3

I tried to build a war for play 2.2.3 application to deploy in glassfish server using play2war plugin. I followed the steps in
https://github.com/play2war/play2-war-plugin/wiki/Configuration.
But its not worked.
How to deploy play 2.2.3 application in glassfish server 3.1. Please help..

There seems to be compatibility issue of Play 2.2.3 using play2war deployment on Glassfish 3. I get error as below:
Exception: java.lang.ClassCircularityError thrown from the UncaughtExceptionHandler in thread "Grizzly-kernel-thread(1)"
Sorry I do not know the fix, but using the same war deploys fine on Glassfish 4
For Play2War, it runs the best on Apache tomcat servers based on my simple tests

To install play framework on glassfish (3 or 4) follow step by step the ssh codes:
For glassfish home dir /your_path/glassfish4/glassfish/domains/domain1/lib/
1) Download and unzip glassfish:
unzip glassfish-4.1*zip
rm -rf rm -rf glassfish-4.1.zip
2) Download and Unzip Play framework (jars)
unzip play-2.2.6.zip
rm -rf play-2.2.6.zip
3) Extract it to your glassfish domain lib dir:
find play-2.2.6/repository/local/ '*.jar' -exec cp -vuni '{}'
"glassfish4/glassfish/domains/domain1/lib/" ";"
find play-2.2.6/repository/local/ -iname *.jar -exec cp {} glassfish4/glassfish/domains/domain1/lib/ \;
rm -rf play-2.2.6
4) Download new activator to create new application.conf file:
unzip typesafe-activator-1.2.12-minimal.zip
rm -rf typesafe-activator-1.2.12-minimal.zip
cd activator-1.2.12-minimal
./activator new sport-api play-scala
cd ..
5) Stop and start your glassfish
glassfish4/glassfish/bin/asadmin stop-domain
glassfish4/glassfish/bin/asadmin start-domain
6) Add custom variable to glassfish:
glassfish4/glassfish/bin/asadmin create-jvm-options -Dconfig.file=/your_path/sport-api/conf/application.conf
7) Done! Deploy your .war file using play framework features.
Obs: You can download this project "play 4 glassfish" with custom sh installer for glassfish 4.1. More features for future.
https://github.com/rbsdev/play4glassfish.git

Related

How to use dotnet core on docker dotnet framework image

As per title, I want to use dotnet core on dotnet framework aspnet image. A little bit of background, I have ASP.NET (4.6) application with dotnet core libraries. Currently it is running on IIS. Now, I'm looking forward to dockerize this by using windows server core image. No particular reason, just looking to dockerize and modernize legacy application.
I'm started with this image: mcr.microsoft.com/dotnet/framework/sdk
And I'm using this image as runtime: mcr.microsoft.com/dotnet/framework/aspnet
Problem is during runtime, the IIS inside aspnet doesn't recognize aspnetmodule. In IIS we normally install hosting bundle, how to do this on docker?
Thank you
Just for record keeping, am sharing this. What I did was I take the images from Microsoft and add installation for Hosting bundle. In this case, I'm using dotnet core 1.1:
# escape=`
ARG REPO=mcr.microsoft.com/dotnet/framework/runtime
FROM $REPO:4.8-windowsservercore-ltsc2019
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
ADD dotnetcore.1.0.16_1.1.13-windowshosting.exe /install/
RUN Add-WindowsFeature Web-Server; `
Add-WindowsFeature NET-Framework-45-ASPNET; `
Add-WindowsFeature Web-Asp-Net45; `
Remove-Item -Recurse C:\inetpub\wwwroot\*; `
Invoke-WebRequest -Uri https://dotnetbinaries.blob.core.windows.net/servicemonitor/2.0.1.6/ServiceMonitor.exe -OutFile C:\ServiceMonitor.exe
# Install Roslyn compilers and ngen binaries
RUN Invoke-WebRequest https://api.nuget.org/packages/microsoft.net.compilers.2.9.0.nupkg -OutFile c:\microsoft.net.compilers.2.9.0.zip; `
Expand-Archive -Path c:\microsoft.net.compilers.2.9.0.zip -DestinationPath c:\RoslynCompilers; `
Remove-Item c:\microsoft.net.compilers.2.9.0.zip -Force; `
&C:\install\dotnetcore.1.0.16_1.1.13-windowshosting.exe /install /quiet | `
&C:\Windows\Microsoft.NET\Framework64\v4.0.30319\ngen.exe install c:\RoslynCompilers\tools\csc.exe /ExeConfig:c:\RoslynCompilers\tools\csc.exe | `
&C:\Windows\Microsoft.NET\Framework64\v4.0.30319\ngen.exe install c:\RoslynCompilers\tools\vbc.exe /ExeConfig:c:\RoslynCompilers\tools\vbc.exe | `
&C:\Windows\Microsoft.NET\Framework64\v4.0.30319\ngen.exe install c:\RoslynCompilers\tools\VBCSCompiler.exe /ExeConfig:c:\RoslynCompilers\tools\VBCSCompiler.exe | `
&C:\Windows\Microsoft.NET\Framework\v4.0.30319\ngen.exe install c:\RoslynCompilers\tools\csc.exe /ExeConfig:c:\RoslynCompilers\tools\csc.exe | `
&C:\Windows\Microsoft.NET\Framework\v4.0.30319\ngen.exe install c:\RoslynCompilers\tools\vbc.exe /ExeConfig:c:\RoslynCompilers\tools\vbc.exe | `
&C:\Windows\Microsoft.NET\Framework\v4.0.30319\ngen.exe install c:\RoslynCompilers\tools\VBCSCompiler.exe /ExeConfig:c:\RoslynCompilers\tools\VBCSCompiler.exe
ENV ROSLYN_COMPILER_LOCATION c:\\RoslynCompilers\\tools
EXPOSE 80
ENTRYPOINT ["C:\\ServiceMonitor.exe", "w3svc"]
I have no way to automate download for hosting bundle. You may need to download it from microsoft site: https://dotnet.microsoft.com/download/dotnet-core/2.2, choose runtime and hosting bundle.
Put it together with the Dockerfile so Docker can copy it into the image. This image can run on Windows Server 2019. For other version of Windows Server, you may need to use different tag.
P/S: Hosting bundle installation is a bit tricky, I used to extend the
image but somehow the installation become ephemeral and lost. This is
working for me, hope this helps.
Find download link of the .NET Core SDK you need here https://dotnet.microsoft.com/download/dotnet-core.
Here is sample for .NET Core 2.2
FROM mcr.microsoft.com/dotnet/framework/runtime:4.7.2 AS runtime
# Replace download URL with .NET Core SDK you need.
ADD https://download.visualstudio.microsoft.com/download/pr/7ae62589-2bc1-412d-a653-5336cff54194/b573c4b135280fb369e671a8f477163a/dotnet-sdk-2.2.100-win-x64.exe c:/setup
RUN C:/setup/dotnet-sdk-2.2.100-win-x64.exe /install /quiet
ENTRYPOINT ["dotnet", "YOUR_NET_CORE_DLL_NAME.dll"]

How to deploy a javafx app as an image bundle without many dlls in the root folder on windows

On https://docs.oracle.com/javafx/2/deployment/self-contained-packaging.htm and more specifically this image: https://docs.oracle.com/javafx/2/deployment/img/bundle_file_struc.png
You can see a windows deployed image bundle with only an executable and a couple of other files in the root folder. When I deploy an app using the following commands (EDIT: using oracle jdk 8), I get many dlls in the root directory (50+):
mkdir classes
javac -d classes/ src/helloworld/HelloWorld.java
javapackager -createjar -appclass helloworld.HelloWorld -srcdir classes/ -outdir out -outfile outjar -v
javapackager -deploy -native image -srcfiles out/outjar.jar -appclass helloworld.HelloWorld -outdir out -outfile test
I want to get rid of the dlls because they are confusing users by making the executable hard to find. Is it possible, and how ? This is for deploying a javafx app on windows

How can I uninstall dotnet core from macOS Sierra

I have tried to install dotnet core, but it does not worked. So, I would like to uninstall it and start refresh. How can I uninstall dotnet core from macOS Sierra(10.12.3).
you can find below, existing dotnet core info on the system
/usr/local/share/dotnet/sdk$ ls -la
total 0
drwxr-xr-x 4 root wheel 136 May 20 18:28 .
drwxr-xr-x 10 root wheel 340 May 20 20:44 ..
drwxr-xr-x 142 root wheel 4828 May 20 20:44 1.0.4
drwxr-xr-x 121 root wheel 4114 May 9 23:04 2.0.0-preview1-005977
/usr/local/share/dotnet/sdk$ sudo find / -name dotnet
find: /dev/fd/sdk: No such file or directory
find: /dev/fd/sdk: No such file or directory
/private/etc/paths.d/dotnet
/Users/melihtt/.dotnet/NuGetFallbackFolder/microsoft.codeanalysis.analyzers/1.1.0/analyzers/dotnet
/Users/melihtt/.dotnet/optimizationdata/2.0.0-preview1-005977/osx.10.12-x64/dotnet
/usr/local/share/dotnet
/usr/local/share/dotnet/dotnet
/usr/local/share/dotnet/shared/Microsoft.NETCore.App/1.0.5/dotnet
/usr/local/share/dotnet/shared/Microsoft.NETCore.App/1.1.2/dotnet
To uninstall dotnet core from macOS:
download dotnet-uninstall-pkgs.sh from https://github.com/dotnet/sdk/blob/main/scripts/obtain/uninstall/dotnet-uninstall-pkgs.sh
make dotnet-uninstall-pkgs.sh executable
execute dotnet-uninstall-pkgs.sh as root (requires superuser privileges to run).
curl -O https://raw.githubusercontent.com/dotnet/sdk/main/scripts/obtain/uninstall/dotnet-uninstall-pkgs.sh
chmod u+x dotnet-uninstall-pkgs.sh
sudo ./dotnet-uninstall-pkgs.sh
If you are using the M1 Mac
Confirm your cpu architecture
ls /usr/local/share/dotnet/
This may be x64 or x86. Set a variable to store the cpu arch
arch="x64"
Confirm your dotnet version
dotnet --version
Set a variable to store the version
version="5.0.403"
Run the following commands
sudo rm -rf /usr/local/share/dotnet/$arch/sdk/$version
sudo rm -rf /usr/local/share/dotnet/$arch/shared/Microsoft.NETCore.App/$version
sudo rm -rf /usr/local/share/dotnet/$arch/shared/Microsoft.AspNetCore.All/$version
sudo rm -rf /usr/local/share/dotnet/$arch/shared/Microsoft.AspNetCore.App/$version
sudo rm -rf /usr/local/share/dotnet/$arch/host/fxr/$version
Some of the above folders may not exist but that is fine. Confirm that no dotnet sdk is still present
ls /usr/local/share/dotnet/$arch/sdk/
dotnet --version
To uninstall dotnet core from MacOS, using dotnet-uninstall-tool.
Download the tool Here
Open terminal and change working directory to where the file (dotnet-core-uninstall.tar.gz) is located.
Install the Tool using following commands.
1. mkdir -p ~/dotnet-core-uninstall
2. tar -zxf dotnet-core-uninstall.tar.gz -C ~/dotnet-core-uninstall
3. cd ~/dotnet-core-uninstall
show help: ./dotnet-core-uninstall -h
./dotnet-core-uninstall list
Using this command you can check the list of .NET Core SDKS or Runtime that can be removed with this tool.
./dotnet-core-uninstall remove --sdk/--runtime version --force
Eg: For remove SDK 5.0.100
./dotnet-core-uninstall remove --sdk 5.0.100 --force
If you face any Privilege issue add sudo in front of the command
Give the user Key (Password).
(Do you want to continue) hit the "Y" then enter.
Check & conform the SDK list
You might as well use dotnet-core-uninstall tool which allow you to select a specific SDK or runtime version to remove. github docs
If you are experiencing issues with building Xamarin.Mac after installing preview version of .Net 5 SDK you might like to remove Mono using such script and Visual Studio like this and try to reinstall from scratch
good luck

Compile multiple dotnet core projects in one step using dotnet cli

Assuming this folder structure
SampleApp
global.json
Src
Web
project.json
Startup.cs
...
Model
project.json
Startup.cs
...
how does one compile both projects using dotnet? (from command line, not in visual studio)
If you run dotnet build at the root folder level you get
Could not find file .. project.json
I can see there is this outstanding enhancement on the CLI repo but that is from Feb2.
Any script would have to take dependencies into account before just blindly calling dotnet on all src sub-folders.
The dotnet build command accepts glob patterns. So you can do this:
dotnet build Src/**/project.json
There's no such a tool yet. Even KoreBuild, the tool that the ASP.NET team uses, goes blindly in each folder and invokes dotnet build/pack.
The nice thing is that dotnet build is now smart enough to not recompile the dependencies if they haven't changed, so that's not a problem anymore.
For linux I'm using:
for p in $(find . -name *.csproj); do dotnet build $p; done
I had a similar requirement. This is my workaround:
#echo off
for /D %%d in (*) do (
cd %%d
cd
dotnet restore
dotnet build
cd ..
)
exit /b
Use GNU Make. I use it to build my projects. all you have to do create a Makefile in your project root folder. You can nest Makefiles in directories and have a Top Level Makefile that runs the subdirectories. then you set up Makefiles for each of your "Sub Projects" folders and run any comandline tool. with dotnet core is is dotnet .
Wait... GNU - "GNU is not Unix" that's a Unix/Linux application... I run windows. Well the good news is you can do this is in windows. I'm using make.exe through my git-bash installation (git for windows). You will have to go find the cygwin port of make. (google: "make for git-bash") Then install it to your bin directory under the cygwin folder. You could also just install cygwin if you really wanted to.
The nice thing about using Gnu-Make is it is universal. Since dotnet core is platform agnostic, every environment Mac/FreeBSD/Linux have "make" most likely already installed. Adding it to your Windows machine and projects to me makes a lot of sense. Since you project can now be built by everyone the same way.
some of my projects need to build docker containers with dockerfiles, or snap packages, deploy to test, etc... Make (pardon the pun) makes it easy.
Here is a sample of simple projects Makefile. Running 'make' by itself is like saying 'make all' you could set up a command like 'cd ./subdir; make' as one of your .phoney directives. (Google: "Makefile documentation")
project_drive?=/c/prj
nuget_repo_name?=Local_Nuget_Packages
local_nuget_dir?=$(project_drive)/$(nuget_repo_name)
RELEASE_VERSION:= `grep "<Version>" *.csproj | cut -d '>' -f 2 | cut -d '<' -f 1`
.PHONEY: clean release test doc nuget install debug_nuget debug_install
all: doc MSBuild
test:
./test.sh
MSBuild:
dotnet build
clean:
dotnet clean; dotnet restore
release:
dotnet build -c Release
doc:
doxygen ./Doxyfile.config
nuget: release
dotnet pack -c Release
install:
cp ./bin/Release/*.$(RELEASE_VERSION).nupkg $(local_nuget_dir)
debug_nuget: MSBuild
dotnet pack
debug_install:
cp ./bin/debug/*.$(RELEASE_VERSION).nupkg $(local_nuget_dir)
What's missing is that you can also use the commands on project.sln files if you do not have project.json
dotnet build src/**/project.json
-- or --
dotnet build src/project.sln
same goes for dotnet test

meteor bundled application redirects to ssl

My meteor project gets bundled with a script and run with forever. Until now, the process used to work fine but for my last project it does not work.
I setup a clean server with no httpd process running to be sure there is no interference.
there are no errors but when I go to my application on http://dev.sertal.ch:4020 I get redirected to https://dev.sertal.ch
This is the bundle script:
#!/bin/bash
cd /root/projects/tablet-reporting/app
git pull
rm -Rf /opt/sertal/tablet-reporting-test
rm -f /opt/sertal/tablet-reporting-test.tgz
meteor bundle /opt/sertal/tablet-reporting-test.tgz
cd /opt/sertal
tar -xvzf tablet-reporting-test.tgz
mv bundle tablet-reporting-test
cd /opt/sertal/tablet-reporting-test/programs/server/node_modules
rm -Rf fibers
npm install fibers
this is how the app is started:
MONGO_URL="mongodb://localhost:27017/tablet-reporting-test" PORT=4020 ROOT_URL="http://dev.sertal.ch:4020" node tablet-reporting-test/main.js
it says
LISTENING
You might have the force-ssl package installed.
meteor remove force-ssl
Then rebundle and redeploy. Please let know if it doesn't work it might be some proxy thing instead.

Resources