Class not found: coldfusion.runtime.java.JavaProxy when using TCCL

421 views
Skip to first unread message

Andrew

unread,
Nov 8, 2011, 11:59:11 PM11/8/11
to javaloader-dev
Hi,

I'm trying to load a java class I wrote but ran into some "JAR Hell"
issues, namely:

org.apache.xml.dtm.ref.DTMManagerDefault cannot be cast to
org.apache.xml.dtm.DTMManager

So I did a bit of searching on this list and found some discussion
about the use of the ThreadContextClassLoader, as described by Mark
here: http://groups.google.com/group/javaloader-dev/msg/9ac22919da73324f

The call to my java method is from a function that is defined in a
CFC, however I keep running into this issue:

Object Instantiation Exception.
Class not found: coldfusion.runtime.java.JavaProxy

Is there anything obvious I'm doing wrong here? Here is the CFC
function (previously the parser was created in the CFC's init()
function, but I pulled it out of there in desperation - this is what
it looks like now):

<cffunction name="parseFormAnalysis" access="public"
returntype="any" output="false">
<cfargument name="meetingCode" type="string" required="true">

<cfset var qArticle =
getArticleByMeetingCodeAndType(arguments.meetingCode,2)>
<cfset var htmlText = qArticle.html_text>
<cfset var parser = "">
<cfset var result = "">

<cfscript>
var _Thread = createObject("java", "java.lang.Thread");//
using 'Thread' breaks CFB
var currentClassloader =
_Thread.currentThread().getContextClassLoader();

try {

//set the current thread's context class loader as
Javaloader's classloader, so
//dom4j doesn't die

var paths = ArrayNew(1);
paths[1] = "C:\eclipse\workspaces\cfbuilder\national-
website-trunk\javalib\xalan-2.7.1.jar";
paths[2] = "C:\eclipse\workspaces\cfbuilder\national-
website-trunk\javalib/natweb-java-1.0-SNAPSHOT.jar";
paths[3] = "C:\eclipse\workspaces\cfbuilder\national-
website-trunk\javalib/tagsoup-1.2.1.jar";
paths[4] = "C:\eclipse\workspaces\cfbuilder\national-
website-trunk\javalib/htmlcleaner2_1.jar";
paths[5] = "C:\eclipse\workspaces\cfbuilder\national-
website-trunk\javalib/harnesslib-3.6.5.jar";
paths[6] = "C:\eclipse\workspaces\cfbuilder\national-
website-trunk\javalib/commons-lang-2.4.jar";

var loader = createObject("component",
"javaloader.JavaLoader").init(loadPaths=paths);


_Thread.currentThread().setContextClassLoader(loader.getURLClassLoader());

parser =
loader.create("org.harness.natweb.parsers.FormAnalysisParser").init();
// the line above is the line the stack trace flags as
the problem

result = parser.parsePuntersCornerArticle(htmlText);
}
catch(Any exc) {
rethrow;
}
finally
{
/*
We have to reset the classloader, due to
thread pooling.
*/

_Thread.currentThread().setContextClassLoader(currentClassloader);
}
</cfscript>


<cfreturn result>
</cffunction>

Any suggestions greatly appreciated!

Regards,
Andrew.

P.S. I'm using JavaLoader 1.0, and CF 9.0 in Multiserver mode under
JRun (NB not 9.0.1). It's pointing to

Mark Mandel

unread,
Nov 9, 2011, 12:39:09 AM11/9/11
to javaloa...@googlegroups.com
Make sure when you create your instance of JL, you tell it to use CF as the parent classloader.

Then you should have no issues.

Mark
--
E: mark....@gmail.com
T: http://www.twitter.com/neurotic
W: www.compoundtheory.com

cf.Objective(ANZ) + Flex - Nov 17, 18 - Melbourne Australia
http://www.cfobjective.com.au

2 Devs from Down Under Podcast

Andrew Myers

unread,
Nov 9, 2011, 8:24:55 AM11/9/11
to javaloa...@googlegroups.com
Thanks Mark.

Works a treat now. :-)

Best regards,
Andrew.

Rohit Sharma

unread,
Sep 3, 2014, 11:35:42 AM9/3/14
to javaloa...@googlegroups.com
Hi Mark,

I have a lame question. How do I tell Jalaoder to use CF as the parent classloader. Examples I found on the internet are not helping me. An example would be highly appreciated.

Rohit

Jim Leether

unread,
Sep 3, 2014, 12:18:07 PM9/3/14
to javaloa...@googlegroups.com

Hi Rohit,

 

I just happened to catch this in my inbox and think I can offer a quick answer.

 

