javaloader.ClassNotFoundException

136 views
Skip to first unread message

Mahmut Çifçi

unread,
Aug 6, 2018, 4:40:35 AM8/6/18
to ColdBox Platform
Hello everyone,

I want to use cbjavaloader, I put the SAP Java connector (sapjco3.jar) in the lib directory but i getting the this error;

Type: javaloader.ClassNotFoundException 
Messages: The requested class could not be found. The requested class 'JCo' could not be found in the loaded jars/directories.

my JavaLoader settings is;
javaloader = {
            // The array paths to load
            loadPaths = ['#controller.getAppRootPath()#/lib/sapjco3.jar'],
            // Load ColdFusion classes with loader
            loadColdFusionClassPath = false,
            // Attach a custom class loader as a parent
            parentClassLoader = "",
            // Directories that contain Java source code that are to be dynamically compiled
            sourceDirectories = [],
            // the directory to build the .jar file for dynamic compilation in, defaults to ./tmp
            compileDirectory = ['#controller.getAppRootPath()#/modules/cbjavaloader/models/javaloader/tmp'],
            // Whether or not the source is trusted, i.e. it is going to change? Defaults to false, so changes will be recompiled and loaded
            trustedSource = false
        };


SAPAdapter.cfc default action is;
component extends="coldbox.system.EventHandler"{

    //property name="JCo" inject="javaloader:JCo";
    property name="javaloader" inject="loader@cbjavaloader";

    // Default Action
    function Index(event,rc,prc){
        if(Not Len(getInstance("sessionStorage@cbstorages").getVar("userId"))){
            relocate("Main.Login");
        }
        prc.hello = javaloader.create( "JCo" ).init().hello();
        abort;
        rc.title    =   getSetting("appName");
        event.setView("main/index");
    }

my coldbox version 5.0
if you want to java library i can mail to you.

may you help me?
thanks

Mahmut

Ancient Programmer

unread,
Aug 6, 2018, 9:52:30 AM8/6/18
to ColdBox Platform
Add this to your Application.cfc.

this.javaSettings.loadPaths = [ ".\lib" ];

For more details, see this thread: https://groups.google.com/forum/#!searchin/coldbox/java$20loader%7Csort:date/coldbox/bsGwPIZbibU/X-Ij9yvFAwAJ

Brad Wood

unread,
Aug 6, 2018, 1:46:51 PM8/6/18
to col...@googlegroups.com
To be clear, Ancient Programmer's suggestion is not to fix javaloader, but to not require java laoder at all by just using the built in CF engine's ability to load jars.  I've had to use that jar in the past and it was quite horrible but we got it working using this.javaSettings.  I do recall having some issues on our Linux servers related to some C library that the jar tries to load.  

Thanks!

~Brad

Developer Advocate
Ortus Solutions, Corp 

ColdBox Platform: http://www.coldbox.org 



--
--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org
For Bug Reports, visit https://ortussolutions.atlassian.net/browse/COLDBOX
---
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coldbox+u...@googlegroups.com.
To post to this group, send email to col...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/coldbox/3c447eb7-46c1-45f2-8059-86d2af03188b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mahmut Çifçi

unread,
Aug 8, 2018, 9:29:38 AM8/8/18
to ColdBox Platform
Hi Brad,

I put the helloworld.jar from coldbox javaloader sample application to C:\ColdFusion2016\cfusion\lib directory.
I get the success result when I run the following code;

<cfscript>
helloWorld = createObject('java','HelloWorld');
writeDump(helloWorld);
</cfscript>

object of HelloWorld
Class NameHelloWorld
Methods
MethodReturn Type
hello()java.lang.String

When I put the helloworld.jar to my coldbox application lib folder, i get the same error
The requested class could not be found. The requested class 'HelloWorld' could not be found in the loaded jars/directories.

Thanks your support
Mahmut


6 Ağustos 2018 Pazartesi 20:46:51 UTC+3 tarihinde Brad Wood yazdı:

Brad Wood

unread,
Aug 8, 2018, 12:36:48 PM8/8/18
to col...@googlegroups.com
That's not enough information for me to help you.  Have you confirmed the this.java settings are present.  Also note, depending on your engine, I've seen CF be picking about leading slashes and the direction of slashes in your javasettings.  Might want to review those as well.

Thanks!

~Brad

Developer Advocate
Ortus Solutions, Corp 

ColdBox Platform: http://www.coldbox.org 


Mahmut Çifçi

unread,
Sep 10, 2018, 7:39:19 AM9/10/18
to ColdBox Platform
Hi Brad,

My Application.cfc javasettings are below, I didn't change this settings after installation.
thank you for your support.

2018-09-10_14-34-20.jpg




8 Ağustos 2018 Çarşamba 19:36:48 UTC+3 tarihinde Brad Wood yazdı:
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted

Mahmut Çifçi

unread,
Sep 11, 2018, 3:57:40 PM9/11/18
to ColdBox Platform
Hi,
I solved the problem, I change the javaloader class from version 1.2 to 1.0
my application is running now, hurrah :)


10 Eylül 2018 Pazartesi 14:39:19 UTC+3 tarihinde Mahmut Çifçi yazdı:
Reply all
Reply to author
Forward
0 new messages