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

  • Home
  • SEARCH
  • 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 933251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:48:03+00:00 2026-05-15T20:48:03+00:00

I have an application deployed on Glassfish. Over time the number of loaded classes

  • 0

I have an application deployed on Glassfish. Over time the number of loaded classes climbs into the millions and my permgen seems to rise.

To help troubleshoot I added the following to my jvm arguments.
-XX:+PrintGCDetails
-XX:+TraceClassUnloading
-XX:+TraceClassLoading

Now when watching the output, I see the same classes being loaded over and over again. Basically every time a web service is called and JAXB is used to process the xml.

[Loaded com.strikeiron.ZIPCodesInRadius$JaxbAccessorF_userID from JVM_DefineClass]
[Loaded com.strikeiron.ZIPCodesInRadius$JaxbAccessorF_userID from JVM_DefineClass]

Does this indicate a leak? If so how do I resolve it?

  • 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-05-15T20:48:04+00:00Added an answer on May 15, 2026 at 8:48 pm

    I found a similar thread that was describing the same problem I was having.
    http://forums.java.net/jive/thread.jspa?threadID=53362

    I also found a bug at
    https://github.com/javaee/jaxb-v2/issues/581

    Basically, the problem was that I was doing a new JAXBContext(“your.class.xsd”) every time my bean was invoked. According to the bug “Calling JAXBContext.newInstance(…) implies reloading of everything since either the current or the specified class loader is to be (re-)used.”

    The solution was to create a singleton which worked great.

    public enum JAXBContextSingleton {
    
    INSTANCE("your.class.xsd");
    private JAXBContext context;
    
    JAXBContextSingleton(String classToCreate) {
        try {
            this.context = JAXBContext.newInstance(classToCreate);
        } catch (JAXBException ex) {
            throw new IllegalStateException("Unbale to create JAXBContextSingleton");
        }
    }
    
    public JAXBContext getContext(){
        return context;
    }
    
    }
    

    And to use the singleton

    JAXBContext context = JAXBContextSingleton.INSTANCE.getContext();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a j2ee application deployed on GlassFish. I have mysql jars in GlassFish's
I have a Web Application deployed to a local Glassfish server which I would
I have been trying to secure an application, which is deployed to glassfish 3
I have an application deployed into multiple zones and there are some issues with
I have an JSF 2.0 application deployed on glassfish 3.1.7 with JDK 7. It's
I have written a java web application(deployed on glassfish server) to deploy on to
I have a Java EE application deployed on GlassFish. This application has 2 web
I have a basic web application packaged as an EAR deployed on GlassFish. The
I have a simple web application, packed as an EAR, deployed on Glassfish. The
I have an application developed using Primefaces 2.2.1 and JSF 2.0, deployed on Glassfish

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.