Does'nt Liferay work at different ports? - liferay

I have developed a portal page using Liferay and the port number is 8080. I wanted to test SSO, I decided not to try with the existing one as there might be some problems and I might end up crashing the whole thing. As a result I downloaded a new liferay portal. Iadded it to the eclipse and ran the second server whose port number was changed to 8085. But the webpage displayed when the second server ran was still 8080 and the same page as the first portal. Later I downloaded the enterprise edition and did the same, still 8080: 1st portal. I changed the plugins, no progress. Later, I changed the port number of first one to 8090. The page was not being displayed at all. Why is it like this? I don't get it. Does liferay work with a single port or can't there be two Liferay portal at a time?

You can always navigate to exactly the port that you configure - given that the appserver actually serves connections to the port. Common mistakes that I see (assuming you're running tomcat):
People change server.xml to refer 8080 to 8090, but leave the other ports (8005 and 8009) untouched. This means that there are conflicts with two tomcats. If you run both tomcats at the same time, the second one will not start, because another program is already listening to 8005 and/or 8009). You'll need to change all ports to unique values (search server.xml for all declarations of port=
You're relying on the browser to automatically open. Liferay's portal-ext.properties allows to override the page to automatically open - either to being empty or to a specific other URL. Configure browser.launcher.url to your requirements (see below)
There might be other servers running on either port that you're trying to have tomcat - or any other appserver - listening on.
(Here's the default for browser.launcher.url)
# Enter a URL to automatically launch a browser to that URL when the portal
# has fully initialized. Enter a blank URL to disable this feature.
#
browser.launcher.url=http://localhost:8080

Related

linux redirect localhost port to url port

I need to redirect localhost:8080 to http://url:8080/.
Some background:
I am using docker swarm stack services. One service (MAPS) creates a simple http server that lists xml files to port 8080 and another service (WAS) uses WebSphere Application Server that has a connector that uses these files, to be more precise it calls upon a file maps.xml that has the urls of the other files as http://localhost:8080/<file-name>.xml.
I know docker allows me to call on the service name and port within the services, thus I can use curl http://MAPS:8080/ from inside my WAS service and it outputs my list of xml files.
However, this will not always be true. The prod team may change the port number they want to publish or they might update the maps.xml file and forget to change localhost:8080 to MAPS:8080.
Is there a way to make it so any call to localhost:8080 gets redirected to another url, preferrably using a configuration file? I also need it to be lightweight since the WAS service is already quite heavy and I can't make it too large to deploy.
Solutions I tried:
iptables: Installed it on the WAS service container but when I tried using it it said my kernel was outdated
tinyproxy: Tried setting it up as a reverse proxy but I couldn't make it work
ncat with inetd: Tried to use this solution but it also didn't work
I am NO expert so please excuse any noob mistakes I made. And thanks in advance!
It is generally not a good idea to redirect localhost to another location as it might disrupt your local environment in surprising ways. Many packages depend on localhost being localhost :-)
it is possible to add MAPS to your hosts file (/etc/hosts) giving it the address of maps.

Accessing NodeJS server from remote machine on local network shows a blank page

I wanted to test my ReactJS + NodeJS website on another machine on my LAN, so I changed the server host ip from localhost to 0.0.0.0 as described in this answer. I noticed that although I could access the server from a remote machine, all I could see was the title and favicon (the rest was a blank page). I tried another approach of using the ngrok module as described here (which happens to be the answer to the same question as the previous link). I still got the same blank page.
The GET requests to the server are shown below (as shown by ngrok).
/landing is a page I was trying to access. Can someone explain whats happening?
PS: The server is running on a Mac and I'm trying to access the page on an Ubuntu machine. Also, I'm using this react-redux boilerplate. Webpack is also being used along with hot reloading.
Did you try changing port settings in firewall?
Go to firewall settings and allow the respective port for inbound

GPE for Juno overwrites arguments in run config

I'm using GPE (GWT 2.5 plugin) on Eclipse Juno and it looks like the content of the arguments tab gets overwritten each time I perform the apply button. Only workaround is to edit the arguments tab last and then close the dialog. I have to set a different port number, but the port attribute gets deleted as mentioned above. I don't use embedded server.
TIA
ujbi
What port number are you setting? If you're setting it to the default port number expected for that server, it will be removed from the Arguments tab.
Have you tried changing the port number in the Launch Config UI? There should be a tab for "Server", where you can change the port.
#Rajeev
I dont't use the default port (8888) and I dont' want to use the embedded server, so this is not checked in the 'server' tab. The application is running on a JBoss Server on port 8080.
When I add this via '-port 8080' in the 'Arguments' tab it will be romved mostly.

Liferay's PortalUtil.getPortalURL troubles

I'm having problems understanding a line of code and the Liferay API documentation doesn't give details. The lines is this one:
StringBuilder url = new StringBuilder(PortalUtil.getPortalURL(cp.getVirtualHost(), PortalUtil.getPortalPort(), false));
I know the first parameter gets its value from the virtual host in the main configuration, and the third one if set to true gets you a https URL, but i don't know from where its getting the port, also when the port is 80 it doesn't get added to the url.
What i need is that the port doesn't show even if its different from 80, any ideas?
As far as I understand this is common line of code to determine URL of Liferay Portal in a portlet or a hook plugin.
I think, the port is simply determined from the current request.
The reason why port 80 isn't showing is because it's standart HTTP port and it will be used by default. So you can't hide port from URL if it's different from 80 (or 443 for secure connection).

MVC4 Website/Web Application Recommended IIS Directory Structure

I have an MVC4 web application
In setting it up on IIS7.5 I added the application to the "Default Website" and set up a virtual directory under http://localhost/myApplication
However, this forced me to change many of my controller calls (specifically js ajax calls) which I previously called in Cassini like "/Home/Index", I now had to change them to "/myApplication/Home/Index" for them to work on my local IIS.
NOW, when I publish it to a remote hosting server I have to change it BACK to "/Home/Index" for it to work.
This cannot be the most productive way to traverse the development -> testing -> production cycle.. What step am I missing?
I tried to create the applications virtual directory on on just http://localhost/ without appending the application name so that I can call "/Home/Index" at all three stages but it complains that http://localhost/ is already mapped to inetpub/wwwroot.
Thanks for your time.
The steps are like this:
Publish your website to a new folder in inetpub/wwwroot (or the place where your applications are kept) like "inetpub/wwwroot/myapp"
Go to IIS management, create a new web-site, assign it any free port (like 11001 or something, > 1024 at least) and point it to a folder from the step 1. Bind it to all IP addresses available or to 127.0.0.1
Start the web-site.
Access it using http://localhost:11001/ (or any other port you've set)
Problem is that by default any browser uses port 80 to request a web page, and that port is taken by the default web-site. You have to manually override it or create a site on another port. IIS usually warns you about port collisions.
If you don't want to have port number in the address, alternatively you can work with host header on port 80. You may have to make local host entry for the host header given to the site.

Resources