Sunday, December 8, 2013

HOWTO install java on SLES

I always come across the same problems when installing java and weblogic on SLES, so just for me as reminder, wanted to write a manual

Install Java:

1) download java 6 distribution (dependeing on whether 64 or 32 bits)
ftp http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase6-419409.html#jdk-6u45-oth-JPR

2)after it is installed as java-1.6.0_45.bin move it to the folder where you want it to be installed, for example in my case:
c>mv java-1.6.0_45.bin /usr/java-6/java-1.6.0_45.bin

3) install java
c> ./java-1.6.0_45.bin

2) set JAVA as path PATH
c> cd /etc
c> vi profile.local
The content of the file:
JAVA_BINDIR=/usr/java-6/jdk1.6.0_45/bin
JAVA_HOME=/usr/java-6/
jdk1.6.0_45
JDK_HOME=/usr/java-6/
jdk1.6.0_45
JRE_HOME=/usr/java-6/
jdk1.6.0_45/jre
PATH=`echo $PATH|sed 's|:/usr/lib/java/bin|:/usr/java-6/
jdk1.6.0_45/bin|'`
export JAVA_BINDIR
export JAVA_HOME
export JDK_HOME
export JRE_HOME
export PATH



Friday, July 26, 2013

Liferay 6.1/weblogic 12.1.1 java.lang.ClassCastException: com.liferay.portal.kernel.servlet.NonSerializableObjectHandler cannot be cast to java.lang.String

If you get this exception, don't try to debug, especially if you are using Weblogic with closed servlet code.
It is just as simple as problems with having not the same Servlet name in your web.xml as in your portlet.xml.

Liferay wants to have servlets name conteain portlet name in web.xml. Example
<servlet>
     <servlet-name>ListPortlet Servlet</servlet-name>
     .....
</servlet>

<portlet>
  <portlet-name>ListPortlet</portlet-name>
  <display-name>Highcharts List portlet</display-name>
....
</portlet>

So be aware, if your Portlet names don't match, you get this nasty exception. And it means that you need to reconsider your web.xml again.

Monday, July 8, 2013

Configure Weblogic 12 Cluster on Windows and run it locally (Weblogic 12.1.1)

    Here is a scenario how to configure Cluster locally on Windows
  • Start Node Manager (${WEBLOGIC_HOME}/wlserver_12.1/server/bin/startNodeManager.bat {.sh})

  • Start your Weblogic domain (we'll reference it as default domain, that is located at ${WEBLOGIC_HOME/user_projects/domains/base_domain/startWebLogic.cmd {.sh}})

  • Go to weblogic console and log in (if you haven't changed the port for your domain server, than it is http://localhost:7001/console)

  • Go to Environment (Umgebung) -> Computer (Rechner) and add new "Machine"

  • Don't forget to register here your NodeManager correctly. My nodemanager port number is 5556. And my nodeManager runs at localhost and uses SSl Listener Type.

  • Think about giving more memory to your server, otherwise it might be hard to deploy anything on it.

  • After you are done with it, go to Environment (Umgebung) -> Server and Add a new "server", that you will name ManagedServer.

  • After you are done with it, go to Environment (Umgebung) -> Cluster and create a new "Cluster". Then add your newly created ManagedServer to your Cluster.

  • Restart your NodeManager and your weblogic base_domain.

  • Now you are done and you can start your ManagedServer. After you started your ManagedServer, wait until the ManagedServer will get into the "Running status". Running status means that it's done and ready to be used.

    Happy Testing!

Monday, July 1, 2013

Liferay 6.x and IPC (Intra Portlet Communication)

In order to activate IPC for your portlets, you need to define value for portlet.event.distribution={YOUR_VALUE} in your {LIFERAY_HOME}/WEB-INF/classes/portal-ext.properties. I defined it as
portlet.event.distribution=ALL

Otherwise events for your portlets would not be propagated to the portlets that are on the other pages, and you might need it really desperately.

Liferay 6.x database reset

I came across an issue that made me start looking for a Liferay database reset. It turned out to be pretty simple, but it was not that easy to find

So here is what to do when you are using your hypersonic default database:

  • Stop your liferay application
  • Go to ${LIFERAY_HOME}/data/hsql folder
  • Remove your liferay.script and lportal.properties from that folder

And if you have already configured your Liferay to use Mysql or whatever other database, than just remove and recreate your custom liferay database again.

  • drop database lportal;
  • create database lportal character set utf8;

Thursday, June 27, 2013

HOWTO install Weblogic 12 and Liferay 6.1.1 on Windows

1) download Weblogic (for example version 12.1.1. http://www.oracle.com/technetwork/middleware/weblogic/downloads/wls-main-097127.html)

2) configure doamain (config.exe is in ${WL_HOME}/wlserver_12_1/common/bin)
 
3) start WebLogic. Start http://localhost:7001/console/ log in with your username and pssword that you configured in step2. Configure your datasources.

