Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8396413
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:31:45+00:00 2026-06-09T20:31:45+00:00

I have a javaagent that prints out names of all classes that get loaded,

  • 0

I have a javaagent that prints out names of all classes that get loaded, and their source (where they are from).

public byte[] transform(ClassLoader loader, String className, Class redefiningClass, ProtectionDomain domain, byte[] bytes) throws IllegalClassFormatException {
        System.out.print("Loading class: " + className + "\t");
        if (domain != null) {
          final CodeSource cs = domain.getCodeSource();
          if (cs != null) {
            System.out.println(cs.getLocation());
          }
        }
        System.out.println();
        return bytes;
    }

For some classes, it prints out “null” (meaning cs.getLocation() is null). Why is this, and is there anyway to see where those classes are from? Note, I am not doing this on my own Java app, so I have no knowledge of any custom ClassLoaders it uses.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T20:31:46+00:00Added an answer on June 9, 2026 at 8:31 pm

    According to Jetty 7.0.0RC4, it appears a null CodeSource reflects that the class has global permissions.

    // 1) if protection domain codesource is null, it is the global permissions (grant {})
    

    This behavior is documented in the specification of ClassLoader.defineClass, so it isn’t arbitrary 😉

    This method assigns a default ProtectionDomain to the newly defined class. The ProtectionDomain is effectively granted the same set of permissions returned when Policy.getPolicy().getPermissions(new CodeSource(null, null)) is invoked. The default domain is created on the first invocation of defineClass, and re-used on subsequent invocations.


    Actually, looking closer, I believe this is the work of SecureClassLoader.defineClass…

    If a non-null CodeSource is supplied a ProtectionDomain is constructed and associated with the class being defined.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have seen many apps that take instrument classes and take -javaagent as a
We have a URL object in one of our Java classes that we want
I am creating a jar file of a javaagent that I have written. However,
have a nice day. I got problem when trying to create an image from
Have converted devise new session from erb to Haml but doens't work, this is
Have a rather abstract question for you all. I'm looking at getting involved in
Have a bunch of WCF REST services hosted on Azure that access a SQL
have Googled the cr*p out of this one so apologies if the answer is
Have a look at one of my websites: moskah.com The problem is that it
Have a simple contact us XPage created. Have server side validation in place that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.