I think you’re looking for the loadColdFusionClassPath attribute. 

 

Ex.

 

APPLICATION.javaloader = CreateObject("component", "solr.javaloader.JavaLoader").init(loadPaths=LOCAL.paths, loadColdFusionClassPath=true);

 

Hope this helps,

 

--Jim

 

 

Jim Leether

Owner & ColdFusion Programmer

Green Mohawk Solutions

j...@leether.com

443-944-4840

--
You received this message because you are subscribed to the Google Groups "javaloader-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to javaloader-de...@googlegroups.com.
To post to this group, send email to javaloa...@googlegroups.com.
Visit this group at http://groups.google.com/group/javaloader-dev.
For more options, visit https://groups.google.com/d/optout.

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2014.0.4765 / Virus Database: 4015/8146 - Release Date: 09/03/14

Rohit Sharma

unread,
Sep 4, 2014, 8:13:29 PM9/4/14
to javaloa...@googlegroups.com
Thanks Jim, I actually tried this but am still getting this error. "Warning: Exception was: java.lang.ClassCastException: org.apache.xerces.parsers.SAXParser cannot be cast to org.xml.sax.XMLReader"

To give you bit of background: I am able to run my Java application using Eclipse IDE but as soon as I try to run from within CF it throws this error.

Any further help you can provide is highly appreciated.

Here's full Stack Trace.

java.lang.ClassCastException: org.apache.xerces.parsers.SAXParser cannot be cast to org.xml.sax.XMLReader
at org.xml.sax.helpers.XMLReaderFactory.loadClass(XMLReaderFactory.java:198)
at org.xml.sax.helpers.XMLReaderFactory.createXMLReader(XMLReaderFactory.java:149)
at org.dom4j.io.SAXHelper.createXMLReader(SAXHelper.java:67)
at org.dom4j.io.SAXReader.createXMLReader(SAXReader.java:650)
at org.dom4j.io.SAXReader.getXMLReader(SAXReader.java:525)
at org.dom4j.io.SAXReader.read(SAXReader.java:311)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1322)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1266)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1252)
at com.dyedurhambc.colin.HibernateManager.getSessionFactory(HibernateManager.java:568)
at com.dyedurhambc.colin.HibernateManager.getSession(HibernateManager.java:279)
at com.dyedurhambc.colin.HibernateManager.getFilingXML(HibernateManager.java:241)
at com.dyedurhambc.colin.CommonForms.process(CommonForms.java:1594)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at coldfusion.runtime.java.JavaProxy.invoke(JavaProxy.java:126)
at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2432)
at cfefilingInitiate2ecfm1983136243.runPage(C:\Work\Ecorp_Existing\_scripts\efiling\efilingInitiate.cfm:141)
at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:244)
at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:444)
at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65)
at coldfusion.filter.IpFilter.invoke(IpFilter.java:64)
at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:443)
at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48)
at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)
at coldfusion.filter.PathFilter.invoke(PathFilter.java:112)
at coldfusion.filter.LicenseFilter.invoke(LicenseFilter.java:30)
at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:94)
at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)
at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)
at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:46)
at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
at coldfusion.filter.CachingFilter.invoke(CachingFilter.java:62)
at coldfusion.CfmServlet.service(CfmServlet.java:204)
at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)
at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:928)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:414)
at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:203)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:539)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:298)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
Sep 04, 2014 5:07:58 PM com.dyedurhambc.colin.CommonForms process
SEVERE: org.hibernate.HibernateException: Could not parse configuration: /hibernate.cfg.xml
org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1332)
org.hibernate.cfg.Configuration.configure(Configuration.java:1266)
org.hibernate.cfg.Configuration.configure(Configuration.java:1252)
com.dyedurhambc.colin.HibernateManager.getSessionFactory(HibernateManager.java:568)
com.dyedurhambc.colin.HibernateManager.getSession(HibernateManager.java:279)
com.dyedurhambc.colin.HibernateManager.getFilingXML(HibernateManager.java:241)
com.dyedurhambc.colin.CommonForms.process(CommonForms.java:1594)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:601)
coldfusion.runtime.java.JavaProxy.invoke(JavaProxy.java:126)
coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2432)
cfefilingInitiate2ecfm1983136243.runPage(C:\Work\Ecorp_Existing\_scripts\efiling\efilingInitiate.cfm:141)
coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:244)
coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:444)
coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65)
coldfusion.filter.IpFilter.invoke(IpFilter.java:64)
coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:443)
coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48)
coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)
coldfusion.filter.PathFilter.invoke(PathFilter.java:112)
coldfusion.filter.LicenseFilter.invoke(LicenseFilter.java:30)
coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:94)
coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)
coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)
coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:46)
coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
coldfusion.filter.CachingFilter.invoke(CachingFilter.java:62)
coldfusion.CfmServlet.service(CfmServlet.java:204)
coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)
coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:928)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:414)
org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:203)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:539)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:298)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
java.lang.Thread.run(Thread.java:722)