4) stop Weblogic and put the dependencies in your WebLogic domain folder ${WL_HOME}/${YOUR_DOMAIN}/lib. Dependencies are unpacked http://sourceforge.net/projects/lportal/files/Liferay Portal/6.1.1 GA2/ look for the file here liferay-portal-dependencies...zip These include hsql.jar , portal-services.jar and portlet.jar

5) Give your WebLogic more memory (setEnv.cmd), change to -Xmx11024m and -XX:MaxPermSize512m

6) Start your weblogic domain again. Go to http://localhost:7001/console/ log in and go to deployments. Install your liferay-war as application. Liferay.war can be downloaded for example http://sourceforge.net/projects/lportal/files/Liferay Portal/6.1.1 GA2/ (look for liferay-portal-6.1.1....war in this folder) Don't worry about the errors when parsing asset_publisher
21.06.2013 10:42 Uhr MESZ> <Warning> <HTTP> <BEA-101342> <liferay-portal-6.1.1: Error(s) encountered while precompiling JSP jspURI
 configuration.jsp:17:18: Error in "init.jsp" at line 249: The code of method _jspService(HttpServletRequest, HttpServletResponse) is exceeding the 65
535 bytes limit
<%@ include file="/html/portlet/asset_publisher/init.jsp" %>
                 ^--------------------------------------^
>



and don't worry about timeout exception
21.06.2013 10:45 Uhr MESZ> <Error> <Console> <BEA-240003> <Administration Console encountered the following error: java.lang.RuntimeException: Time
out waiting for completion
        at weblogic.management.provider.internal.ActivateTaskImpl.waitForCompletion(ActivateTaskImpl.java:402) 



6)
Start adding your portlet wars by putting them into deploy folder near your domain folder

7) If you are using spring with liferay and updating  to liferay 6.1.1, than you need to be aware, that your web applications won't start properly. You might wonder, why no matter what you do, your spring context is initilialized AFTER portlet context, so that your spring controler Portlets have nothing to work with.
Don't let yourself be fret with this. You need to patch liferay yourself. Just build it from sources and add the patch from  LIFERAY github repository
http://issues.liferay.com/browse/LPS-29103
https://github.com/brianchandotcom/liferay-portal 
It happens becasue when you are putting your web.xml packaged in war file in deploy folder, than liferay takes it and massages it. And due to that bug in 6.1.1 it doesn't put Spring listener before PortletContextListener. So Spring gets initiliazed, but only after portlets.

to build the patched war locally (from your checked out local folder {LIFERAY_FROM_SOURCES/portal}):
ant  -f build-dist.xml zip-portal-war

to build dependencies (from your checked out local folder
{LIFERAY_FROM_SOURCES/portal}):
ant  -f build-dist.xml zip-portal-dependencies




  

Tuesday, June 25, 2013

Configuration Weblogic 12.1.1 and liferay 6.1.1

LIBRARIES

The following libraries should be put into the ${WEBLOGIC_HOME}/${DOMAIN_HOME}/lib

  1. xercesImpl.jar (1336 KB)
  2. xml-apis-1.4.01.jar (216 KB)
  3. hsql.jar (if lifeary will be started with hsql Database)
  4. jaxen.jar (222 KB)
  5. log4j.jar (471 KB)
  6. log4j-extras.jar (339 KB)
  7. portal-services.jar
  8. portlet.jar

Most of those librires should be just copied from your exploded liferay-6.1.1 war in weblogic ${WEBLOGIC_HOME}/${DOMAIN_HOME}/AdminServer/tmp/_WL_user/${random}/liferay-portal-6.1.1/lib folder to your ${WEBLOGIC_HOME}/${DOMAIN_HOME}/lib folder.

JSF

Don't forget to install JSF library (2.0 version) in WebLogic after you are ready with liferay installation. You can find JSF library in ${WEBLOGIC_HOME}/wlserver_12.1/common/deployable-libraries

JPA

Weblogic uses EclipseLink as JPA Implementation. So when you are starting the Weblogic, it will validate all your JPA Entities and would miss some annotations that hibernate does not place, when you were generating Entities from the database with Hibernate ant task (for example @Temporal).

JNDI

Don't forget to assign your DataSources your AdminServer in WebLogic GUI and make Sure that WebLogic has Connection to them. Otherwise, in case if you are using JNDI to resolve the Datasources, you would get

15:48:12,120 ERROR [InfraProductionConfig:56] javax.naming.NameNotFoundException: While trying to lookup 'jdbc.MyDB' didn't find subcontext 'jdbc'. Resolved ''; remaining name 'jdbc/MyDB'