David Ghedini

Linux, Java, Oracle, and PostgreSQL


David Ghedini

Tuesday Aug 07, 2012

JasperReportsIntegration 2.0.0 Beta on JBoss 7

Dietmar Aust / Opal Consulting have released JasperReportsIntegration 2.0.0 Beta for testing.

You can see the announcement here

It is has some amazing new features, is updated for JasperReports 4.7.0, and has a new deployment model.

Most importantly, the new version allows you to easily run JasperReportsIntegration on JBoss :)

If you don't have JBoss 7.1.1 installed, you can follow my tutorial here:

One important note - it did not work for me with JDK 1.7 but worked wonderfully with JDK 1.6

The zip file contains the required items for deployment on JBoss as well as items for Oracle (/sql directory) and Apex (/apex directory), it also contains some scripts to run in standalone mode as well as Jetty.

1. Create a directory under /usr/share to be the home for under JasperReportsIntegration

[root@dev2 ~]# mkdir /usr/share/JasperReportsIntegration


2. Change to the new directory:

[root@dev2 ~]# cd /usr/share/JasperReportsIntegration


3. Download the kit from Opal:

Or use wget:

[root@dev2 JasperReportsIntegration]# wget http://www.opal-consulting.de/downloads/free_tools/JasperReportsIntegration/2.0.0/JasperReportsIntegration-2.0.0.0.zip
--2012-08-07 03:43:35--  http://www.opal-

consulting.de/downloads/free_tools/JasperReportsIntegration/2.0.0/JasperReportsIntegration-2.0.0.0.zip
Resolving www.opal-consulting.de... 213.185.81.187
Connecting to www.opal-consulting.de|213.185.81.187|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 82738852 (79M) [application/zip]
Saving to: `JasperReportsIntegration-2.0.0.0.zip'

100%[======================================>] 82,738,852  2.26M/s   in 37s

2012-08-07 03:44:12 (2.13 MB/s) - `JasperReportsIntegration-2.0.0.0.zip' saved [82738852/82738852]


3. unzip it.

[root@dev2 JasperReportsIntegration]# unzip -q JasperReportsIntegration-2.0.0.0.zip


4. Your directory will look like this:

[root@dev2 JasperReportsIntegration]# ls -l
total 80944
drwxr-xr-x 2 root root     4096 Aug  6 17:49 apex
drwxr-xr-x 2 root root     4096 Aug  6 17:49 bin
drwxr-xr-x 2 root root     4096 Aug  7 05:30 conf
-rw-r--r-- 1 root root      204 Aug  6 17:49 deployJasperReportsIntegration.cmd
-rw-r--r-- 1 root root      178 Aug  6 17:49 deployJasperReportsIntegration.sh
drwxr-xr-x 3 root root     4096 Aug  6 17:49 doc
-rw-r--r-- 1 root root      341 Aug  6 17:49 Index.html
-rw-r--r-- 1 root root 82738852 Aug  6 19:57 JasperReportsIntegration-2.0.0.0.zip
drwxr-xr-x 3 root root     4096 Aug  6 17:49 jetty
drwxr-xr-x 2 root root     4096 Aug  6 17:49 lib
drwxr-xr-x 2 root root     4096 Aug  6 17:48 logs
drwxr-xr-x 5 root root     4096 Aug  7 05:33 reports
drwxr-xr-x 5 root root     4096 Aug  6 17:49 sql
-rw-r--r-- 1 root root      793 Aug  6 17:49 startJasperReportsIntegration.cmd
-rw-r--r-- 1 root root      772 Aug  6 17:49 startJasperReportsIntegration.sh
drwxr-xr-x 2 root root     4096 Aug  6 17:49 webapp


5. Change to the webapp directory and locate JasperReportsIntegration.war:

[root@dev2 JasperReportsIntegration]# cd webapp
[root@dev2 JasperReportsIntegration]# ls -l
total 66508
-rw-r--r-- 1 root root 68028460 Aug  6 17:49 JasperReportsIntegration.war
[root@dev2 webapp]#


6. Move the JasperReportsIntegration.war to JBOSS_HOME/standalone/deployments

In my case /usr/share/jboss-as/standalone/deployments:

[root@dev2 webapp]# mv JasperReportsIntegration.war  /usr/share/jboss-as/standalone/deployments/JasperReportsIntegration.war


