quarta-feira, 17 de junho de 2015

Liferay - jBoss Web Console url and Management Realm user

It's possible to do all of the configurations you need in jBoss through the XML, and other, configuration files. But you have a cleaner way to do it - jBoss Web Console.

First things first, what is the Web Console Url?

It depends on your standalone.conf file ( it's localized in your jBoss directory in the \standalone\configuration path ). Open the file and check for the same line that is highlighted in the next figure:




Mine is at the port 9990. Open a new tab with the url localhost:port.

Now one of two things may happen:

1. You have already a user to access the management console.
2. You don't have any user configured yet.

If your at point 2, keep reading.




As explained in the Welcome page, open a command line and access the bin folder in your jboss directory. Run the add-user.bat file.

Now choose the first option Management User as you want a user to access the management web console.
 



For the realm you can keep ManagementRealm or set a new one.
Set the user and password.

Now you've a management user!



 When you access the Web Console url again you'll be asked to authenticate. Do it so




In the console you can do many things, like:

- Check datasources
- Change  environment properties
- Manage applications

And that's it!

jBoss/Liferay - Manual undeploy an application

If you're using your Liferay instance with a jBoss instance as the application server, it's possible to make a manual undeploy if needed.

To do so, follow the next steps:

1. Access [jBoss installation folder] \standalone\deployments.
2. Search for the YourApplicationName.war.dodeploy file.
3. Rename the file to YourApplicationName.war.undeploy or delete it so that the application is unninstalled from the server.

And that's it!


Liferay - Change Site Name

If you ever wanted to change your Site Name but the changes are not applied, don't worry! I've got the solution.

And it's a very simple one. Follow these steps:

1. Access the liferay database ( if you don't know the name of it you can edit the standalone.conf file and check in the datasource section ).

2. Find the table Account_.

3. Edit the Name column and set the desired name.

And that's all!

quarta-feira, 20 de maio de 2015

Liferay - Application WAR is blacklisted

Sometimes when you deploy an application WAR file into your jBoss Server, it can get blacklisted. The reasons for this can be many, like:

1. You've copied the file into the deploy folder but it took to long to paste all the archive before de deploy process started. If you repeat this again and again the your application will get blacklisted.

2. Your WAR application archive is corrupted. Make sure you can open it. If you don't then your file is corrupted and jboss will not be able to deploy it.

To solve this just restart the server and try to deploy it again.

sexta-feira, 15 de maio de 2015

Liferay - Can't import LDAP users because of special characters

If you use the default LDAP configuration for Liferay 6.2, then you're in for a problem when it starts to import the users.

It is usual for the users in a LDAP server to have all sort of characters but the default configuration of Liferay doesn't allow all of them.

To get this fixed you'll have to add this property to your liferay configuration:

users.screen.name.validator = com.liferay.portal.security.auth.LiberalScreenNameValidator 


Then restart your server.

quinta-feira, 14 de maio de 2015

Liferay - Not updating dependencies or resources

When you've deployed a new version of your application in a jboss server, its possible that, sometimes, you have a problem with non updated dependencies or javascript/stylesheets resources.

This happens because the jboss server saves the data from the previous installed version of your application. 

To solve this stop the server, access the standalone/temp folder and delete the folders: auth, vfs, work.

Then start the server.

terça-feira, 5 de maio de 2015

Liferay - How to change your application server encoding?


 If you ever have any kind of problems regarding encoding in your application, it can well be a problem in the configuration of your application server.

If you're using jBoss, then follow the next steps:

 1. Open your ide and click two times in the server instance in the Servers tab.


2. Open Launch Configuration

 



3. Choose Common tab and there you'll have an Encoding area. Choose the type of encoding you need. Save it et voilá!


segunda-feira, 4 de maio de 2015

Liferay - Home Page, Landing Page and Logout Page.

When you're developing a project to a client, it can be required that you define the first page as the login page of your application. To do so, edit the portal.ext.properties file and add the next lines: 
#*******DEFAULT LANDING PAGE*******#
default.landing.page.path=path
default.logout.page.path=path

#******HOME PAGE*******#
company.default.home.url=path

The default.landing.page.path is the page where you'll be redirected after you've logged in into liferay.
The default.logout.page.path is the page where you'll be redirected after you've logged out off liferay or your application.
The company.default.home.url is the page where you'll be redirected after you access your base hostname, like localhost:8080.

Restart your application server so your changes take effect.

quarta-feira, 8 de abril de 2015

Liferay - Create endpoints in jBoss 7.1.1

Just like a properties file, the advantage of using JNDI in an application server is evident. You can define your application to read certain bindings only by name. If you ever have to change the application server, you'll only have to define the same bindings again - no application changes will be needed.

In jBoss 7.1.1 it's pretty straight forward to create bindings.

Acess your standalone configuration file (standalone.xml) and look for the

        <subsystem xmlns="urn:jboss:domain:naming:1.1">


tag.

There you'll define two differente tags:

- a Simple tag, where you define you property as key/value
- a Lookup tag, that will be used to map your property to a more user-friendly name. That name will be exposed in the JNDI context and accessible in your java classes.

Here is an example:
        
<subsystem xmlns="urn:jboss:domain:naming:1.1">
 <bindings>
  <simple name="java:jboss/applicationmode" type="java.lang.String" value="DEMO"></simple>
  <lookup name="property/applicationmode" lookup="java:jboss/applicationmode"/> 
 </bindings>
</subsystem>

And then, in your java class, instatiate InitialContext and get the property by its exposed name:

InitialContext ctx = new InitialContext();

String applicationEnv = (String) ctx.lookup("property/applicationenvironment");

quinta-feira, 26 de fevereiro de 2015

Can't see portlet hook changes

When you create a Hook liferay plugin and deploy it to you application server, you will not see the changes right away.

What to do?

Restart the application server.