Access Jboss war deployment over internet - jboss

I have Jboss application server 7 running in a windows 2008 server. I have a war file that I’ve deployed to Jboss that contains a webpage. I can access this webpage ,locally , by using the url
http://localhost:8080/test/page1.jsf.
However I can’t access it externally
http://<Ipaddress>:8080/test/page1.jsf
does not work.
I have my Jboss folder in my intepub/root folder, where I can access webpages and text files through my url
http://<Ipaddress>:8080/<documentname>
What steps do I have to take to be able to access content in my war file.
My server is accepting http on 8080, but does Jboss need to be configured in some way?
This is very confusing as I expected this to just happen automatically and not be this much of an issue
Edit
I tried editing my standalone.xml with the following and it still isn't working.
<interfaces>
<interface name="management">
<inet-address value="${jboss.bind.address.management:127.0.0.1}"/>
</interface>
<interface name="public">
<any-ipv4-address/>
</interface>
<interface name="unsecure">
<inet-address value="${jboss.bind.address.unsecure:127.0.0.1}"/>
</interface>
</interfaces>

It depends how you start the JBoss service. Make sure you always provide the IP of your server in order to access from anywhere using the -b <ip> command when starting the server: #> start.bat -b 127.0.0.1. Refer to here for more options when starting JBoss service.

Related

Deploy Server hosted Blazor .NET6 to traditional webhost

I have created a Server hosted Blazor web application with .NET6. Now I want to publish to my web hotel that runs Windows Servers. I interact with them through a Plesk platform. They implicitly use IIS under the hood. I have an FTP area to deploy to which works fine for the other webs I have created before.
I use Rider so I don't have any fancy publishing wizards like Visual Studio, but I assume it should work fine using plain dotnet commands as well.
I ran the dotnet publish command and get the publish folder that I read should be enough for deployment. Then i copied all content to the FTP area and hoped everything would just work. It did not.
I have some specific questions:
Does Blazor .NET6 demands a special version of underlying IIS?
The server has Framework 4.7.2 installed but if I use a self contained deployment I guess the server installed version doesn't matter? I assumed the necessary .NET version will be included in the publish?
I notice to my surprise that all my appsettings files are included in the publish content. I assumed the relevant appsettings would be merged into one that should be used for production. How should that be handled?
It seems all Microsoft deployment guides assume Azure. In my company I can not use that. We are left with the traditional hosting.
Now I have solved my problems! The most crucial part was to enable full error printouts on server web by setting an environment flag. It was NOT documented on the publish page with command switches but was very helpful in finding the cause of my problems.
By adding a switch to the publish command a new section is added to the resulting web.config file:
dotnet publish --framework net6.0 --configuration Release /p:EnvironmentName=Development
This will add the environmentVariables section under aspNetCore:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\SqueedEmployee.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess">
<environmentVariables>
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
</environmentVariables>
</aspNetCore>
</system.webServer>
</location>
</configuration>
You can indeed deploy self-contained which means all assemblies you need are included. Everything is included in the \bin\Release\net6.0\publish folder. Just copy to FTP area.
See above.
I am still a bit confused how the appsettings should be handled.
Conclusion is that traditional hosting works fine :)

Something wrong with my web.config file while hosting web service

To give some context:
I'm trying to deploy a webservice I built, within visual studio you have the option to use 'Folder Deployment', I am using this option and that deployment allows me to make a build within a folder that has an executable which works like a charm when I'm using it on localhost but because my webservice needs to be used through a network, I need to deploy it to IIS which gives me some challenges.
I'm trying to host my RESTful API web service on the IIS server as explained in this article: https://www.c-sharpcorner.com/article/publishing-asp-net-web-api-rest-service-using-file-system-method/ but every time I add it to the server, and try surfing to the site I get the following error page: HTTP Error 500.19 - Internal Server Error --> 0x8007000d which apparantly tells me that something is wrong with my web.config file but I never touched that during my development..... perhaps you guys see something odd as here is my web.config file:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\Flame_webservice.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
<!--ProjectGuid: 21d59c04-6877-4549-9ff7-c37f07155f97-->
After searching for solutions I already found several articles that suggested installing things but it doesn't seem to do the trick for me, the following article I have tried:
Web Application Problems (web.config errors) HTTP 500.19 with IIS7.5 and ASP.NET v2
I don't think I'm using AJAX but maybe I am so I haven't tried that yet.
My webservice contains 3 controllers which are essentially websites but I don't see an explicit route to the websites in the web.config file, I'm not sure if that can cause issues?
I will continue searching but it's becoming a pretty rough ride at the moment due to my limited experience with hosting web services. Or am I perhaps using IIS while I shouldn't? I mean I've tried turning off my firewall and reaching the executable running on localhost through my IP address but it doesn't seem to work which led me to believe I needed a server to reach the running web service on my local machine.
I had the same exact issue and what helped was:
installing .net core windows hosting on the server.
Install-Package Microsoft.Extensions.Hosting -Version 3.1.10

How to create IIS-website from powershell in order to host .net core 2.0 app, error 0x8007000d

