Re: [JBoss-dev] CVS update: jboss-system/src/main/org/jboss/system/server ServerImpl.java ServerInfo.java ServerInfoMBean.java

2002-02-26 Thread Marcel Ammerlaan

Hi,

Lurk mode off..

Jason Dillon wrote:

o ServerImpl uses org.jboss.net.protocol.URLStreamHandlerFactory
  instead of setting system prop


Setting the system property will work but the seperator char is '|' not 
':'. The system property is a better solution as there can be only one
StreamHandlerFactory registered (but the URL class only tries to load 
resource handlers using Class.forName() and the system-classloader so
that might not work with custom classloaders).


  // Setup JBoss URL handlers
   -  String handlerPkgs = System.getProperty(java.protocol.handler.pkgs, null);
   -  if (handlerPkgs == null)
   - handlerPkgs = org.jboss.net.protocol;
   -  else
   - handlerPkgs += :org.jboss.net.protocol;
   -  System.setProperty(java.protocol.handler.pkgs, handlerPkgs );
   +  URL.setURLStreamHandlerFactory(new 
org.jboss.net.protocol.URLStreamHandlerFactory());


regards,

Marcel Ammerlaan




___
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development



Re: [JBoss-dev] CVS update: jboss-system/src/main/org/jboss/system/server ServerImpl.java ServerInfo.java ServerInfoMBean.java

2002-02-26 Thread Jason Dillon

 Setting the system property will work but the seperator char is '|' 
 not ':'. The system property is a better solution as there can be only 
 one 

I found this out when looking at the source for URL...just looked at our 
jndi.properties file for an example... which is wrong.

 StreamHandlerFactory registered (but the URL class only tries to load 
 resource handlers using Class.forName() and the system-classloader so
 that might not work with custom classloaders). 

We need to figure out why Class.forName() called from inside URL did not 
find the class then.

--jason


___
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development



Re: [JBoss-dev] CVS update: jboss-system/src/main/org/jboss/system/server ServerImpl.java ServerInfo.java ServerInfoMBean.java

2002-02-26 Thread Marcel Ammerlaan

Jason Dillon wrote:

 StreamHandlerFactory registered (but the URL class only tries to load 
 resource handlers using Class.forName() and the system-classloader so
 that might not work with custom classloaders). 
 
 
 We need to figure out why Class.forName() called from inside URL did not 
 find the class then.


I found this out the hard way (in another context). java.net.URL is 
loaded by the bootstrap classloader. Class.forName() will therefore
only look at the classloader for java.net.URL (which is
the bootstrap classloader) and the system classloader. When the resource
handler is only available to a custom classloader the handler will not
be found. A solution (and I filed a report with Sun), is to include
the thread context-classloader when looking for a resource handler 
inside the URL class. For now, there is no neat solution..

regards,

Marcel Ammerlaan





___
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development



Re: [JBoss-dev] CVS update: jboss-system/src/main/org/jboss/system/server ServerImpl.java ServerInfo.java ServerInfoMBean.java

2002-02-26 Thread Jason Dillon

Source for Class.forName() shows that it calls getCallerClassLoader() 
which is a package private native method and does... well I haven't a clue.

--jason


Hiram Chirino wrote:

 StreamHandlerFactory registered (but the URL class only tries to load
 resource handlers using Class.forName() and the system-classloader so
 that might not work with custom classloaders).


 We need to figure out why Class.forName() called from inside URL did not
 find the class then.

 --jason


 I'm not sure, but I think Class.forName will only load classes that 
 are in the same classloader that current class was loaded from.  In 
 your case (the system classloader since Class.forName() is called from 
 URL).  So you have to ask yourself, is my protocol class in the system 
 classloader?  So I think that is the problem.  The URL class should 
 have used the ContextClassLoader to load the class.

 Regards,
 Hiram


 _
 Chat with friends online, try MSN Messenger: http://messenger.msn.com


 ___
 Jboss-development mailing list
 [EMAIL PROTECTED]
 https://lists.sourceforge.net/lists/listinfo/jboss-development




___
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development



[JBoss-dev] CVS update: jboss-system/src/main/org/jboss/system/server ServerImpl.java ServerInfo.java ServerInfoMBean.java

2002-02-25 Thread Jason Dillon

  User: user57  
  Date: 02/02/25 17:36:24

  Modified:src/main/org/jboss/system/server ServerImpl.java
