Friday

Manipulation Oracle Bpm directory with FDI api

The BPM Directory is an information repository. It stores configuration information about a BPM Environment. This repository is a fundamental component of the BPM Environment; a BPM Environment cannot exist without a BPM Directory. All the users information and organizational unit information maintains on BPM directory. Oracle BPM also provides API named FDI to CRUD operations on these information. For more additional information see here. In this current post, i will provide sample java code which will help to quick start with FDI.
Fdi Api is not public api to use, for these reason only a few reference found on the web. Oracle BPM Standard Components Reference provides most of the information to working with FDI. For example purpose, i will use Bpm Standalone Enterprise server directory.xml. To run standalone client we have to need following libraries on class path:
  • fuegopapi-client.jar
  • b1oracle.jar
  • b1base.jar
  • b1util.jar
  • b1resource.jar

Here is my maven pom.xml file
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>ru.fors.nsi.bpm.proxy</groupId>
<artifactId>bpmproxy</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>bpmproxy</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>fuego</groupId>
<artifactId>fuegopapi-client</artifactId>
<version>6.5.0</version>
<!--<scope>provided</scope>-->  
</dependency>
<dependency>
<groupId>javax.ejb</groupId>
<artifactId>ejb</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>albpm.jdbc.oracle</groupId>
<artifactId>b1oracle</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>albpm.jdbc.base</groupId>
<artifactId>b1base</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>albpm.util</groupId>
<artifactId>b1util</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
<version>1.1</version>
</dependency>
<!--<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</dependency>-->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
<version>1.6.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
<skip>true</skip>
</configuration>
</plugin>          
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>      
</build>
</project>

Here is my directory.xml, which must be on classpath.
<?xml version="1.0" encoding="UTF-8"?>
<?fuego version="6.5.1" build="94375"?>
<DirectoryConfiguration>
<id>default</id>
<description>Default Directory Configuration</description>
<admin>admin</admin>
<adminPass><encrypted>uPgrjqI482A=</adminPass>
<presets>
<preset name="engine">
<property name="participant" value="admin"/>
<property name="participant_password" value="<encrypted>uPgrjqI482A="/>
</preset>
<preset name="xobjects">
<property name="participant" value="admin"/>
<property name="participant_password" value="<encrypted>uPgrjqI482A="/>
</preset>
<preset name="portal-anonymous">
<property name="participant" value="admin"/>
<property name="participant_password" value="<encrypted>uPgrjqI482A="/>
</preset>
<preset name="datawarehouse">
<property name="participant" value="admin"/>
<property name="participant_password" value="<encrypted>uPgrjqI482A="/>
</preset>
<preset name="papiws-anonymous">
<property name="participant" value="admin"/>
<property name="participant_password" value="<encrypted>uPgrjqI482A="/>
</preset>
</presets>
<set>
<configuration name="fuego" type="SQL" subtype="DDORACLE">
<property name="jdbc.pool.idle_timeout" value="5"/>
<property name="jdbc.pool.entry.max" value="10"/>
<property name="oracle.dateEqualsTimestamp" value="false"/>
<property name="jdbc.host" value="xyz"/>
<property name="user" value="OBPMDirLocal"/>
<property name="jdbc.port" value="1521"/>
<property name="jdbc.pool.min" value="0"/>
<property name="jdbc.pool.maxopencursors" value="100"/>
<property name="oracle.sid" value="ftsdb"/>
<property name="password" value="<encrypted>ko8PrHu2UJLLicio"/>
<property name="jdbc.xa" value="false"/>
<property name="jdbc.pool.max" value="10"/>
</configuration>
</set>
</DirectoryConfiguration>

Thursday

Resolve NullPointerException at weblogic.wsee.jaxws.spi.ClientIdentityRegistry.internalAddClientRuntimeMBean

One of our project running on Solaris Sparc system on production, last week we have deployed newer version of our project which have to integrate with 3rd party webservices. On development platform all the test goes fine on Weblogic 10.3.3, but on production we got the following Nullpointer exception:
05-10-2010 18:48:01.066 ERROR r.f.t.a.service.AuctionAOPLogger - Exception:

java.lang.NullPointerException: null