7. Once you have moved the WAR, delete the webapp directory along with the following:
[root@dev2 JasperReportsIntegration]# rm -rf webapp/
[root@dev2 JasperReportsIntegration]# rm -rf jetty/
[root@dev2 JasperReportsIntegration]# rm -rf apex/
[root@dev2 JasperReportsIntegration]# rm -rf sql/
[root@dev2 JasperReportsIntegration]# rm -f deployJasperReportsIntegration.cmd
[root@dev2 JasperReportsIntegration]# rm -f deployJasperReportsIntegration.sh
[root@dev2 JasperReportsIntegration]# rm -f startJasperReportsIntegration.sh 
[root@dev2 JasperReportsIntegration]# rm -f startJasperReportsIntegration.cmd
[root@dev2 JasperReportsIntegration]# rm -f JasperReportsIntegration-2.0.0.0.zip


4. You should now be left with the following:

[root@dev2 JasperReportsIntegration]# ls
bin  conf  doc  Index.html  lib  logs  reports


If you are running under the user jboss, change ownership of the logs directory at /usr/share/JasperReportsIntegration/logs to the user jboss

[root@dev2 JasperReportsIntegration]# chown -Rf jboss.jboss /usr/share/JasperReportsIntegration/logs


5. Change to the conf directory, where you will find application.properties and log4jproperties:

[root@dev2 JasperReportsIntegration]# cd conf
[root@dev2 conf]# ls
application.properties  log4j.properties


6. The application.properties will look as below:

Change the data sources to your own.

Note that one of the verification tests later will look for a data source with the name 'default', so may want to leave one named as 'default'.

#====================================================================
# Application properties (global)
#====================================================================
[application]
jndiPrefix=java:comp/env/jdbc/

#====================================================================
# JDBC datasource configuration
# http://www.orafaq.com/wiki/JDBC#Thin_driver
#====================================================================
[datasource:default]
name=default
url=jdbc:oracle:thin:@192.168.2.114:1521:XE
username=my_oracle_user
password=my_oracle_user_pwd

#====================================================================
# JDBC datasource configuration
# http://www.orafaq.com/wiki/JDBC#Thin_driver
#====================================================================
[datasource:test]
name=test
url=jdbc:oracle:thin:@192.168.2.114:1521:XE
username=my_oracle_user
password=my_oracle_user_pwd

#====================================================================
# Direct printing
#====================================================================
[directPrinting]
isEnabled=true

# for debugging purposes does it make sense to display the 
# print dialog ON THE SERVER before printing. You can even cancel the 
# request through the print dialog
# DONT do that in production!!!
displayPrintDialog=false

#====================================================================
## Syntax for specifying properties: 
## http://commons.apache.org/configuration/userguide/howto_basicfeatures.html#Basic_features_and_AbstractConfiguration
#====================================================================


7. Placing OC_JASPER_CONFIG_HOME into the path of JBoss.

Where you place the path to OC_JASPER_CONFIG_HOME depends on the user you running JBoss under.

If you are running JBoss under the user jboss, you need to add the path to OC_JASPER_CONFIG_HOME to the .bash_profile of user jboss.

If you are running JBoss under the user root, you need to add the path to OC_JASPER_CONFIG_HOME to the .bash_profile of the user root.

If you simply place the path into the Jboss init script (JBOSS_HOME/bin/jboss-as-standalone.sh) or into your jboss script under /etc/init.d, it will throw the following error as JBoss will look for the application.properties file under ../JasperReportsIntegration.war-xxx/conf/application.properties:

net.sf.jasperreports.engine.JRRuntimeException: File /usr/share/jboss-as/standalone/tmp/vfs/temp38167c0517128991/JasperReportsIntegration.war-d170f314ce444645/conf/application.properties not found.
	de.oc.integration.jasper.webapp.AppContext.loadApplicationProperties(AppContext.java:144)
	de.oc.integration.jasper.webapp.ReportWrapper.service(ReportWrapper.java:152)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:847)


So, add the following to the .bash_profile of the user your running jboss under (jboss or root):

OC_JASPER_CONFIG_HOME=/usr/share/JasperReportsIntegration  
export OC_JASPER_CONFIG_HOME


Along with JAVA_HOME and bin paths (and any others you have), your jboss (or root) user bash_profile would look something like:

JAVA_HOME=/usr/java/jdk1.6.0_33
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
OC_JASPER_CONFIG_HOME=/usr/share/JasperReportsIntegration
export OC_JASPER_CONFIG_HOME


8. Install the SQL into the user schema

This bit has not changed.

Connect to your database server and change directories to the location you uploaded the /sql directory.

Connect to SQL*Plus as the required user and run @user_install.sql

[root@or2 JRI2]# cd sql
[root@or2 sql]# ls
sys_install_acl.sql  sys_remove.sql    user_remove.sql  xlib_jasperreports
sys_install.log      user_install.log  xlib_base        xlib_status.sql
sys_install.sql      user_install.sql  xlib_http        xlib_status_sys.sql
[root@or2 sql]# sqlplus /nolog

