Tuesday, September 29, 2009

Mule 2.x Start Error

Message:

Root Exception stack trace:
oracle.xml.parser.schema.XSDException: Duplicated definition for: 'identifiedType'
at oracle.xml.parser.v2.XMLError.flushErrorHandler(XMLError.java:418)
at oracle.xml.parser.v2.XMLError.flushErrors1(XMLError.java:284)

Solution:
The Mule 2.x app does not contain the correct Spring library. Please include the spring-context-2.5.jar

Thursday, August 20, 2009

Wednesday, July 29, 2009

Java Performance Diagnosis Tools

prstat / prstat -mLp
  • the last number of each column is the NLWP (number light weight processes aka threads) that are currently active.
  • prstat -mLp will show the current threads for one process. The last column is the LWPID (light weight process ID)
  • LWPID’s increment by one, hence the highest LWPID indicates how many threads have been launched since process creation.
ps -fLp
  1. indicates how many threads have been launched since process creation.
truss -f -p /
  1. new system calls for one thread
/usr/jdk/jdk1.6.0_10/bin/jstatd -J-Djava.security.policy=jstatd.all.policy -p 52074
  1. starts an rmi server on the local host to be able to monitor application running on this host
/usr/jdk/jdk1.6.0_10/bin/jps -q
  1. determines the running java processes
References:

Curl Command

curl -x (proxy.host):(proxy.port) http://www.google.com

Thursday, May 21, 2009

Heap Dump

jmap -dump:format=b,file=heap.bin 518

Wednesday, February 11, 2009

Mule 1.x: Spring Integration

Integrating a Spring configuration file into a Mule configuration has been the most frustrating thing in the world... well at least for me.

Mule provides documentation for using Spring with Mule 1.x in the following URL:
http://www.mulesource.org/display/MULEUSER/Using+Spring+as+a+Component+Factory

However, after following these instructions, there are a couple of things that were left undocumented for the spring application context xml to be integrated successfully. The following are these undocumented notes:

  1. The Spring application context xml file should not include a XML schema definition. It should specify the Mule-specific DTD.

    Example Spring XML:


    <beans xmlns="http://www.springframework.org/schema/beans" xsi="http://www.w3.org/2001/XMLSchema-instance" schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">

    ......
    </beans>

    In order for the Spring XML file to be read successfully by the Mule Server, the above Spring XML file must modified to use the DTD file, and not the XML Schema as follows:

    <!DOCTYPE beans PUBLIC "-//MuleSource //DTD mule-configuration XML V1.0//EN"
    "http://mule.mulesource.org/dtds/spring-beans.dtd">
    <beans>
    .......
    </beans>

    If you do not do this, the Mule server will throw the following exception and cause you frustration beyond belief (jk):

    nested exception is org.xml.sax.SAXParseException: : XML-20149: (Error) Element 'beans' used but not declared.

  2. When specifying the <contianer-context> element, remember to define it at the appropriate place in the mule configuration xml.

    <!ELEMENT mule-configuration (description?,environment-properties?,mule-environment-properties?,container-context*,security-manager?,
    transaction-manager?,agents?,connector*,endpoint-identifiers?,transformers?,global-endpoints?,
    interceptor-stack*,model*)

    From the above DTD element, the container-context element should be after the mule-environment-properties element and before any connector, transformer, and model elements.

    If this is not the case, the Mule Server will throw the following exception:

    SAXParseException: : XML-20148: (Error) Invalid element 'container-context' in content of 'mule-configuration', expected elements '[connector, endpoint-identifiers, transformers, global-endpoints, interceptor-stack, model]'.

    It will indicate the mule-configuration DTD element that does not even contain the container-context element, which may be quite confusing.



So, it seems most of these are related to DTD and XML schema definitions.

Friday, January 23, 2009

Monday, January 5, 2009

Oracle SQL: Calculating on a Running Window

select t1me, m1n, m1n_1, m1n_2, m1n_3, m1n_4, m1n+m1n_1+m1n_2+m1n_3+m1n_4 fiveminspan from
(select
trunc(record_timestamp,'MI') t1me,
count(*),
LEAD(count(*), 0, -1) OVER (ORDER BY trunc(record_timestamp,'MI') ASC) m1n,
LEAD(count(*), 1, -1) OVER (ORDER BY trunc(record_timestamp,'MI') ASC) m1n_1,
LEAD(count(*), 2, -1) OVER (ORDER BY trunc(record_timestamp,'MI') ASC) m1n_2,
LEAD(count(*), 3, -1) OVER (ORDER BY trunc(record_timestamp,'MI') ASC) m1n_3,
LEAD(count(*), 4, -1) OVER (ORDER BY trunc(record_timestamp,'MI') ASC) m1n_4
from REP_OWNER.BAM_MEDIA_REPORT where
record_timestamp > TO_DATE('03/30/2008', 'MM/DD/YYYY') and
record_timestamp < TO_DATE('09/29/2008', 'MM/DD/YYYY')
group by trunc(record_timestamp,'MI')
order by count(*) desc)