at weblogic.wsee.jaxws.spi.ClientIdentityRegistry.internalAddClientRuntimeMBean(ClientIdentityRegistry.java:470) ~[weblogic.jar:10.3.3.0]

at weblogic.wsee.jaxws.spi.ClientIdentityRegistry.addClientRuntimeMBean(ClientIdentityRegistry.java:424) ~[weblogic.jar:10.3.3.0]

at weblogic.wsee.jaxws.tubeline.standard.WseeClientTube.register(WseeClientTube.java:54) ~[weblogic.jar:10.3.3.0]

at weblogic.wsee.jaxws.tubeline.standard.WseeClientTube.(WseeClientTube.java:35) ~[weblogic.jar:10.3.3.0]

at weblogic.wsee.jaxws.tubeline.standard.StandardTubelineDeploymentListener$1.createClient(StandardTubelineDeploymentListener.java:52) ~[weblogic.jar:10.3.3.0]

at weblogic.wsee.jaxws.WLSTubelineAssemblerFactory$TubelineAssemblerImpl.createClient(WLSTubelineAssemblerFactory.java:148) ~[weblogic.jar:10.3.3.0]

at com.sun.xml.ws.client.WSServiceDelegate.createPipeline(WSServiceDelegate.java:467) ~[glassfish.jaxws.rt_1.0.0.0_2-1-5.jar:2.1.5]

at com.sun.xml.ws.client.WSServiceDelegate.getStubHandler(WSServiceDelegate.java:689) ~[glassfish.jaxws.rt_1.0.0.0_2-1-5.jar:2.1.5]

at com.sun.xml.ws.client.WSServiceDelegate.createEndpointIFBaseProxy(WSServiceDelegate.java:667) ~[glassfish.jaxws.rt_1.0.0.0_2-1-5.jar:2.1.5]

at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:362) ~[glassfish.jaxws.rt_1.0.0.0_2-1-5.jar:2.1.5]

at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:344) ~[glassfish.jaxws.rt_1.0.0.0_2-1-5.jar:2.1.5]

at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:326) ~[glassfish.jaxws.rt_1.0.0.0_2-1-5.jar:2.1.5]

at javax.xml.ws.Service.getPort(Service.java:92) ~[na:1.6.0_20]

at ru.fors.trade.rosim.ws.client.CheckAuctionServices.getBasicHttpBindingICheckAuctionServices(CheckAuctionServices.java:56) ~[rosim-confirmation-2.0.6.2.jar:na]

at ru.fors.trade.auction.service.RosimServiceImpl.checkAuctionCorrect(RosimServiceImpl.java:47) ~[auction-common-2.0.6.2.jar:na]

at sun.reflect.GeneratedMethodAccessor683.invoke(Unknown Source) ~[na:na]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_20]

at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_20]

at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307) [spring-aop-2.5.6.jar:2.5.6]

at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182) ~[spring-aop-2.5.6.jar:2.5.6]

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) ~[spring-aop-2.5.6.jar:2.5.6]

at org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:54) [spring-aop-2.5.6.jar:2.5.6]

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) ~[spring-aop-2.5.6.jar:2.5.6]

at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89) ~[spring-aop-2.5.6.jar:2.5.6]

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) ~[spring-aop-2.5.6.jar:2.5.6]

at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) [spring-aop-2.5.6.jar:2.5.6]

at $Proxy139.checkAuctionCorrect(Unknown Source) [na:na]

at ru.fors.trade.auction.service.AuctionServiceImpl.checkForRosimSendOrUpdate(AuctionServiceImpl.java:1457) [auction-common-2.0.6.2.jar:na]

at sun.reflect.GeneratedMethodAccessor682.invoke(Unknown Source) ~[na:na]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_20]

at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_20]

at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307) [spring-aop-2.5.6.jar:2.5.6]

at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182) ~[spring-aop-2.5.6.jar:2.5.6]

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) ~[spring-aop-2.5.6.jar:2.5.6]

at org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:54) [spring-aop-2.5.6.jar:2.5.6]

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) ~[spring-aop-2.5.6.jar:2.5.6]

at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106) [spring-tx-2.5.6.jar:2.5.6]

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) ~[spring-aop-2.5.6.jar:2.5.6]

at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89) ~[spring-aop-2.5.6.jar:2.5.6]

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) ~[spring-aop-2.5.6.jar:2.5.6]

