java - Why is my classloader throwing ClassNotFoundException? -
i have abc.jar , i'm loading class using reflection. i'm getting classnotfoundexception. code below:
file file1 = new file(applicationcontext.getpath()+"lib/abc.jar"); class noparams[] = {}; url url = file1.touri().tourl(); url[] urls = new url[]{url}; @suppresswarnings("resource") classloader cl = new urlclassloader(urls); cls = cl.loadclass("com.abcd.feat.udf.mobileudf"); constructor<?> c = cls.getconstructor(); mobileudfactions = c.newinstance();
i have verified jar present in applicationcontext.getpath()/lib folder.
contents of jar appropriate. contains classes in package com/abcd/feat/udf.
please me realize mistake. i'm getting below exception.
java.lang.classnotfoundexception: com.abcd.feat.udf.mobileudf @ java.net.urlclassloader$1.run(unknown source) @ java.net.urlclassloader$1.run(unknown source) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(unknown source) @ java.lang.classloader.loadclass(unknown source) @ java.lang.classloader.loadclass(unknown source) @ com.abcd.feat.core.testscriptexecutor.<init>(testscriptexecutor.java:85)
Comments
Post a Comment