Expected Result:
IIS hosts my app correctly, and when I navigate to the url of my app (e.g: blabla/swagger) I see the swagger UI describing my app
Problem:
When I try to navigate to my app it says:
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
Information
I built an app in .net core 2.0 and I am able to make it run through visual studio, being hosted by Kestrel.
However I need to deploy this app to different servers and since Kestrel doesn't support host names, I need to make it being hosted in IIS . When I make it run through Kestrel I am able to access it correctly and by navigating to the url/swagger address, I am able to see the correct swagger page that describes the app.
My app is being published from visual studio. Which means in its published folder there are all the dlls that the app needs. It's being published as a framework dependent app, not a standalone one, but this shouldn't matter.
How to replicate the problem
Since I need this one day to be hosted in IIS inside a Docker container, I am trying to make it being hosted in IIS with powershell scripts. What I did to make it being hosted in IIS is:
New-Website -Name 'myTestApp' -force -Port 8080 -PhysicalPath
'C:\Users\myUser\Desktop\Docker\PublishOutput' -ApplicationPool 'MyAppPoolTest'
Where C:\Users\myUser\Desktop\Docker\PublishOutput is the path to the published folder where Visual Studio publishes the app. Thanks in advance!
This is the web.config generated by Visual studio when publishing:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\Friss.CaseApi.Web.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</configuration>
<!--ProjectGuid: 313d542d-7676-4440-ae1b-22c6071f4309-->
And the error page is:
Am I setting the web.config in the wrong way?
Check the documentation here
You need to publish your website and then point IIS website to the published folder
Application pool must be set to No Managed code
Application Pool identity user IIS AppPool\{AppPoolName} must have read permissions on the published website folder
Found the solution,
the system requires the dotnet core windows hosting bundle. The bundle installs the .NET Core Runtime, .NET Core Library, and the ASP.NET Core Module.
Documentation: https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-2.1&tabs=aspnetcore2x
Direct download to the bundle for .netcore 2.0.6 that solved my problem:https://download.microsoft.com/download/8/D/A/8DA04DA7-565B-4372-BBCE-D44C7809A467/DotNetCore.2.0.6-1-WindowsHosting.exe

JBoss as an http server?

I'm trying to write a webapp where the server side provides only json/REST services, and the gui is written in html5, backbone, marionette, etc. using async XHR. The html, js, css, etc. is static and cachable (when deployed to production).
I need to deploy this to JBoss EAP6 (broadly equivalent to AS7 for this problem). During development I'd like to be able to edit my javascript and html templates and have the results instantly visible in the browser. In production I need my static content (the front end) to be exploded and not deployed in any type of Java EE structure (so, no war or ear (or sar)).
So, basically, I need to deploy wars to jboss, as usual, and I also need jboss to act as an http server for the static part of the app.
I have played with the idea of copying my content into the welcome-content directory in the root of EAP6. While this serves the content with no problem I can't work with this structure for development because I can't live with the time overhead of copying my changes across to a different directory. I have also tried a symlink from welcome-content to my static content in the dev environment, but this doesn't work in this version of jboss.
Edit: I have answers that are telling me how to work around the problem, but I'm not really stuck for a workaround -- that's easy. I'm really looking specifically for how to configure jboss to serve static content.
TIA.
You could just deploy the static html/css/js like you normally would, and use a tool to inject changes into the DOM for you in real time. I'm doing this with GruntJS now using grunt-contrib-watch and it works pretty well.
Update for JBoss EAP 7.x
Just to complement the answer by Zach Lysobey, JBoss EAP 7.x has Undertow was underlining https/2 server. It has therefore it's own properties and has as basic properties below:
<subsystem xmlns="urn:jboss:domain:undertow:1.0">
<buffer-caches>
<buffer-cache name="default" buffer-size="1024" buffers-per-region="1024" max-regions="10"/>
</buffer-caches>
<server name="default-server">
<http-listener name="default" socket-binding="http" />
<host name="default-host" alias="localhost">
<location name="/" handler="welcome-content" />
</host>
</server>
<servlet-container name="default" default-buffer-cache="default" stack-trace-on-error="local-only" >
<jsp-config/>
<persistent-sessions/>
</servlet-container>
<handlers>
<file name="welcome-content" path="${jboss.home.dir}/welcome-content" directory-listing="true"/>
</handlers>
</subsystem>
Reference: Undertow.io
Cli commands
You can therefore change the properties using the CLI command and subsystem=undertow:
/subsystem=undertow/server=default-server/http-listener=default:write-attribute(name=url-charset,value="utf-8")
Static content in Undertow
This other question describes a similar situation and the official documentation describes a file handler for serving static files.
Cli command to create a file handler:
/subsystem=undertow/configuration=handler/file=new-file-handler:add(path="${jboss.home.dir}/welcome-content")
Update
TL;DR
I presume that the original issue is long resolved now after more than 5 years since it was asked. If someone really insists on using JBoss as static file web server, then the solution mentioned in the question is THE solution - using welcome-content directory. With EAP6 you must have an active paid subscription from RedHat to use it in production, and their knowledge base does provide the same answer.
As its not 2013 anymore, copying a bunch of static files really should not be an issue, and most IDEs can handle that quite well(only copying the files that changed etc).
For everyone else coming here from google, it is IMHO more beneficial to point to the right tools for the job and separate backend and frontend deployment(btw Nginx was available long before 2013, and Apache has been here, well, since forever :) ).
Although it is possible to host your static web assets via JBoss, it is a rather inefficient use of java web server. As your Frontend is completely separated from you java backend, why not deploy it to dedicated web server - Nginx or Apache for example, which is going to be vastly more efficient and suitable for serving static content.(Or a dedicated Wildfly w/ Undertow if you must)
You do not specify, if you only have a single JBoss instance or a more complex deployment but one common scenario for a usecase like yours goes like this:
[Nginx server:80] <--> [JBoss server:8080]
- location / { |- your-backend.war
root /path/to/frontend (web context /myapp/api)
}
- location /api {
proxy_pass http://backend
}
Head over to Nginx documentation for more info.
Advantages of using dedicated web server:
You can use it as load balancer at the same time, just add more Jboss instances, update the upstream config and you have scalable backend, yey
Deployment of your Frontend is simply a copy of static files to the corresponding folder - no need for restart, you can configure the paths to suit your folder structure.
Nginx(or well configured Apache) can handle extreme load with ease, it uses event mechanism instead of threads, + you can fiddle with caching strategies etc
You alleviate your java web server from the overhead of serving static web assets, and you can tune it for what it does best- server your java web service
You can deploy multiple web frontends or multiple projects, with different hostname, so you can host dev and test versions of your app on a same physical server and bind them to for exampe https://dev.myapp.com and https://test.myapp.com
You can use Web server for SSl offloading - again, alleviating your JBoss app server from the burden of SSL handling.