SQL*Plus: Release 11.2.0.3.0 Production on Mon Aug 6 20:39:01 2012

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

SQL> connect soctt/tiger
Connected.
SQL> @user_install.sql


Make sure it compiles with no errors.


9. Install the f860_JasperIntegrationTest_2.0.0.0.sql Application

Import the f860_JasperIntegrationTest_2.0.0.0.sql into your work space.

The new testing application has some new features as you can see below.


10. Verify your installation.

In the screenshot below, you can see I did not use the name 'default' for any of my data sources.

JBoss 7 JRI Application



11. Test your reports.

Among other new features, there is now a "Save File on Server" option. This allows you to save the generated report on the file system of the application server (jboss). You need to supply the full OS path. One additional note, if you are running as user jboss you will only be able to save into directories owned by jboss (or made available to user jboss). If you are running a root, of course, you can save anywhere on the server.

Jboss 7 Jasper Test



There is the file, fromapp.pdf, saved to server in above screen shot.

[root@dev2 jboss]# ls -l
total 8
-rw-rw-r-- 1 jboss jboss 2153 Aug  7 06:48 fromapp.pdf



Cool beans. Hoping to learn a lot more about this

Official Installation Guide

Bookmark and Share



Friday Jul 27, 2012

Oracle Weblogic 12c (12.1.1) Generic x64 on CentOS 6

Oracle Weblogic 12c (12.1.1) Generic Installer x64 on CentOS 6

This post will cover installing Oracle Weblogic 12c (12.1.1) Generic Installer x64 (wls1211_generic.jar) on 64 bit CentOS 6 for evaluation.

Before investing any time in this, despite a fresh download you will need,.... a patch: (p13606167_12110_Generic.zip).

I am installing this remotely, if you are doing the same, you can see my post on VNC on CentOS 6

If not, the proceedure is identical.

Step 1. Create the user who will own WLS


Create a user 'oracle' and group dba.


[root@demo ~]# groupadd dba
[root@demo ~]# useradd -g dba oracle
[root@demo ~]# passwd oracle
Changing password for user oracle.
New password:

Retype new password:

passwd: all authentication tokens updated successfully.
[root@demo ~]#


Step 2. Download jdk-7u5-linux-x64.tar.gz and Install.


Oracle recommends JRockit for Production Mode and JDK 1.7 for Development Mode.

Start by making a home for JAVA.

Ill create mine under /usr/java

[root@demo ~]# mkdir /usr/java


Download jdk-7u5-linux-x64.tar.gz to the /usr/java directory
[root@demo java]# ls
jdk-7u5-linux-x64.tar.gz



Extract it:

[root@demo java]# tar -zxf jdk-7u5-linux-x64.tar.gz


This will create a directory, jdk.17.0_05 under /usr/java:

[root@demo java]# ls
jdk1.7.0_05  jdk-7u5-linux-x64.tar.gz


This will be our JAVA_HOME: /usr/java/jdk1.7.0_05

(You can now remove jdk-7u5-linux-x64.tar.gz using rm -f jdk-7u5-linux-x64.tar.gz).


3. Put JAVA into the path of user oracle.


Add the following to bash profile for user oracle


JAVA_HOME=/usr/java/jdk1.7.0_05
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH


Make it available now:



[root@demo jdk1.7.0_05]# source ~/.bash_profile


4. Check Java is in oracle's path:


Switch to the user oracle and verify that Java is now in the path of oracle by issuing 'java -version'



[root@demo jdk1.7.0_05]# su - oracle
[oracle@demo ~]$ java -version
java version "1.7.0_05"
Java(TM) SE Runtime Environment (build 1.7.0_05-b06)
Java HotSpot(TM) 64-Bit Server VM (build 23.1-b03, mixed mode)
[oracle@demo ~]$


5. Make a home for Weblogic


[root@demo ~]# mkdir /home/weblogic


Make the user oracle the owner:

[root@demo ~]# chown oracle:dba /home/weblogic


6. Download wls1211_generic.jar


Download wls1211_generic.jar from either of these locations:

http://www.oracle.com/technetwork/middleware/ias/downloads/wls-main-097127.html

http://www.oracle.com/technetwork/middleware/weblogic/downloads/index.htm


7. Install wls1211_generic.jar


Here is the short version:

1. su - oracle