Rohit Sharma

unread,
Sep 4, 2014, 8:24:10 PM9/4/14
to javaloa...@googlegroups.com
Hi Jim, One more thing. I am using CF 10 on Windows. Do you know if I can use Javaloader with CF 10 or I have to use CF10's built in JavaLoading.

Thanks

Rohit

Rohit Sharma

unread,
Sep 4, 2014, 8:52:50 PM9/4/14
to javaloa...@googlegroups.com
Adding more to information, below is my source code. 

<!--- 
<cfscript>
ini = createObject("component", "_com.efiling");
rCOLIN = ini.getEFTransaction(URL.TransID);
</cfscript>
<cfswitch expression="#rCOLIN.Form_Type#">
<cfcase value="1"><cfset ClassName = "Form1"></cfcase>
<cfcase value="2"><cfset ClassName = "Form2"></cfcase>
<cfcase value="6"><cfset ClassName = "Form6"></cfcase>
<cfcase value="10"><cfset ClassName = "Form10"></cfcase>
<cfcase value="11"><cfset ClassName = "Form11"></cfcase>
<cfcase value="17"><cfset ClassName = "Form17"></cfcase>
<cfcase value="32"><cfset ClassName = "Form32"></cfcase>
<cfcase value="33"><cfset ClassName = "Form33"></cfcase>
<cfcase value="35"><cfset ClassName = "Form35"></cfcase>
<cfcase value="43"><cfset ClassName = "Form43"></cfcase>
<cfcase value="97"><cfset ClassName = "Tilat"></cfcase>
<cfcase value="98"><cfset ClassName = "Tilho"></cfcase>
<cfcase value="99"><cfset ClassName = "NWPTA"></cfcase>
<cfdefaultcase>
Error!
<cfabort>
</cfdefaultcase>
</cfswitch>
<cfscript>
ini.setEFStatus(URL.TransID, 0);
efilingGateway = createObject("java", "com.dyedurhambc.colin.#ClassName#");
efilingGateway.init(Request.EfilingGatewayConfig);
efilingGateway.process(URL.TransID);
</cfscript>

 --->



<cffunction name="dump" access="private" returntype="any">
<cfargument name="bla" required="yes" type="any">

  <cfoutput>#arguments.bla.stackTrace#</cfoutput>
</cffunction>

<cfscript>
ini = createObject("component", "_com.efiling");
rCOLIN = ini.getEFTransaction(URL.TransID);
</cfscript>

<cfswitch expression="#rCOLIN.Form_Type#">
<cfcase value="1"><cfset ClassName = "Form1"></cfcase>
<cfcase value="2"><cfset ClassName = "Form2"></cfcase>
<cfcase value="6"><cfset ClassName = "Form6"></cfcase>
<cfcase value="10"><cfset ClassName = "Form10"></cfcase>
<cfcase value="11"><cfset ClassName = "Form11"></cfcase>
<cfcase value="17"><cfset ClassName = "Form17"></cfcase>
<cfcase value="32"><cfset ClassName = "Form32"></cfcase>
<cfcase value="33"><cfset ClassName = "Form33"></cfcase>
<cfcase value="35"><cfset ClassName = "Form35"></cfcase>
<cfcase value="43"><cfset ClassName = "Form43"></cfcase>
<cfcase value="97"><cfset ClassName = "Tilat"></cfcase>
<cfcase value="98"><cfset ClassName = "Tilho"></cfcase>
<cfcase value="99"><cfset ClassName = "NWPTA"></cfcase>
<cfdefaultcase>
Error!
<cfabort>
</cfdefaultcase>
</cfswitch>

<cfset  jarPaths = arrayNew(1)>
<cfset _Thread = "" >
<cfset application.myJavaLoaderKey = "3ADB2464-CDBA-3009-DC4E746934AD83F5_javaloader">

<cfdirectory action="list" directory="#Request.EfilingGateway#" name="getJarFiles" recurse="false" filter="*.jar">
 
<!--- construct the full file paths for all jar files --->
<cfquery name="getFilePaths" dbtype="query">
SELECT Directory +'/'+ Name AS FilePath FROM getJarFiles
</cfquery>

