Unable to change runtime environment on server in Liferay Developer Studio - liferay

In Liferay Developer Studio, I am try to set the Runtime Environment for my local server. After selecting a runtime environment from the drop down, I then try to save the change and get the following message:
The server cannot be saved for the following reasons: [Overview] Changing runtime base directories is not supported.
Is this a change I need to do manually in a configuration file, or should I going elsewhere to change the runtime environment?

It seems to be a known issue in Liferay IDE, check the issue.
You may have a clean version of the Liferay-Tomcat bundle given along with the Liferay IDE. What I recommand you is to create a new server that refers to this runtime environnement.
If you don't have a clean version of the Liferay-Tomcat bundle you can download new one from Liferay official site.

I found a way to get the existing runtime evironment changed.
I first had to go to the server properties and select "Switch Location". This moved the server properties from "[workspace metadata] to my workspace/servers/ directory.
Inside the .server file, I just had to change the runtime-id property to one of my predefined runtimes, in my case...
runtime-id="Liferay v6.2 EE (Tomcat 7)"
My Liferay server is now working as expected.

Related

Writing first Liferay application: how to deploy module to server + error: A full JDK (not just JRE) is required

I'm following Liferay getting-started example to develop my first we app with Liferay IDE in which it is mentioned:
Even though all you’ve done is generate it, the guestbook-web project is ready to be built and deployed to Liferay DXP. Make sure that your server is running, and if it isn’t, select it in Developer Studio’s Servers pane and click the start button. After it starts, drag and drop the guestbook-web project from the Project Explorer to the server.
I started the server, however, I don't know how to deploy guestbook-web module to server. Drag and drop is not working for me:
When Opening the web page, this is shown which doesn't contain anything related to guestbook-web module:
Update
When I drag and drop my module on server, for some reason it is not allowed:
Update
Also, I'm receiving such errors on console:
22-Apr-2020 16:02:54.419 SEVERE [http-nio-8080-exec-6] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [Module Framework Servlet] in context with path [] threw exception [PWC6345: There is an error in invoking javac. A full JDK (not just JRE) is required] with root cause
org.apache.jasper.JasperException: PWC6345: There is an error in invoking javac. A full JDK (not just JRE) is required
I have set both JDK and JRE path for IDE, not sure why it says A full JDK (not just JRE) is required.
Update
To fix A full JDK (not just JRE) is required error, inspired by this answer, I ran the IDE with this command:
C:\Program Files (x86)\LiferayWorkspacewithDevStudioCommunityEdition\liferay-developer-studio>DeveloperStudio.exe -vm "C:\Program Files\Java\jdk1.8.0_251\bin\javaw.exe"
The error is resolved and default widgets are fine now:
In the IDE: You'll drag the "guestbook-web" with the mouse and drop it right on the highlighted "Liferay 7.x at localhost" Server (Note: on, not below).
Outside of the IDE: Your project generates a jar, and you can copy that to Liferay's deploy directory.
Once the module is deployed, it won't magically show up on the page: Log in as Administrator, choose the "Add" button (a plus sign) and add a "widget" to the page: In the list of Widgets you'll find your new portlet/widget.
The screenshot of your installation looks weird though, as if something didn't go wrong and you'll likely need to look for signs of problems in the log file to see why Liferay ends up in the state that it's in, with a couple of default widgets being unavailable - however, that's unrelated to the question how to deploy new code to the runtime.
Edit: You've mentioned the required JDK from the log. That's good to be fixed.
With regards to the not-working drag&drop: It looks like you're using Liferay Workspace. From the icons in Project Explorer, it looks like your module isn't recognized as such: Try to "Gradle/Refresh Gradle Project" (right-click on "modules") to see if it needs some updates that are missing (and observe its log output). Icons on my IDE look like this:
Once you get those modules recognized, you should be able to drag&drop them to the server.
I realized to avoid A full JDK (not just JRE) is required error, it is needed to setup server correctly while creating it with GUI:

Creating liferay 7 plugin project