2. Go to the location where you donwnloaded wls1211_generic.jar (I've downloaded it to /home)

3. Issue:



java -jar -Xmx1024m -XX:MaxPermSize=512M  wls1211_generic.jar



Important: if you do not set PermSize as well as Xmx, your install will fail with Out of Memory errors.


I had a dozen screen shots for all of this but decided in to just make a mp4 and upload it to YouTube.

My apologies for the quality and (lack of) editing of the video; it's my first video using demo-builder.

If you expand the video to full screen mode you will be able to see the terminal (sort of).


Part I Install wls1211_generic.jar:









Part II Create a domain and Admin user credentials:







Patch


As you can see from Part II, once we started the domain, we ran into:

WARNING: Input Action on WSDL operation AbortedOperation and @Action on its associated Web Method abortedOperation did not match and will cause problems in dispatching the requests
Jul 22, 2012 6:10:39 AM com.sun.xml.ws.model.JavaMethodImpl freeze

This required us to install p13606167_12110_Generic.zip as shown in the video

In the video, I installed it on offline mode.

To see how to apply in online mode, see: http://weblogic-wonders.com/weblogic/2010/12/03/methods-to-apply-patches-in-weblogic-server/





Starting the Domain


As shown above, we start the domain by going to the domain's directory and issuing './startWebLogic.sh'


[oracle@demo ~]$ cd /home/weblogic/user_projects/domains/david


Start it :


[oracle@demo david]$ ./startWebLogic.sh



I hope this was helpul.....

http://docs.oracle.com/cd/E24329_01/doc.1211/e24492/prepare.htm#BABFIDAB

Bookmark and Share



Sunday Jul 22, 2012

VNC Server on CentOS 6

This post will cover installing VNC with GNOME Desktop on a remote server running CentOS 6.

Installation has changed a bit since CentOS 5, but is still simple and straight forward.

1. Install Tigervnc Server


[root@demo ~]# yum -y install tigervnc-server



2. Install X Windows and GNOME.

This used to be yum groupinstall "X Window System" "GNOME Desktop Environment", but is now simply:


yum groupinstall "X Window System" "Desktop"



3. Create a user (or use and existing user) and create VNC login.


[root@demo ~]# useradd david
[root@demo ~]# passwd david
Changing password for user david.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
[root@demo ~]# su - david



4. Switch to the user (su - user) and issue 'vncpasswd' to set the VNC password



[david@demo ~]$ vncpasswd
Password:
Verify:
[david@demo ~]$



5. Start VNC using 'vncserver :1'


[david@demo ~]$ vncserver :1
xauth:  creating new authority file /home/david/.Xauthority

New 'demo.domain.net:1 (david)' desktop is demo.domain.net:1

Creating default startup script /home/david/.vnc/xstartup
Starting applications specified in /home/david/.vnc/xstartup
Log file is /home/david/.vnc/demo.domain.net:1.log

[david@demo ~]$





6. Stop VNC using using 'vncserver -kill :1'


[david@demo ~]$ vncserver -kill :1



7. Setting resolution:


In /etc/sysconfig/vncservers, add a line for each user.

NOTE: if you if you need to install Oracle software, use geometry 1024x768.

You can also do this via the shell using: vncserver :1 -geometry 1024x768 -depth xx

# The VNCSERVERS variable is a list of display:user pairs.
#
# Uncomment the lines below to start a VNC server on display :2
# as my 'myusername' (adjust this to your own).  You will also
# need to set a VNC password; run 'man vncpasswd' to see how
# to do that.  
#
# DO NOT RUN THIS SERVICE if your local area network is
# untrusted!  For a secure way of using VNC, see this URL:
# http://kbase.redhat.com/faq/docs/DOC-7028

# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.

# Use "-localhost" to prevent remote VNC clients connecting except when
# doing so through a secure tunnel.  See the "-via" option in the
# `man vncviewer' manual page.

# VNCSERVERS="2:myusername"
# VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost"
VNCSERVERS="1:david"
VNCSERVERARGS[1]="-geometry 1024x768"


For multiple users, simply add the user to the VNCSERVERS list and add a VNCSERVERARGS[x] entry.

So for three users:

VNCSERVERS="1:david 2:bill 3:john"
VNCSERVERARGS[1]="-geometry 1024x768"
VNCSERVERARGS[2]="-geometry 1024x768"
VNCSERVERARGS[3]="-geometry 640x480"


8. Open the port for the user, in this case 5801.



-A INPUT -m state --state NEW -m tcp -p tcp --dport 5801 -j ACCEPT


Save and restart IP Tables (/etc/init.d/iptables save | restart)

9. Connect using VNC Viewer with IP:1




10. You should now be connected to your CentOS desktop




CentOS Wiki: VNC ( Virtual Network Computing )

Bookmark and Share




Main Menu

Built With

Search

Pages

LinkedIn

Tag Cloud

Hosted by:

Navigation

Visitors

Sponsors

petiole Cloud

Feeds