<!--- <cfif  structKeyExists(server, application.myJavaLoaderKey)> --->
<!--- create an array of jar file paths --->
<cfset filePathList = replace(valueList(getFilePaths.FilePath, "|"), "\", "/", "all")>
<cfset jarPaths = listToArray(filePathList, "|")>

<cfset efilingClassPath = #Request.EfilingGateway#&"/bin/" >
<cfset arrayAppend(jarPaths, #efilingClassPath#) >

<!---  create an instance of the JavaLoader and store it in the server scope --->
<cflock name="#Hash(application.myJavaLoaderKey)#" type="exclusive" timeout="10">
<!---  re-verify it was not created yet --->

<!--- <cfif NOT structKeyExists(server, application.myJavaLoaderKey)> --->
<cfset server[application.myJavaLoaderKey] = createObject("component", "_includes.javaloader.JavaLoader").init( loadPaths=jarPaths, loadColdFusionClassPath=true)>
<!--- </cfif> --->
</cflock>
<!--- </cfif> --->

<cfscript>
_Thread = createObject("java", "java.lang.Thread");
currentClassloader = _Thread.currentThread().getContextClassLoader() ;

// jhds = createObject("java","org.jhades.JHades");
// jhds.findClassByName("org.apache.xerces.parsers.SAXParser");
// jhds.findClassByName("org.xml.sax.XMLReader");
// jhds.findClassByName("com.gargoylesoftware.htmlunit.BrowserVersion");

try {
_Thread.currentThread().setContextClassLoader(server[application.myJavaLoaderKey].getURLClassLoader());
ini.setEFStatus(URL.TransID, 0);

//efilingGateway = createObject("java", "com.dyedurhambc.colin.#ClassName#"); 
efilingGateway = server[application.myJavaLoaderKey].create("com.dyedurhambc.colin.#ClassName#");
efilingGateway.init(Request.EfilingGatewayConfig);
efilingGateway.process(URL.TransID);
} catch( any e) {
dump(e);
} finally { 
_Thread.currentThread().setContextClassLoader(currentClassloader);
}
</cfscript>


Mark Mandel

unread,
Sep 4, 2014, 9:10:44 PM9/4/14
to javaloa...@googlegroups.com
Sounds like:

Which I needed to use the last time I integrated Hibernate with CF (admittedly was a long time ago).

Mark

Rohit Sharma

unread,
Sep 4, 2014, 9:48:59 PM9/4/14
to javaloa...@googlegroups.com
Thanks for the link Mark. I must admit I am pretty confused with this topic. 

In my case I am setting the TCCL first and then changing it back. (i am using CF 10). is the below approach incorrect? (BTW I get error pasted in previous post using this method).


try {
 _Thread
.currentThread().setContextClassLoader(server[application.myJavaLoaderKey].getURLClassLoader());
 ini
.setEFStatus(URL.TransID, 0);


 
//efilingGateway = createObject("java", "com.dyedurhambc.colin.#ClassName#");
 efilingGateway
= server[application.myJavaLoaderKey].create("com.dyedurhambc.colin.#ClassName#");
 efilingGateway
.init(Request.EfilingGatewayConfig);
 efilingGateway
.process(URL.TransID);
 
} catch( any e) {
 
dump(e);
 
} finally {
 _Thread
.currentThread().setContextClassLoader(currentClassloader);
 
}


Mark Mandel

unread,
Sep 4, 2014, 10:56:23 PM9/4/14
to javaloa...@googlegroups.com
What happens when you use the switchThreadContextClassLoader method directly?

Mark
Message has been deleted

Rohit Sharma

unread,
Sep 5, 2014, 12:44:00 PM9/5/14
to javaloa...@googlegroups.com
Hi mark,

So after some reading I modified my code to use switchThreadContextClassLoader but am still getting same error "java.lang.ClassCastException: org.apache.xerces.parsers.SAXParser cannot be cast to org.xml.sax.XMLReader"

Here's my modified code


<cfset  jarPaths = arrayNew(1)>
<cfset _Thread = "" >
<cfset application.myJavaLoaderKey = "3ADB2464-CDBA-3009-DC4E746934AD83F5_javaloader">

<cfdirectory action="list" directory="#Request.EfilingGateway#" name="getJarFiles" recurse="false" filter="*.jar">
 
<!--- construct the full file paths for all jar files --->
<cfquery name="getFilePaths" dbtype="query">
SELECT Directory +'/'+ Name AS FilePath FROM getJarFiles
</cfquery>

<!--- <cfif  structKeyExists(server, application.myJavaLoaderKey)> --->
<!--- create an array of jar file paths --->
<cfset filePathList = replace(valueList(getFilePaths.FilePath, "|"), "\", "/", "all")>
<cfset jarPaths = listToArray(filePathList, "|")>

<cfset efilingClassPath = #Request.EfilingGateway#&"/bin/" >
<cfset arrayAppend(jarPaths, #efilingClassPath#) >

<!---  create an instance of the JavaLoader and store it in the server scope --->
<cflock name="#Hash(application.myJavaLoaderKey)#" type="exclusive" timeout="10">
<!---  re-verify it was not created yet --->

<!--- <cfif NOT structKeyExists(server, application.myJavaLoaderKey)> --->
<cfset server[application.myJavaLoaderKey] = createObject("component", "_includes.javaloader.JavaLoader").init( loadPaths=jarPaths, loadColdFusionClassPath=true)>
<!--- </cfif> --->
</cflock>
<!--- </cfif> --->

<cfscript>
response = server[application.myJavaLoaderKey].switchThreadContextClassLoader(processEfiling);
</cfscript>

<cffunction name="processEfiling" access="private" returntype="String" output="false" >
<cfscript>
ini = createObject("component", "_com.efiling");
rCOLIN = ini.getEFTransaction(URL.TransID);
</cfscript>

<cfswitch expression="#rCOLIN.Form_Type#">
<cfcase value="1"><cfset ClassName = "Form1"></cfcase>
<cfcase value="2"><cfset ClassName = "Form2"></cfcase>
<cfcase value="6"><cfset ClassName = "Form6"></cfcase>
<cfcase value="10"><cfset ClassName = "Form10"></cfcase>
<cfcase value="11"><cfset ClassName = "Form11"></cfcase>
<cfcase value="17"><cfset ClassName = "Form17"></cfcase>
<cfcase value="32"><cfset ClassName = "Form32"></cfcase>
<cfcase value="33"><cfset ClassName = "Form33"></cfcase>
<cfcase value="35"><cfset ClassName = "Form35"></cfcase>
<cfcase value="43"><cfset ClassName = "Form43"></cfcase>
<cfcase value="97"><cfset ClassName = "Tilat"></cfcase>
<cfcase value="98"><cfset ClassName = "Tilho"></cfcase>
<cfcase value="99"><cfset ClassName = "NWPTA"></cfcase>
<cfdefaultcase>
Error!
<cfabort>
</cfdefaultcase>
</cfswitch>

<cfscript>
//efilingGateway = createObject("java", "com.dyedurhambc.colin.#ClassName#"); 
ini.setEFStatus(URL.TransID, 0);

efilingGateway = server[application.myJavaLoaderKey].create("com.dyedurhambc.colin.#ClassName#");
efilingGateway.init(Request.EfilingGatewayConfig);
var response = efilingGateway.process(URL.TransID);
</cfscript>

<cfreturn response >
</cffunction>

Rohit Sharma

unread,
Sep 5, 2014, 2:09:34 PM9/5/14
to javaloa...@googlegroups.com
Just wanted to mention that I have resolved my issues. Hibernate was using dependency ehcache that had to be upgraded from 1.1 to 2.7.

Mark Mandel

unread,
Sep 7, 2014, 7:50:52 PM9/7/14
to javaloa...@googlegroups.com
Glad to hear it!

Mark

On 6 September 2014 04:09, Rohit Sharma <ro...@clevertech.biz> wrote:
Just wanted to mention that I have resolved my issues. Hibernate was using dependency ehcache that had to be upgraded from 1.1 to 2.7.

--
You received this message because you are subscribed to the Google Groups "javaloader-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to javaloader-de...@googlegroups.com.
To post to this group, send email to javaloa...@googlegroups.com.
Visit this group at http://groups.google.com/group/javaloader-dev.
For more options, visit https://groups.google.com/d/optout.

Rohit Sharma

unread,
Nov 14, 2017, 11:14:07 PM11/14/17
to javaloader-dev
Hi Mark,

I have recently upgraded to CF2016 on my UAT server and am getting java.lang.ClassCastException: java.land.NoClassDefFoundError cannot be cast to java.lang.Exception

I am on Javaloader 1.2.

Any thoughts you can share would be much appreciated.

Rohit

2112...@gmail.com

unread,
May 11, 2018, 3:40:15 PM5/11/18
to javaloader-dev
Rohit,
  Did you ever receive any thoughts from anyone?  I'm getting the same error using JaaLoader 1.2 after upgrading to CF11.

Brian Meloche

unread,
May 11, 2018, 3:53:57 PM5/11/18
to javaloa...@googlegroups.com
Isn’t JavaLoader redundant on CF2016, since ColdFusion can do it natively?


For more options, visit https://groups.google.com/d/optout.
--
Sincerely,


Brian Meloche
216-978-7834
Reply all
Reply to author
Forward
0 new messages