I am trying to create an liferay 7 plugin project using Ant and I am always recieving the below error, can someone help ?
it seems that the server mirrors.lax.liferay.com is down
[Console output redirected to file:/Users/yjradeh/foo/java/workspace/.metadata/.plugins/com.liferay.ide.sdk.core/sdk.log]
Buildfile: /Users/yjradeh/foo/java/liferay-plugins-sdk-7.0/portlets/build.xml
[get] Getting: http://mirrors.lax.liferay.com/cdn.repository.liferay.com/nexus/content/repositories/liferay-snapshots-ce/com/liferay/org.apache.ivy/2.4.0.LIFERAY-PATCHED-1-SNAPSHOT/org.apache.ivy-2.4.0.LIFERAY-PATCHED-1-SNAPSHOT.jar
[get] To: /Users/yjradeh/.liferay/mirrors/cdn.repository.liferay.com/nexus/content/repositories/liferay-snapshots-ce/com/liferay/org.apache.ivy/2.4.0.LIFERAY-PATCHED-1-SNAPSHOT/org.apache.ivy-2.4.0.LIFERAY-PATCHED-1-SNAPSHOT.jar
[get] Error getting http://mirrors.lax.liferay.com/cdn.repository.liferay.com/nexus/content/repositories/liferay-snapshots-ce/com/liferay/org.apache.ivy/2.4.0.LIFERAY-PATCHED-1-SNAPSHOT/org.apache.ivy-2.4.0.LIFERAY-PATCHED-1-SNAPSHOT.jar to /Users/yjradeh/.liferay/mirrors/cdn.repository.liferay.com/nexus/content/repositories/liferay-snapshots-ce/com/liferay/org.apache.ivy/2.4.0.LIFERAY-PATCHED-1-SNAPSHOT/org.apache.ivy-2.4.0.LIFERAY-PATCHED-1-SNAPSHOT.jar
[get] Getting: http://cdn.repository.liferay.com/nexus/content/repositories/liferay-snapshots-ce/com/liferay/org.apache.ivy/2.4.0.LIFERAY-PATCHED-1-SNAPSHOT/org.apache.ivy-2.4.0.LIFERAY-PATCHED-1-SNAPSHOT.jar
[get] To: /Users/yjradeh/.liferay/mirrors/cdn.repository.liferay.com/nexus/content/repositories/liferay-snapshots-ce/com/liferay/org.apache.ivy/2.4.0.LIFERAY-PATCHED-1-SNAPSHOT/org.apache.ivy-2.4.0.LIFERAY-PATCHED-1-SNAPSHOT.jar
BUILD FAILED
/Users/yjradeh/foo/java/liferay-plugins-sdk-7.0/portlets/build.xml:5: The following error occurred while executing this line:
/Users/yjradeh/foo/java/liferay-plugins-sdk-7.0/build-common-plugins.xml:5: The following error occurred while executing this line:
/Users/yjradeh/foo/java/liferay-plugins-sdk-7.0/build-common.xml:57: The following error occurred while executing this line:
/Users/yjradeh/foo/java/liferay-plugins-sdk-7.0/build-common-ivy.xml:130: The following error occurred while executing this line:
/Users/yjradeh/foo/java/liferay-plugins-sdk-7.0/build-common-ivy.xml:81: HTTP Authorization failure
Total time: 1 second
I had the same issue while trying to compile the SDK, you can try this url: https://repository.liferay.com/nexus/content/repositories/liferay-public-snapshots/com/liferay/org.apache.ivy/2.4.0.LIFERAY-PATCHED-1-SNAPSHOT/. Instead of the old one.
They apparently change the repository of Liferay, you can check it on Date Modification on :https://repository.liferay.com/nexus/content/repositories/.
Steps/Prerequisite for liferay on windows:
Firstly we need liferay IDE, which we can download from https://web.liferay.com/downloads/liferay-projects/liferay-ide , If you dont have eclipse editor select eclipse neon 2+liferay IDE. Or if you are having eclipse go for update archive file.
Second we need liferay plugin sdk here’s the link: https://www.liferay.com/downloads , under liferay portal CE(Community Edition) select plugins sdk.
Third, you need to download apache ant.
Download tomcat bundle from link provided in 2nd point.
Setup ANT_HOME, ANT_OPTS, CATLINA_HOME,JAVA_HOME,and JRE_HOME, and append their path accordingly in the Path field.
Let’s configure the sdk file before moving next. Keep the bundled tomcat and sdk extracted files at same folder location(mandatory). That is keep same extraction folder for tomcat and sdk plugins.
In plugins folder which you would extract, you’ll find build.properties. Replicate that file with build.username.properties. For example in my case it would be build.Jennis.properties, Keep in mind the case of the Username of your PC/laptop. And add the following line of code at the end of the file
app.server.dir=path_to_sdk../bundles/path_to_tomcat in
build.username.porperties. In my case the appended line would be
app.server.dir=C:\Users\Jennis\Documents\Downloads\com.liferay.portal.plugins.sdk-7.0/../bundles/tomcat-8.0.32
Create a bundles folder and keep the extracted folder other than SDK plugins in bundles folder.
Now we are ready to go with directly eclipse for liferay 7.0.2 installation in eclipse. Open Eclipse →Help →Install New Software. Locate the liferay IDE archive from browse button.
Now we need to add the server for liferay, to do so right click in servers window in eclipse and click on new select liferay →liferay7.x configure it and give path to tomcat8.0.32 bundle.
Run the server it will lead you to localhost:8080, configure it with defaults(not mandatory) for our example defaults are fine.
After eclipse installs the new software, it would restart in toolbar menu find the below icon and click new liferay plugin project!
If toolbar doesn't show than find it from Window →Appearance → Show Toolbar. Now click above icon and click new liferay plugin project!
Give your portlet a name.
Select build type as: Ant(liferay-plugins-sdk).
Select liferay MVC for sake of simplicity.
Next you will be prompted with SDK location give the location of SDK plugin extracted folder, which were kept at same folder at time of extracting it.
Project would be created and celebrate the first portlet.
I have also ran into this problem. The solution was in my case to change the ivy settings in build.properties (in plugins SDK root directory) like this:
ivy.version=2.4.0
ivy.jar.url=http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.version}/ivy-${ivy.version}.jar
I'm however not familiar with changes Liferay made in the PATCHET version of ivy, so it could possibly lead to some other problem. But it works for portlets apparently.