ServerInfo.java ServerInfoMBean.java
  Log:
   o Added getProperty() to ServerInfo (easy acess to a sys prop w/o
 having to search through showProp* output)
   o ServerImpl uses org.jboss.net.protocol.URLStreamHandlerFactory
 instead of setting system prop
  
  Revision  ChangesPath
  1.3   +2 -7  jboss-system/src/main/org/jboss/system/server/ServerImpl.java
  
  Index: ServerImpl.java
  ===
  RCS file: 
/cvsroot/jboss/jboss-system/src/main/org/jboss/system/server/ServerImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ServerImpl.java   24 Feb 2002 10:24:34 -  1.2
  +++ ServerImpl.java   26 Feb 2002 01:36:24 -  1.3
  @@ -44,7 +44,7 @@
*
* @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a
* @author a href=mailto:[EMAIL PROTECTED];Jason Dillon/a
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
*/
   public class ServerImpl
  implements ServerImplMBean
  @@ -110,12 +110,7 @@
 log.info(JBoss Release:  + jbossPackage.getImplementationTitle());
   
 // Setup JBoss URL handlers
  -  String handlerPkgs = System.getProperty(java.protocol.handler.pkgs, null);
  -  if (handlerPkgs == null)
  - handlerPkgs = org.jboss.net.protocol;
  -  else
  - handlerPkgs += :org.jboss.net.protocol;
  -  System.setProperty(java.protocol.handler.pkgs, handlerPkgs );
  +  URL.setURLStreamHandlerFactory(new 
org.jboss.net.protocol.URLStreamHandlerFactory());
   
 // create a new config object from the give properties
 this.config = new ServerConfigImpl(props);
  
  
  
  1.2   +12 -3 jboss-system/src/main/org/jboss/system/server/ServerInfo.java
  
  Index: ServerInfo.java
  ===
  RCS file: 
/cvsroot/jboss/jboss-system/src/main/org/jboss/system/server/ServerInfo.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ServerInfo.java   24 Feb 2002 10:24:34 -  1.1
  +++ ServerInfo.java   26 Feb 2002 01:36:24 -  1.2
  @@ -31,7 +31,7 @@
* @author a href=mailto:[EMAIL PROTECTED];Hiram Chirino/a
* @author a href=mailto:[EMAIL PROTECTED];Jason Dillon/a
* @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
*/
   public class ServerInfo
  implements ServerInfoMBean, MBeanRegistration
  @@ -255,8 +255,17 @@
 info.append(/pre\n);
  }
   
  -   /** Return a Map of System.getProperties() with a toString implementation
  -*that provides an html table of the key/value pairs
  +   /**
  +* Get a single system property.
  +*/
  +   public String getProperty(String name)
  +   {
  +  return System.getProperty(name);
  +   }
  +
  +   /** 
  +* Return a Map of System.getProperties() with a toString implementation
  +* that provides an html table of the key/value pairs
   */
  public Map showProperties()
  {
  
  
  
  1.2   +7 -2  
jboss-system/src/main/org/jboss/system/server/ServerInfoMBean.java
  
  Index: ServerInfoMBean.java
  ===
  RCS file: 
/cvsroot/jboss/jboss-system/src/main/org/jboss/system/server/ServerInfoMBean.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ServerInfoMBean.java  24 Feb 2002 10:24:34 -  1.1
  +++ ServerInfoMBean.java  26 Feb 2002 01:36:24 -  1.2
  @@ -23,7 +23,7 @@
* @author a href=mailto:[EMAIL PROTECTED];Jason Dillon/a
* @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a
* @author a href=mailto:[EMAIL PROTECTED];Scott Stark/a
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
*/
   public interface ServerInfoMBean
   {
  @@ -50,7 +50,7 @@
   * Return a listing of the active threads and thread groups.
   */
  String listThreadDump();
  -   
  +
  /**
   * Display the java.lang.Package info for the pkgName
   */
  @@ -63,6 +63,11 @@
   * @return a simple html report of this information
   */
  String displayInfoForClass(String className);
  +
  +   /**
  +* Get a single system property.
  +*/
  +   String getProperty(String name);
   
  /**
   * Return a Map of System.getProperties() with a toString implementation
  
  
  

___
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development