Questions tagged [classloading]
59 questions
11
votes
3 answers
NoClassDefFoundError "wrong name" for a class in the java.lang package
I'm running Cassandra 2.2.11 (and won't be upgrading) on a host. Periodically, in a cron job, I run nodetool commands for monitoring. nodetool is implemented as just another java process that uses JMX to talk to the Cassandra java process. I launch…

Savior
- 3,225
- 4
- 24
- 48
8
votes
2 answers
Why static block is not executed
As per java doc, static block is executed when the class is initialized.
Could anyone please tell me why static block is not executed when I run below code?
class A {
static {
System.out.println("Static Block");
}
}
public class…

Sridhar Srinivasan
- 83
- 3
6
votes
2 answers
OpenJdk initial startup time very slow
I'm running openjdk 11.0.3 on a server. Whenever the server has been rebooted (every night): For the first initial launch of my Application, the users have to wait for 35 Seconds before the Application is even started. (Before the first…

runholen
- 850
- 11
- 24
5
votes
1 answer
Java: Where does the Extensions Class Loader get classes from in Java 13?
All the documentation I've been able to find mentions the 'jre/lib/ext' folder but such does not exist on my JRE 13 installation.
I guess somewhere between Java 8 (where I can see the jars in jre/lib/ext) and Java 13, they moved but I've been…

DraxDomax
- 1,008
- 1
- 9
- 28
4
votes
0 answers
Are there caveats to not using the spring-boot classloader in production?
what
I would like to use jdk.internal.loader.ClassLoaders$AppClassLoader instead of spring-boots org.springframework.boot.loader.LaunchedURLClassLoader. However, I am uncertain of the implications of how this will affect the spring-boot…

flanders
- 41
- 3
4
votes
1 answer
Java class is present in classpath but startup fails with Error: Could not find or load main class
I have a jar file foobar.jar containing the following two classes:
public class Foo {
public static void main(String[] args) {
System.out.println("Foo");
}
}
The other class looks like this:
import…

boskoop
- 1,157
- 1
- 10
- 17
3
votes
2 answers
Error when trying to use dynamically loaded libraries
I'm trying to dynamically load libraries instead of shading them into my JAR to reduce file size. It's a standalone application with a Bootstrap class and a Main class. The main class is responsible for loading libraries and calling the bootstrap…

asdafadsfadsfdaf
- 43
- 5
3
votes
1 answer
Class Loading vs Initialisation: Java static final variable
Example.java
public class Example {
static final int i = 10;
static int j = 20;
static {
System.out.println("Example class loaded and initialized");
}
}
Use.java
import java.util.Scanner;
public class Use {
public…

Harshit Rajput
- 83
- 1
- 9
2
votes
2 answers
When creating lots of ByteBuddy classes, do I need to acquire locks of any kind?
I am creating several ByteBuddy classes (using DynamicTypeBuilder) and loading them. The creation of these classes and the loading of them happens on a single thread (the main thread; I do not spawn any threads myself nor do I submit anything to an…

Laird Nelson
- 15,321
- 19
- 73
- 127
2
votes
0 answers
Tomcat 8 first request processing is slow for first request
I'm working on a high performance java application. I deployed in Tomcat 8. First request processing is slow i.e. it is taking 800 milli seconds to process. After that every request is processing very fast within 50 milli seconds. I think for…

Naresh Muthyala
- 135
- 5
1
vote
1 answer
Wildfly module classloading
I have come across a rather curious issue with wildfly classloading. I have a java-ee webapp, structured as follows:
some.ear
+- some.war
+- EJBs.jar
both the war and the jar require some spring classes to function properly. I defined a spring…

Jonathan
- 2,698
- 24
- 37
1
vote
0 answers
Oracle JDBC Driver loaded in one class not accessible in another class in same package
I am working on an EAR application(deployed on WLS 12c) that has a feature to configure and test jdbc connection for Oracle. So, in my jsp page the user selects the driver as oracle.jdbc.OracleDriver, enter the connectionurl, username and password…

Ramya Gummalapuram
- 11
- 2
1
vote
1 answer
How to specify that a JBoss WildFly deployment should load its lib module with services imported?
I have an ear file with a structure like this that I'm trying to deploy in WildFly 17:
my-application-ear.ear
|-- my-ejb-jar-1.jar
|-- my-ejb-jar-2.jar
|-- lib/
|-- my-library-jar.jar
|-- ...
|-- META-INF
|-- MANIFEST.MF
|--…

richj
- 7,499
- 3
- 32
- 50
1
vote
2 answers
How to get source code location from ES6 JavaScript class instance?
I would like to generate some code from my object tree. In order to generate the required import statements, I need to find out the source code location for a given class from a class instance.
I am already able to get the expected name MyClass with…

Stefan
- 10,010
- 7
- 61
- 117
1
vote
2 answers
How Spring invokes @Bean methods if @Configuration class contains unresolvable class refs
Spring can parse @Configuration classes using ClassReaders
Assuming that we have the following scenario
We have an autoconfiguration class with multiple @Bean definitions
One of the @Bean has all conditions passed while second @Bean have…

Ashok Koyi
- 5,327
- 8
- 41
- 50