Tomcat not deploying new version of files at all - linux / eclipse

I am having issue with the way tomcat deploys my files to the server.
I have installed Tomcat 7 to /opt/tomcat7.
In my eclipse i have specified this path as my tomcat server.
my workspace directory is /home/maciej/workspace/<projects here>
now if I edit a class file and i add simply log statement
log.info("blabla"); and then deploy 'NEW' version of the file via - run on server, i do not see this 'blabla' in my output. It seems like although i have modified the class file, it was not properly deployed into tomcat. Tomcat is reading god knows what but certainly not the file it should read.
EDIT: I have recofnigured my tomcat in eclipse and now:
Server Path = /opt/tomcat7
Deploy Path = /opt/tomcat7/webapps <- used to be .metadata/blablabla default
eclipse tomcat location
When I open 'Open Lunch Configuration' under arguments/working directory the default option is ticket with greyed out path /home/maciej/Desktop
Should this also be changed?
Isn't tomcat working directory /opt/tomcat7/work ?
Any suggestions / ideas? As this issue is slightly getting on my nerves as i can not develop the app.
The Server Path is the same as the Tomcat installation directory in the modal you see in Window > Preferences > Server > Runtime Environments after hitting Edit. That should be set to /opt/tomcat7 or wherever the root of your Tomcat installation lives.
The Deploy Path is relative to the Server Path. It should be webapps, unless you already have stuff there and you want a separate directory. You will not be able to edit this until you shut down Tomcat and remove all webapps underneath it through the Servers view.
Try unchecking Modules auto reload by default if you trust the JDK hot-swapping, which you should if you're using JDK 1.7 or 1.8 and just want to see a log statement inserted.
The working directory you mentioned is just the root directory that Tomcat uses to spit out thread dumps on crashes and the like. It has nothing to do with the Tomcat "work" directory.
Open server view: Window->Show view->Other->Servers. The select correct server, right click, select "Clean" and then restart tomcat. It should help.
If you change something in the project then Eclipse will build automatically and "deploy" the files to the location you have specified. By default, Eclipe's work stops there and the rest is up to tomcat.
Tomcat, like any Java web server, detects changes in JSPs and recompiles them. Nevertheless, changes in classes have no effect because of the way Java class loading works. For the new version of a class to be used by tomcat you need to:
Not have loaded the class before. For example, you start tomcat but then see an error before doing any request. If you change the class then that change will be used because the class was not yet loaded.
Reload the application. This means that all classes are discarded and everything starts fresh.
The easiest way to reload an application, by default, is to make a change to web.xml. If you look into tomcat's configuration conf/context.xml you can see that WEB-INF/web.xml is monitored. Any change will trigger a reload of the context. So you can either make an artificial change in the file or add a resource like WEB-INF/version.properties and generate a different version.properties with any build.
In any case, reloading a complex application takes time. That is why there are plugins like JRebel. But before you go down that path (which adds another moving piece to your setup) you can also try to use Eclipe's support for hot code replacement. You start tomcat in debug, connect to it with Eclipse, and then change some class. Eclipse will try to recompile the class and upload the new definition to tomcat. If it fails it will tell you. As a general rule it will fail when you change the structure of the program and succeed when you just change method's implementations.