at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) [spring-aop-2.5.6.jar:2.5.6]
At first glance it seems, client trying to add client identification on request.
After some googling on web i have just found one forum thread with no answer.


Monday

Oracle service bus logging with custom JDBCAppander

Last few weeks we are upgrading logging system of our MDM system, we have design a central place for all logging data. With central log system we can afford to manage our system very effectively and debug any fatal error. With OSB it's not straight forword to pulling logging data from console to somewhere, because a few subsystem uses different appender to write and filter log. See the following link to know more about oracle logging service. In my previous post i demonstrate how to use log4j JDBC appender in log4j.properties to redirect log to database table.
For the current post we also uses same DDL to create tables
1)
CREATE TABLE LOGS 
(USER_ID VARCHAR2(20), 
DOMAIN  varchar2(50), 
DATED   DATE NOT NULL, 
LOGGER  VARCHAR2(500) NOT NULL, 
LEVEL   VARCHAR2(50) NOT NULL, 
MESSAGE VARCHAR2(4000) NOT NULL 
);

2) Create a simple maven project with a few dependency to create custom JDBCAppender
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>ru.xyz.wl.logging</groupId>
<artifactId>jdbc-logging</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>jdbc-logging</name>
<url>http://maven.apache.org</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>weblogic</groupId>
<artifactId>wlfullclient</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>weblogic</groupId>
<artifactId>wllog4j</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
<encoding>UTF-8</encoding>
</configuration>               
</plugin>
</plugins>
</build>
</project>

assume that you have already installed wlfullclient.jar and wllog4j.jar in your maven local repository.
3) Now it's time for coding, create two java class as follows:
package ru.xyz.wl.logging;

import org.apache.log4j.AppenderSkeleton;
import org.apache.log4j.spi.LoggingEvent;

import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;
import java.sql.*;

import weblogic.logging.log4j.WLLog4jLogEvent;

/**

*/
public class JDBCAppender extends AppenderSkeleton {
private Connection conn;
private PreparedStatement stm;
private String subSysName;
public JDBCAppender(String subSysName) {
this.subSysName = subSysName;
// get Initial ctx
try {
InitialContext ctx = new InitialContext();
DataSource dataSource = (DataSource) ctx.lookup("jdbc/logDataSource");
conn = dataSource.getConnection();
stm = conn.prepareStatement("INSERT INTO EXT_LOGS2 VALUES(?,?,?,?,?,?)");
stm.setEscapeProcessing(true);
conn.setAutoCommit(true);

} catch (NamingException e) {
e.printStackTrace();
} catch(SQLException e){
e.printStackTrace();
}

}

Sunday

A quick fix to set Locale on OOO (Open office org)

One of our web application uses OOO(open office org 3.2) to convert msOffice file to HTML file. There are a open source project named JodConverter which helps you to do most of the low level works such as connecting to server and much more. For quick start you can see my previous post. Few days ago we got a bug about Russian encoding after converting big Ms Word file to Html, as a usual our developers done their all the best to get rid of it, put directives on html and much more, but all in vain. Then i tried to change the OOO settings which recommended on ooo forums.
1) Change HTML compatibility - character set UTF-8 which should fix the problem but it havn't
2) Then change the Language settings -> set Locale for Russian and the bug fixes.
see the screen shot
Preferences
During my annual vacation, colleague could not manage to change the preferences to the production server. He as usual connect to server by ssl client on cli mode and thus could't change to the preferences. We usually use winscp or standard ssl client to connect to remote Solaris server. There are another very well tools xManager which will help you to bring remote linux/unix desktop to your windows desktop. Another very useful command is display LocalIP to tunneling gui from remote computer to local.
DISPLAY=HOST:0.0, export DISPLAY

For that remote port should be open for you to tunneling.
My colleague found another very quick fix to solve the problem with encoding. Through winscp he connects to the remote server and change the default locale to Russian by the following code on Linguistic.xcu file. Here is the fragments of the file to change
<node oor:name="General">

<prop oor:name="DefaultLocale" oor:type="xs:string">

<value>ru-RU</value>

</prop>

</node>

lingusitic.xcu file should be found on Solris file systme ~/.openoffice.org/3/user/registry/data/org/openoffice/Office/Linguistic.xcu