<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>mikwat code &#187; java</title>
	<atom:link href="http://code.mikwat.com/archives/category/java/feed" rel="self" type="application/rss+xml" />
	<link>http://code.mikwat.com</link>
	<description>A coder's daily explorations through PHP, Java, CSS, JavaScript, Linux, OS X, Apache, Tomcat, and everything else.</description>
	<lastBuildDate>Wed, 20 Feb 2008 22:14:01 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Quartz + Spring + Hibernate with JDBC Job Store</title>
		<link>http://code.mikwat.com/archives/24</link>
		<comments>http://code.mikwat.com/archives/24#comments</comments>
		<pubDate>Thu, 04 Oct 2007 23:25:15 +0000</pubDate>
		<dc:creator>mikwat</dc:creator>
				<category><![CDATA[hibernate]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[quartz]]></category>
		<category><![CDATA[spring]]></category>

		<guid isPermaLink="false">http://code.mikwat.com/archives/24</guid>
		<description><![CDATA[Here is how I configured Quartz to work with Spring and Hibernate.  I&#8217;m using the Quartz JDBC Job Store which stores and retrieves the job settings from a database instead of a static configuration.
I use the SchedulerFactoryBean to manager the Quartz Scheduler lifecycle.
spring-servlet.xml

...
	&#60;!-- Quartz --&#62;
	&#60;bean id="scheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"&#62;
		&#60;property name="applicationContextSchedulerContextKey" value="applicationContext"/&#62;
		&#60;property name="configLocation" value="classpath:quartz.properties"/&#62;
	&#60;/bean&#62;
...

The Quartz settings are [...]]]></description>
			<content:encoded><![CDATA[<p>Here is how I configured Quartz to work with Spring and Hibernate.  I&#8217;m using the Quartz JDBC Job Store which stores and retrieves the job settings from a database instead of a static configuration.</p>
<p>I use the <a href="http://static.springframework.org/spring/docs/1.2.x/api/index.html?org/springframework/orm/hibernate3/HibernateTransactionManager.html" onclick="pageTracker._trackPageview('/outgoing/static.springframework.org/spring/docs/1.2.x/api/index.html?org/springframework/orm/hibernate3/HibernateTransactionManager.html&amp;referer=');">SchedulerFactoryBean</a> to manager the Quartz Scheduler lifecycle.</p>
<p><b>spring-servlet.xml</b></p>
<pre>
...
	&lt;!-- Quartz --&gt;
	&lt;bean id="scheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"&gt;
		&lt;property name="applicationContextSchedulerContextKey" value="applicationContext"/&gt;
		&lt;property name="configLocation" value="classpath:quartz.properties"/&gt;
	&lt;/bean&gt;
...
</pre>
<p>The Quartz settings are stored in a quartz.properties file so that they can be unique to each instance of the web application.  This setup requires that quartz.properties be on the classpath.  This file defines the JDBC connection for Quartz to use.</p>
<p><b>quartz.properties</b></p>
<pre>
...
org.quartz.dataSource.myDS.jndiURL=java:comp/env/jdbc/MyDS
org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.StdJDBCDelegate
org.quartz.jobStore.dataSource=myDS
org.quartz.jobStore.tablePrefix=JB_
org.quartz.jobStore.useProperties=true
</pre>
<p><b>MyBaseJob</b></p>
<pre>
public abstract class MyBaseJob extends QuartzJobBean
{
    private transient ApplicationContext applicationContext = null;

    public ApplicationContext getApplicationContext()
    {
        return applicationContext;
    }

    public void setApplicationContext(ApplicationContext applicationContext)
    {
        this.applicationContext = applicationContext;
    }
}
</pre>
<p>Each of my job classes extend MyBaseJob, overriding <code>executeInternal</code>.  The jobs can use the <code>applicationContext</code> to lookup Spring service beans.  In my environment these service beans extend <code>HibernateDaoSupport</code>.</p>
<pre>
    protected void executeInternal(JobExecutionContext ctx) throws JobExecutionException
    {
        MyServiceManager sm = applicationContext.getBean("myServiceManager"); // lookup Spring service bean
        ...
    }
</pre>
]]></content:encoded>
			<wfw:commentRss>http://code.mikwat.com/archives/24/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Problems using Digester in custom Struts Plugin</title>
		<link>http://code.mikwat.com/archives/18</link>
		<comments>http://code.mikwat.com/archives/18#comments</comments>
		<pubDate>Tue, 24 Jul 2007 21:49:22 +0000</pubDate>
		<dc:creator>mikwat</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[tomcat]]></category>

		<guid isPermaLink="false">http://code.mikwat.com/archives/18</guid>
		<description><![CDATA[In migrating from Tomcat 5.0 to Tomcat 5.5, one of my custom Struts plugins started failing on startup with the following exception:

org.apache.commons.digester.Digester startElement
SEVERE: Begin event threw exception
java.lang.ClassNotFoundException: com.mikwat.struts.config.AuthorizationActionConfig
The root of the problems appears to be that the Digester defaults to using the same ClassLoader that loaded it and whichever ClassLoader this is, it doesn&#8217;t have [...]]]></description>
			<content:encoded><![CDATA[<p>In migrating from <a href="/archives/category/tomcat">Tomcat</a> 5.0 to <a href="/archives/category/tomcat">Tomcat </a>5.5, one of my custom Struts plugins started failing on startup with the following exception:</p>
<pre>
org.apache.commons.digester.Digester startElement
SEVERE: Begin event threw exception
java.lang.ClassNotFoundException: com.mikwat.struts.config.AuthorizationActionConfig</pre>
<p>The root of the problems appears to be that the Digester defaults to using the same ClassLoader that loaded it and whichever ClassLoader this is, it doesn&#8217;t have access to my webapp class <code>com.mikwat.struts.config.AuthorizationActionConfig</code>.</p>
<p>After Googling around, I eventually came across this post regarding a similar problem loading the Quartz plugin: <a href="http://mail-archives.apache.org/mod_mbox/struts-user/200305.mbox/%3CB40B3D4758FBFD4AA8C4F3A015DE4446011DF774@sTamExchange1.paymentech.us%3E" onclick="pageTracker._trackPageview('/outgoing/mail-archives.apache.org/mod_mbox/struts-user/200305.mbox/_3CB40B3D4758FBFD4AA8C4F3A015DE4446011DF774_sTamExchange1.paymentech.us_3E?referer=');">Mailing list archives</a>.</p>
<p>The solution is to call setUseContextClassLoader(true) on the Digester object which forces it to use the ClassLoader found by calling <code>Thread.currentThread().getContextClassLoader()</code>.</p>
]]></content:encoded>
			<wfw:commentRss>http://code.mikwat.com/archives/18/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle ADF Cache Files</title>
		<link>http://code.mikwat.com/archives/13</link>
		<comments>http://code.mikwat.com/archives/13#comments</comments>
		<pubDate>Thu, 05 Apr 2007 20:26:23 +0000</pubDate>
		<dc:creator>mikwat</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[oracle]]></category>
		<category><![CDATA[tomcat]]></category>

		<guid isPermaLink="false">http://code.mikwat.com/archives/13</guid>
		<description><![CDATA[Problem: I have a web application running under Tomcat using the Oracle ADF framework.  When the application is installed as a service under Windows, it outputs cache files in mass to \WINDOWS\system32\  Needless to say, this doesn&#8217;t make the system administrators happy.
 Solution Under Linux:  This problem is avoided by starting the [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Problem:</strong> I have a web application running under <a href="/archives/category/tomcat">Tomcat</a> using the <a href="/archives/category/oracle">Oracle</a> ADF framework.  When the application is installed as a service under Windows, it outputs cache files in mass to \WINDOWS\system32\  Needless to say, this doesn&#8217;t make the system administrators happy.</p>
<p><strong> Solution Under <a href="/archives/category/linux">Linux</a>:</strong>  This problem is avoided by starting the application with a working directory of &lt;application.root&gt;\temp  Then, these ADF cache files get dumped there.  The following snip-it does the trick:</p>
<p><code>pushd "$CATALINA_BASE"/temp &gt; /dev/null<br />
exec "$EXECUTABLE" start "$@"<br />
popd &gt; /dev/null<br />
</code></p>
<p>CATALINA_BASE: &lt;application.root&gt;</p>
<p>EXECUTABLE: &lt;tomcat.home&gt;/bin/catalina.sh</p>
<p><strong> Solution Under Windows:</strong>  Unknown at this point, please provide feedback.</p>
]]></content:encoded>
			<wfw:commentRss>http://code.mikwat.com/archives/13/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Axis WSDL2Java</title>
		<link>http://code.mikwat.com/archives/5</link>
		<comments>http://code.mikwat.com/archives/5#comments</comments>
		<pubDate>Wed, 14 Feb 2007 17:36:30 +0000</pubDate>
		<dc:creator>mikwat</dc:creator>
				<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://code.mikwat.com/?p=5</guid>
		<description><![CDATA[ Use the following command to create Java stubs from a .wsdl file:
java -classpath
".;X:Javaaxis-1_3libaxis.jar;X:Javaaxis-1_3libcommons-logging-1.0.4.jar;X:Javaaxis-1_3libcommons-discovery-0.2.jar;X:Javaaxis-1_3libjaxrpc.jar;X:javaaxis-1_3libsaaj.jar;X:javaaxis-1_3libwsdl4j-1.5.1.jar"
org.apache.axis.wsdl.WSDL2Java service.wsdl
]]></description>
			<content:encoded><![CDATA[<p> Use the following command to create Java stubs from a .wsdl file:</p>
<pre>java -classpath
".;X:Javaaxis-1_3libaxis.jar;X:Javaaxis-1_3libcommons-logging-1.0.4.jar;X:Javaaxis-1_3libcommons-discovery-0.2.jar;X:Javaaxis-1_3libjaxrpc.jar;X:javaaxis-1_3libsaaj.jar;X:javaaxis-1_3libwsdl4j-1.5.1.jar"
org.apache.axis.wsdl.WSDL2Java service.wsdl</pre>
]]></content:encoded>
			<wfw:commentRss>http://code.mikwat.com/archives/5/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HAPI Error</title>
		<link>http://code.mikwat.com/archives/4</link>
		<comments>http://code.mikwat.com/archives/4#comments</comments>
		<pubDate>Tue, 07 Nov 2006 17:32:22 +0000</pubDate>
		<dc:creator>mikwat</dc:creator>
				<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://code.mikwat.com/?p=4</guid>
		<description><![CDATA[Occasionally, our HAPI library blows up with the following exception:
Error while processing message: java.lang.NumberFormatException: For input string: ""
After digging through HAPI source, it was found that the &#60;hapi.home&#62;/id_file has to be removed.  Here is an excerpt of the helpful code comment:
/**
 * Creates unique message IDs.  IDs are stored in a file called [...]]]></description>
			<content:encoded><![CDATA[<p>Occasionally, our <a href="http://hl7api.sourceforge.net/" onclick="pageTracker._trackPageview('/outgoing/hl7api.sourceforge.net/?referer=');">HAPI</a> library blows up with the following exception:</p>
<pre>Error while processing message: java.lang.NumberFormatException: For input string: ""</pre>
<p>After digging through HAPI source, it was found that the &lt;hapi.home&gt;/id_file has to be removed.  Here is an excerpt of the helpful code comment:</p>
<pre>/**
 * Creates unique message IDs.  IDs are stored in a file called &lt;hapi.home&gt;/id_file for persistence
 * across JVM sessions.  Note that if one day you run the JVM with a new working directory,
 * you must move or copy id_file into this directory so that new ID numbers will begin
 * with the last one used, rather than starting over again.
 * @author Neal Acharya
 */</pre>
]]></content:encoded>
			<wfw:commentRss>http://code.mikwat.com/archives/4/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
