[jboss-user] [Installation, Configuration & DEPLOYMENT] - jboss 5.0 migration classloader woes

mlybarger do-not-reply at jboss.com
Mon Jan 5 11:54:26 EST 2009

So, we're looking to migrate to JBoss AS 5.0.  Recently, I ran into a problem where our applications do a lot of:

  | 			URL m_url = this.getClass().getClassLoader().getResource( "WEB-INF" );
  | 			File webinf = new File( m_url.getPath() );
  | 			File newfolder = new File( webinf.getParent(), "newfolder" );
  | 			if ( !newfolder.exists() )
  | 			{
  | 				newfolder.mkdir();
  | 			}

In this particular case, the application runs this code on deployment so as to write a bunch of xml files into the newfolder that it creates.  The application pulls the data for the xml files from a 3rd entity application (a global caching application, but one that doesn't deal with the xml files needed by this application). 

Anyway, the getResource from above was throwing an NPE on jboss 5.0.  Looking at the forums and bug list, it seems that the web application at one point had the root folder of the deployed web application in the class path of the class loader that loaded the classes deployed in the web application.  

With JBoss AS 5.0, the root folder is no longer on the classpath of the deployed application.  Whether or not the J2EE specification explicitly required this feature/behavior, jboss provided it.  

We have > 20 hits for code usage like the above.  Some of the code is never used in production, but all has to be analyzed to see if it's used, changed and then tested.  The change is small, but finding what caused the problem, making the change, then testing the change is where all the time is spent.  

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4199588#4199588

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4199588

More information about the jboss-user mailing list