How to remote deploy an application in weblogic?

I have two computers , I don't want to install weblogic and oracle in my development computer, they consume too much memory, the problem is how can I deploy my application on development computer to another free computer which has oracle and weblogic installed ? I am using weblogic 10.3.
I don't want to install weblogic and oracle in my development computer , they consume too much memory
Even when not running?
how can I deploy my application from my development machine to another machine which has oracle and weblogic installed
You can use the following tools:
webLogic.Deployer (see the weblogic.Deployer Command Line Reference)
Admin Console
wldeploy, the Ant Task version of the weblogic.Deployer (see the wldeploy Ant Task Reference)
WLST (see Deploying Applications in the WebLogic Scripting Tool documentation).
Other options (if you are using maven):
weblogic maven plugin (no feedback to give you except that I wouldn't use it)
cargo maven plugin (doesn't support deployment to remote weblogic)
If you use the Ant Task, then be sure and include the upload="true" parameter. This will copy the war, ear file to the remote weblogic system so you don't have to.
Wldeploy works like a charm. The configuration looks like this.
<target name="deploy">
<wl.deploy.app archivepath="${ear.path}" name="${ear.deployment.name}"
wladminuser="${weblogic.admin.user}" wlserverhost="${weblogic.server.host}"
wlserverport="${weblogic.server.port}" wlservername="${test.server.name}"
wladminpassword="${weblogic.admin.password}"/>
</target>
<macrodef name="wl.deploy.app">
<attribute name="archivepath"/>
<attribute name="name"/>
<attribute name="wladminuser"/>
<attribute name="wladminpassword"/>
<attribute name="wlserverhost"/>
<attribute name="wlserverport"/>
<attribute name="wlservername"/>
<attribute name="sharedlibrary" default="false"/>
<sequential>
<wldeploy action="deploy" verbose="true" debug="true"
name="#{name}"
library="#{sharedlibrary}"
remote="true"
upload="true"
source="#{archivepath}"
user="#{wladminuser}" password="#{wladminpassword}"
adminurl="t3://#{wlserverhost}:#{wlserverport}"
targets="#{wlservername}"/>
</sequential>
</macrodef>
Just specify all the properties correctly be it localhost or a remote machine. It should work.
You can deploy WebLogic Application using REST Interface (I am not sure, if it is available for all the WLS versions).
REST interface must be enabled over Admin Console (server restart needed):
Settings / Configuration / General [Advanced] / Enable RESTful Management Services
It is actually a JSON based REST interface, but if you need to upload something, multipart/form-data is used instead.
It works like this (tested on WLS v12.2.1.4):
curl -X POST 'http://<server>:7001/management/weblogic/latest/edit/appDeployments'
-u <username>:<password>
--header 'Content-Type: multipart/form-data'
--header 'X-Requested-By: <any_string>'
--form 'sourcePath=#<local_path_to_war_file>'
--form 'model={"name": "<application_name>"}'
--form 'planPath=#<local_path_to_plan_xml_file>'
Don't forget X-Requested-By. WebLogic requires as CSRF protection.
API Documentation for WLS version 14
https://docs.oracle.com/en/middleware/standalone/weblogic-server/14.1.1.0/wlrer/index.html
API Documentation for WLS version 12: https://docs.oracle.com/en/middleware/fusion-middleware/weblogic-server/12.2.1.4/wlrem/index.html