How to migrate Liferay portal from one windows machine to other?

Liferay migration from one server to another help required. Can anyone share there steps for migration of Liferay portal 5.2.3 from one server to another. I am using Windows + Tomcat + MySql.
I have uploaded whole tomcat folder to the new windows machine and imported the database too with the corresponding change to the configuration file like Database details.
But after starting the tomcat server it is showing some error like "Unable to load repository http://plugins.liferay.com". Any idea why I am getting this error ?
These are the steps that I have followed and able to migrate the Liferay successfully:
Take the backup of Liferay files and database from first windows machine.
Install the same version of Liferay (Say Liferay 5.2.3) on second windows machine.
Shut down Liferay.
Import the database on new system.
Add portal-ext.properties with relevant entries. (e.g Datbase Name, User Name , Pasword etc)
Add \liferay-portal-5.2.3\data\document_library files from old machine.
Start the tomcat. It will automtically do the rest.
NOTE: In the above method I have not deployed Theme and custom plugins etc, you have to deploy Theme and custom plugins also that are used on old system.
Lifery is trying to connect to plugin repository to find whether there are updates for plugins.
Does your new machine have internet conectivity?
Also you have options to ignore that message or configure liferay not to check for updates.
For later put in portal-ext.properties
plugin.repositories.trusted=
plugin.repositories.untrusted=
UPDATE:
If behind proxy create (if not existent) system-ext.properties (beside portal-ext.properties) and add
com.liferay.util.Http.proxy.host=proxy_host
com.liferay.util.Http.proxy.port=proxy_port
Change proxy_host and proxy_port with your values.
Also remove from portal-ext.properties if you want liferay to check repositories
plugin.repositories.trusted=
plugin.repositories.untrusted=

Liferay Portlet Issue

Im new with liferay have a problem with portlet deployment using the plugins sdk,
Platform:
liferay-portal-tomcat-5.5-5.1.2,
liferay-plugins-sdk-5.2.2,
windows vista.
Problem:
I have successfully created a sample portlet with ant and deployed it into the hot-deploy folder. It is automatically picked up by the server but the console messages say that the portlet has been copied successfully and never registers it.. and i cant find it in the add application drop-down menu.. pls your help will be very appreciated.
I don't know if anything important changed in these versions, but you say you're using Liferay 5.1.2 with the plugin environment 5.2.2 - try with matching versions - at least on the second digit.
also, make sure that all required files are available - among them are WEB-INF/web.xml, WEB-INF/portlet.xml.
Create a new sample portlet with "create.bat" in the plugin SDK's portlet folder and deploy this - it should succeed. Then make sure that all config files from the new one are present in your current one.
How did you create your current portlet? What did you do/change?

Resources