[Design of Security on JBoss] - Legacy client SecurityAssociation
by adrian@jboss.org
This work:
http://jira.jboss.com/jira/browse/SECURITY-75
isn't much use without this:
http://jira.jboss.com/jira/browse/SECURITY-125
Most clients (if they used the SecurityAssociation api) will be using on the client
to do a single login for the entire jvm.
When the SecurityAssociation is not in server mode, it doesn't work at all with JBoss5.
e.g. You can see this in org.jboss.test.jmx.test.DeployXMBeanUnitTestCase
The following patch makes it work:
| [ejort@warjort testsuite]$ svn diff
| Index: src/main/org/jboss/test/jmx/test/DeployXMBeanUnitTestCase.java
| ===================================================================
| --- src/main/org/jboss/test/jmx/test/DeployXMBeanUnitTestCase.java (revision 74958)
| +++ src/main/org/jboss/test/jmx/test/DeployXMBeanUnitTestCase.java (working copy)
| @@ -487,6 +487,7 @@
| }
|
| SimplePrincipal jduke = new SimplePrincipal("jduke");
| + SecurityAssociation.setServer();
| SecurityAssociation.setPrincipal(jduke);
| SecurityAssociation.setCredential("theduke".toCharArray());
| naming.bind(hello, "HelloBinding", "java.lang.String");
| @@ -536,6 +537,7 @@
| Name hello = ctx.getNameParser("").parse("Hello");
|
| SimplePrincipal jduke = new SimplePrincipal("jduke");
| + SecurityAssociation.setServer();
| SecurityAssociation.setPrincipal(jduke);
| SecurityAssociation.setCredential("theduke".toCharArray());
|
But that isn't the correct fix.
There's a tonne of other code in the JBoss5 testsuite still using the SecurityAssoication:
| [ejort@warjort test]$ grep -ri SecurityAssociation * | grep -v svn
| aop/bean/SecurityTester.java: //SecurityAssociation.pushSubjectContext(null, new SimplePrincipal("somebody"), password);
| aop/bean/SecurityTester.java: /*SecurityAssociation.popSubjectContext();
| aop/bean/SecurityTester.java: SecurityAssociation.pushSubjectContext(null, new SimplePrincipal("authfail"), password);
| aop/bean/SecurityTester.java: SecurityAssociation.popSubjectContext();
| aop/bean/SecurityTester.java: SecurityAssociation.pushSubjectContext(null, new SimplePrincipal("rolefail"), password);
| aop/bean/SecurityTester.java: SecurityAssociation.popSubjectContext();
| aop/bean/SecurityTester.java: SecurityAssociation.pushSubjectContext(null, new SimplePrincipal("pass"), password);
| aop/bean/SimpleBeanTester.java:import org.jboss.security.SecurityAssociation;
| cluster/invokerha/HAService.java:import org.jboss.security.SecurityAssociation;
| cluster/invokerha/HAService.java: SecurityAssociation.setPrincipal(principal);
| cluster/invokerha/HAService.java: SecurityAssociation.setCredential(credential);
| cluster/invokerha/HAService.java: SecurityAssociation.clear();
| jacc/test/portal/BasePortalJaccTestCase.java:import org.jboss.security.SecurityAssociation;
| jacc/test/portal/BasePortalJaccTestCase.java: SecurityAssociation.setSubject(subject);
| jmx/interceptors/PrincipalInterceptor.java:import org.jboss.security.SecurityAssociation;
| jmx/interceptors/PrincipalInterceptor.java: Principal caller = SecurityAssociation.getPrincipal();
| jmx/interceptors/JNDISecurity.java:import org.jboss.security.SecurityAssociation;
| jmx/interceptors/JNDISecurity.java: SecurityAssociation.pushSubjectContext(subject, principal, credential);
| jmx/interceptors/JNDISecurity.java: SecurityAssociation.popSubjectContext();
| jmx/test/DeployXMBeanUnitTestCase.java:import org.jboss.security.SecurityAssociation;
| jmx/test/DeployXMBeanUnitTestCase.java: SecurityAssociation.setServer();
| jmx/test/DeployXMBeanUnitTestCase.java: SecurityAssociation.setPrincipal(jduke);
| jmx/test/DeployXMBeanUnitTestCase.java: SecurityAssociation.setCredential("theduke".toCharArray());
| jmx/test/DeployXMBeanUnitTestCase.java: SecurityAssociation.setPrincipal(guest);
| jmx/test/DeployXMBeanUnitTestCase.java: SecurityAssociation.setCredential("guest".toCharArray());
| jmx/test/DeployXMBeanUnitTestCase.java: SecurityAssociation.setServer();
| jmx/test/DeployXMBeanUnitTestCase.java: SecurityAssociation.setPrincipal(jduke);
| jmx/test/DeployXMBeanUnitTestCase.java: SecurityAssociation.setCredential("theduke".toCharArray());
| naming/test/SecurityUnitTestCase.java:import org.jboss.security.SecurityAssociation;
| naming/test/SecurityUnitTestCase.java: Principal p = SecurityAssociation.getPrincipal();
| naming/test/SecurityUnitTestCase.java: assertTrue("SecurityAssociation.getPrincipal is null", p == null);
| security/interceptors/ClientEncryptionInterceptor.java:import org.jboss.security.SecurityAssociation;
| security/interceptors/ClientEncryptionInterceptor.java: Subject subject = SecurityAssociation.getSubject();
| security/interceptors/ServerEncryptionInterceptor.java:import org.jboss.security.SecurityAssociation;
| security/interceptors/ServerEncryptionInterceptor.java: Subject subject = SecurityAssociation.getSubject();
| security/ejb/SubjectSessionBean.java:import org.jboss.security.SecurityAssociation;
| security/ejb/SubjectSessionBean.java: * SecurityAssociation.getSubject and PolicyContext. This will not run under
| security/ejb/SubjectSessionBean.java: validateSecurityAssociationSubject("enter", callerPrincipals);
| security/ejb/SubjectSessionBean.java: validateSecurityAssociationSubject("post stateless", callerPrincipals);
| security/ejb/SubjectSessionBean.java: validateSecurityAssociationSubject("post stateful", callerPrincipals);
| security/ejb/SubjectSessionBean.java: validateSecurityAssociationSubject("exit", callerPrincipals);
| security/ejb/SubjectSessionBean.java: * Get the active subject as seen by the jboss SecurityAssociation
| security/ejb/SubjectSessionBean.java: protected void validateSecurityAssociationSubject(String ctx, Set callerPrincipals)
| security/ejb/SubjectSessionBean.java: Subject caller = SecurityAssociation.getSubject();
| security/ejb/SubjectSessionBean.java: String msg = ctx+", SecurityAssociation subject: "+caller
| security/ejb/SecuredBean.java: * SecurityAssociation.getSubject and PolicyContext. This will not run under
| security/test/SecurityMgrStressTestCase.java:import org.jboss.security.auth.callback.SecurityAssociationHandler;
| security/test/SecurityMgrStressTestCase.java: //SecurityAssociation.setServer();
| security/test/SecurityMgrStressTestCase.java: JaasSecurityManager secMgr = new JaasSecurityManager("testIdentity", new SecurityAssociationHandler());
| security/test/SecurityMgrStressTestCase.java: //SecurityAssociation.pushSubjectContext(subject, user, "any");
| security/test/ClientLoginModuleUnitTestCase.java:import org.jboss.security.SecurityAssociation;
| security/test/ClientLoginModuleUnitTestCase.java: ClientLoginModuleUnitTestCase/SecurityAssociation interaction tests
| security/test/ClientLoginModuleUnitTestCase.java: //Clear SecurityAssociation
| security/test/ClientLoginModuleUnitTestCase.java: SecurityAssociation.clear();
| security/test/ClientLoginModuleUnitTestCase.java: Principal saPrincipal = SecurityAssociation.getPrincipal();
| security/test/ClientLoginModuleUnitTestCase.java: assertTrue("SecurityAssociation.getPrincipal == theduke", saPrincipal.equals(theduke));
| security/test/ClientLoginModuleUnitTestCase.java: char[] password = (char[]) SecurityAssociation.getCredential();
| security/test/ClientLoginModuleUnitTestCase.java: SecurityAssociation.setPrincipal(jduke1);
| security/test/ClientLoginModuleUnitTestCase.java: SecurityAssociation.setCredential("theduke1");
| security/test/ClientLoginModuleUnitTestCase.java: Principal saPrincipal = SecurityAssociation.getPrincipal();
| security/test/ClientLoginModuleUnitTestCase.java: assertTrue("SecurityAssociation.getPrincipal == jduke2", saPrincipal.equals(jduke2));
| security/test/ClientLoginModuleUnitTestCase.java: char[] password = (char[]) SecurityAssociation.getCredential();
| security/test/ClientLoginModuleUnitTestCase.java: saPrincipal = SecurityAssociation.getPrincipal();
| security/test/ClientLoginModuleUnitTestCase.java: assertTrue("SecurityAssociation.getPrincipal == jduke1", saPrincipal.equals(jduke1));
| security/test/ClientLoginModuleUnitTestCase.java: String theduke1 = (String) SecurityAssociation.getCredential();
| security/test/ClientLoginModuleUnitTestCase.java: SecurityAssociation.pushSubjectContext(subject1, jduke1, "theduke1");
| security/test/ClientLoginModuleUnitTestCase.java: SecurityAssociation.pushSubjectContext(subject2, jduke2, "theduke2");
| security/test/ClientLoginModuleUnitTestCase.java: Principal saPrincipal = SecurityAssociation.getPrincipal();
| security/test/ClientLoginModuleUnitTestCase.java: assertTrue("SecurityAssociation.getPrincipal == jduke3", saPrincipal.equals(jduke3));
| security/test/ClientLoginModuleUnitTestCase.java: char[] password = (char[]) SecurityAssociation.getCredential();
| security/test/ClientLoginModuleUnitTestCase.java: SecurityAssociation.SubjectContext sc3 = SecurityAssociation.peekSubjectContext();
| security/test/ClientLoginModuleUnitTestCase.java: assertTrue("SecurityAssociation.peekSubjectContext == jduke3", sc3.getPrincipal().equals(jduke3));
| security/test/ClientLoginModuleUnitTestCase.java: SecurityAssociation.SubjectContext sc2 = SecurityAssociation.peekSubjectContext();
| security/test/ClientLoginModuleUnitTestCase.java: assertTrue("SecurityAssociation.peekSubjectContext == jduke2", sc2.getPrincipal().equals(jduke2));
| security/test/ClientLoginModuleUnitTestCase.java: SecurityAssociation.popSubjectContext();
| security/test/ClientLoginModuleUnitTestCase.java: SecurityAssociation.SubjectContext sc1 = SecurityAssociation.peekSubjectContext();
| security/test/ClientLoginModuleUnitTestCase.java: assertTrue("SecurityAssociation.peekSubjectContext == jduke1", sc1.getPrincipal().equals(jduke1));
| security/test/ClientLoginModuleUnitTestCase.java: Principal saPrincipal = SecurityAssociation.getPrincipal();
| security/test/ClientLoginModuleUnitTestCase.java: assertTrue("SecurityAssociation.getPrincipal == theduke", saPrincipal.equals(theduke));
| security/test/ClientLoginModuleUnitTestCase.java: char[] password = (char[]) SecurityAssociation.getCredential();
| security/test/ClientLoginModuleUnitTestCase.java: SecurityAssociation.setPrincipal(jduke1);
| security/test/ClientLoginModuleUnitTestCase.java: SecurityAssociation.setCredential("theduke1");
| security/test/ClientLoginModuleUnitTestCase.java: Principal saPrincipal = SecurityAssociation.getPrincipal();
| security/test/ClientLoginModuleUnitTestCase.java: assertTrue("SecurityAssociation.getPrincipal == jduke2", saPrincipal.equals(jduke2));
| security/test/ClientLoginModuleUnitTestCase.java: char[] password = (char[]) SecurityAssociation.getCredential();
| security/test/ClientLoginModuleUnitTestCase.java: saPrincipal = SecurityAssociation.getPrincipal();
| security/test/ClientLoginModuleUnitTestCase.java: assertTrue("SecurityAssociation.getPrincipal == jduke1", saPrincipal.equals(jduke1));
| security/test/ClientLoginModuleUnitTestCase.java: String theduke1 = (String) SecurityAssociation.getCredential();
| security/test/ClientLoginModuleUnitTestCase.java: SecurityAssociation.pushSubjectContext(subject1, jduke1, "theduke1");
| security/test/ClientLoginModuleUnitTestCase.java: SecurityAssociation.pushSubjectContext(subject2, jduke2, "theduke2");
| security/test/ClientLoginModuleUnitTestCase.java: Principal saPrincipal = SecurityAssociation.getPrincipal();
| security/test/ClientLoginModuleUnitTestCase.java: assertTrue("SecurityAssociation.getPrincipal == jduke3", saPrincipal.equals(jduke3));
| security/test/ClientLoginModuleUnitTestCase.java: char[] password = (char[]) SecurityAssociation.getCredential();
| security/test/ClientLoginModuleUnitTestCase.java: SecurityAssociation.SubjectContext sc3 = SecurityAssociation.peekSubjectContext();
| security/test/ClientLoginModuleUnitTestCase.java: assertTrue("SecurityAssociation.peekSubjectContext == jduke3", sc3.getPrincipal().equals(jduke3));
| security/test/ClientLoginModuleUnitTestCase.java: SecurityAssociation.SubjectContext sc2 = SecurityAssociation.peekSubjectContext();
| security/test/ClientLoginModuleUnitTestCase.java: assertTrue("SecurityAssociation.peekSubjectContext == jduke2", sc2.getPrincipal().equals(jduke2));
| security/test/ClientLoginModuleUnitTestCase.java: SecurityAssociation.popSubjectContext();
| security/test/ClientLoginModuleUnitTestCase.java: SecurityAssociation.SubjectContext sc1 = SecurityAssociation.peekSubjectContext();
| security/test/ClientLoginModuleUnitTestCase.java: assertTrue("SecurityAssociation.peekSubjectContext == jduke1", sc1.getPrincipal().equals(jduke1));
| security/test/SRPLoginModuleUnitTestCase.java:import org.jboss.security.SecurityAssociation;
| security/test/SRPLoginModuleUnitTestCase.java: Principal user = SecurityAssociation.getPrincipal();
| security/test/SRPLoginModuleUnitTestCase.java: byte[] key = (byte[]) SecurityAssociation.getCredential();
| security/test/SAThreadLocalUnitTestCase.java:import org.jboss.security.SecurityAssociation;
| security/test/SAThreadLocalUnitTestCase.java: SecurityAssociation.pushSubjectContext(authSubject, authPrincipal, "theduke");
| security/test/SAThreadLocalUnitTestCase.java: * SecurityAssociation.getSubject() == authSubject
| security/test/SAThreadLocalUnitTestCase.java: * SecurityAssociation.getPrincipal() == authPrincipal
| security/test/SAThreadLocalUnitTestCase.java: Subject s = SecurityAssociation.getSubject();
| security/test/SAThreadLocalUnitTestCase.java: Principal p = SecurityAssociation.getPrincipal();
| security/test/SAThreadLocalUnitTestCase.java: System.setProperty("org.jboss.security.SecurityAssociation.ThreadLocal", "true");
| security/test/SAThreadLocalUnitTestCase.java: SecurityAssociation.setServer();
| security/test/LoginModulesUnitTestCase.java:import org.jboss.security.SecurityAssociation;
| security/test/LoginModulesUnitTestCase.java:import org.jboss.security.auth.callback.SecurityAssociationHandler;
| security/test/LoginModulesUnitTestCase.java: Principal saPrincipal = SecurityAssociation.getPrincipal();
| security/test/LoginModulesUnitTestCase.java: assertTrue("SecurityAssociation.getPrincipal == scott", saPrincipal.equals(scott));
| security/test/LoginModulesUnitTestCase.java: saPrincipal = SecurityAssociation.getPrincipal();
| security/test/LoginModulesUnitTestCase.java: assertTrue("SecurityAssociation.getPrincipal == scott2", saPrincipal.equals(scott2));
| security/test/LoginModulesUnitTestCase.java: saPrincipal = SecurityAssociation.getPrincipal();
| security/test/LoginModulesUnitTestCase.java: assertTrue("SecurityAssociation.getPrincipal == scott", saPrincipal.equals(scott));
| security/test/LoginModulesUnitTestCase.java: SecurityAssociation.setPrincipal(new SimplePrincipal("jduke2"));
| security/test/LoginModulesUnitTestCase.java: SecurityAssociation.setCredential("theduke2".toCharArray());
| security/test/LoginModulesUnitTestCase.java: SecurityAssociationHandler handler = new SecurityAssociationHandler(x509, cert);
| security/test/LoginModulesUnitTestCase.java: SecurityAssociationHandler handler = new SecurityAssociationHandler(x509, cert);
| security/test/SAInheritableThreadLocalUnitTestCase.java:import org.jboss.security.SecurityAssociation;
| security/test/SAInheritableThreadLocalUnitTestCase.java: * Test the expected security context exists via the SecurityAssociation accessors
| security/test/SAInheritableThreadLocalUnitTestCase.java: SecurityAssociation.pushSubjectContext(authSubject, authPrincipal, "theduke");
| security/test/SAInheritableThreadLocalUnitTestCase.java: SecurityAssociation.pushSubjectContext(authSubject, authPrincipal, "theduke");
| security/test/SAInheritableThreadLocalUnitTestCase.java: * SecurityAssociation.getSubject() == authSubject
| security/test/SAInheritableThreadLocalUnitTestCase.java: * SecurityAssociation.getPrincipal() == authPrincipal
| security/test/SAInheritableThreadLocalUnitTestCase.java: Subject s = SecurityAssociation.getSubject();
| security/test/SAInheritableThreadLocalUnitTestCase.java: Principal p = SecurityAssociation.getPrincipal();
| security/test/SAInheritableThreadLocalUnitTestCase.java: System.setProperty("org.jboss.security.SecurityAssociation.ThreadLocal", "false");
| security/test/SAInheritableThreadLocalUnitTestCase.java: SecurityAssociation.setServer();
| security/test/SubjectContextUnitTestCase.java:import org.jboss.security.SecurityAssociation;
| security/test/SubjectContextUnitTestCase.java: SecurityAssociation.clear();
| security/test/SubjectContextUnitTestCase.java: SecurityAssociation.clear();
| security/test/SubjectContextUnitTestCase.java: SecurityAssociation.clear();
| security/test/JaasSecurityManagerUnitTestCase.java:import org.jboss.security.auth.callback.SecurityAssociationHandler;
| security/test/JaasSecurityManagerUnitTestCase.java: CallbackHandler handler = new SecurityAssociationHandler(jduke, "theduke".toCharArray());
| security/test/JaasSecurityManagerUnitTestCase.java: CallbackHandler handler = new SecurityAssociationHandler(jduke, "theduke".toCharArray());
| securitymgr/ejb/IOStatelessSessionBean.java:import org.jboss.security.SecurityAssociation;
| securitymgr/ejb/BadBean.java:import org.jboss.security.SecurityAssociation;
| securitymgr/ejb/BadBean.java: return SecurityAssociation.getPrincipal();
| securitymgr/ejb/BadBean.java: return SecurityAssociation.getCredential();
| securitymgr/ejb/BadBean.java: SecurityAssociation.setPrincipal(user);
| securitymgr/ejb/BadBean.java: SecurityAssociation.setCredential(password);
| securitymgr/ejb/BadBean.java: Subject s = SecurityAssociation.getSubject();
| securitymgr/ejb/BadBean.java: Subject s = SecurityAssociation.getSubject();
| securitymgr/ejb/BadBean.java: SecurityAssociation.pushSubjectContext(s, null, null);
| securitymgr/ejb/BadBean.java: SecurityAssociation.popRunAsIdentity();
| securitymgr/ejb/BadBean.java: SecurityAssociation.pushRunAsIdentity(runAs);
| securitymgr/test/SecurityUnitTestCase.java: /** Test that a bean cannot access the SecurityAssociation class
| securitymgr/test/PolicyUnitTestCase.java: /** Test that a bean cannot access the SecurityAssociation class
| securitymgr/test/PolicyUnitTestCase.java: public void testSecurityAssociation() throws Exception
| securitymgr/test/PolicyUnitTestCase.java: log.debug("+++ testSecurityAssociation()");
| web/test/FormAuthUnitTestCase.java: * a SecurityAssociation setting Subject.
| web/security/JASPISecurityFilter.java:import org.jboss.security.auth.callback.SecurityAssociationHandler;
| web/security/JASPISecurityFilter.java: CallbackHandler cbh = new SecurityAssociationHandler();
| web/servlets/SecureServlet.java:import org.jboss.security.SecurityAssociation;
| web/servlets/SecureServlet.java: // Assert that there is a valid SecurityAssociation Subject
| web/servlets/SecureServlet.java: Subject subject = SecurityAssociation.getSubject();
| webservice/jbws309/JBWS309TestCase.java:import org.jboss.security.SecurityAssociation;
| webservice/jbws309/JBWS309TestCase.java: SecurityAssociation.setPrincipal(null);
| webservice/jbws309/JBWS309TestCase.java: SecurityAssociation.setCredential(null);
| webservice/jbws309/JBWS309TestCase.java: SecurityAssociation.setPrincipal(new SimplePrincipal(USERNAME));
| webservice/jbws309/JBWS309TestCase.java: SecurityAssociation.setCredential(PASSWORD);
|
Some of these are probably running on the server side so the mapping should work?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4160303#4160303
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4160303
16 years
[Design of JBoss Web Services] - JBWS-2234 - SOAP 1.2 JAX-RPC Endpoint sends SOAP 1.1 message
by darran.lofthouse@jboss.com
I am currently working on continuing the following Jira issue and adding a full test case: -
http://jira.jboss.com/jira/browse/JBWS-2234
I am now seeing that requests are correctly received as SOAP 1.2 and the response is being correctly sent back as SOAP 1.2 but for both checked and unchecked exceptions these are being sent back as SOAP 1.1.
Looking at the classes CommonSOAPBinding and CommonSOAP12Binding these both create a MessageFactoryImpl with the correct envelope namespace so messages created by these are now correct.
However the SOAPFaults are created by a different utility: -
SOAPFaultHelperJAXRPC and SOAPFaultHelperJAXWS - both of these create a new MessageFactoryImpl with the default envelope namespace so default to SOAP 1.1.
I did start to think that both of these should have the CommonSOAPBinding passed in and that the could use that to create the message so it will correctly reflect SOAP 1.2 and 1.1 as required.
For the JAX-RPC implementation this would be fine but when JAX-WS is added there are further calls to cope with that make this impossible.
The SOAPFaultHelperJAXWS calls the SOAPFaultHelperJAXRPC so anything required for JAX-RPC needs to be present from JAX-WS.
The SOAPFaultHelperJAXWS can also be called from the following classes: -
MessageBinding
PayloadBinding
HandlerChainExecutor
These no longer extend the CommonSOAPBinding so this is not something we can pass in.
A couple of ideas I have thought of.
- Anything that calls either of the FaultHelper classes should pass in the correct MessageFactoryImpl
- The CommonBinding interface could have a createMessage method added and then CommonBinding is passed in for the calls.
Either of these might be options but things get slightly more complicated with the HandlerChainExecutor as the CommonBinding is not available there.
Are there any further thoughts on the correct envelope namespace being made available for all faults created using either FaultHelper?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4160301#4160301
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4160301
16 years
[Design of Messaging on JBoss (Messaging/JBoss)] - Work done on CP branch without any corresponding JIRA
by timfox
I am trying to prepare the CP branch to release 1.4.0.SP3_CP03 for EAP 4.3.CP02, and I have done a diff between its current state and the state from the 1.4.0.SP3_CP02 tag, and I see several changes which have no corresponding JIRAs:
| Index: tests/src/org/jboss/test/messaging/tools/container/ClassLoaderJMXWrapper.java
| ===================================================================
| --- tests/src/org/jboss/test/messaging/tools/container/ClassLoaderJMXWrapper.java (.../branches/Branch_JBossMessaging_1_4_0_SP3_CP) (revision 4568)
| +++ tests/src/org/jboss/test/messaging/tools/container/ClassLoaderJMXWrapper.java (.../tags/JBossMessaging_1_4_0_SP3_CP02) (revision 4568)
| @@ -21,7 +21,9 @@
| */
| package org.jboss.test.messaging.tools.container;
|
| -import org.jboss.util.loading.DelegatingClassLoader;
| +import java.lang.reflect.Array;
| +import java.net.URL;
| +import java.net.URLClassLoader;
|
| /**
| * We extend URLClassLoader just to prevent UnifiedLoaderRepository3 to generate spurious warning
| @@ -33,7 +35,7 @@
| *
| * $Id$
| */
| -public class ClassLoaderJMXWrapper extends DelegatingClassLoader implements ClassLoaderJMXWrapperMBean
| +public class ClassLoaderJMXWrapper extends URLClassLoader implements ClassLoaderJMXWrapperMBean
| {
| // Constants -----------------------------------------------------
|
| @@ -41,13 +43,45 @@
|
| // Attributes ----------------------------------------------------
|
| + private ClassLoader delegate;
| +
| // Constructors --------------------------------------------------
|
| public ClassLoaderJMXWrapper(ClassLoader delegate)
| {
| - super(delegate);
| + super(new URL[0]);
| + this.delegate = delegate;
| }
|
| + // ClassLoaderJMXWrapperMBean implementation ---------------------
| +
| + public Class loadClass(String name) throws ClassNotFoundException
| + {
| + if (name.endsWith("[]"))
| + {
| + name = name.substring(0, name.length() - 2);
| +
| + //The classloader of an array type is the classloader of it's element (if non primitive)
| +
| + Class cl = delegate.loadClass(name);
| +
| + Object arr = Array.newInstance(cl, 0);
| +
| + return arr.getClass();
| + }
| + else
| + {
| + return delegate.loadClass(name);
| + }
| + }
| +
| + // ClassLoader overrides -----------------------------------------
| +
| + public URL getResource(String name)
| + {
| + return delegate.getResource(name);
| + }
| +
| // Public --------------------------------------------------------
|
| // Package protected ---------------------------------------------
| Index: tests/src/org/jboss/test/messaging/tools/ServerManagement.java
| ===================================================================
| --- tests/src/org/jboss/test/messaging/tools/ServerManagement.java (.../branches/Branch_JBossMessaging_1_4_0_SP3_CP) (revision 4568)
| +++ tests/src/org/jboss/test/messaging/tools/ServerManagement.java (.../tags/JBossMessaging_1_4_0_SP3_CP02) (revision 4568)
| @@ -500,13 +500,13 @@
|
| String classPath = System.getProperty("java.class.path");
|
| - if (System.getProperty("os.name").toLowerCase().contains("windows"))
| + if (System.getProperty("os.name").equals("Linux"))
| {
| - sb.append("-cp").append(" \"").append(classPath).append("\" ");
| + sb.append("-cp").append(" ").append(classPath).append(" ");
| }
| else
| {
| - sb.append("-cp").append(" ").append(classPath).append(" ");
| + sb.append("-cp").append(" \"").append(classPath).append("\" ");
| }
|
| // As there is a problem with Multicast and JGroups on Linux (in certain JDKs)
| Index: tests/src/org/jboss/test/messaging/jms/bridge/SimpleCrashWithRestartTest.java
| ===================================================================
| --- tests/src/org/jboss/test/messaging/jms/bridge/SimpleCrashWithRestartTest.java (.../branches/Branch_JBossMessaging_1_4_0_SP3_CP) (revision 4568)
| +++ tests/src/org/jboss/test/messaging/jms/bridge/SimpleCrashWithRestartTest.java (.../tags/JBossMessaging_1_4_0_SP3_CP02) (revision 4568)
| @@ -1,136 +0,0 @@
| -/*
| - * JBoss, Home of Professional Open Source
| - * Copyright 2005, JBoss Inc., and individual contributors as indicated
| - * by the @authors tag. See the copyright.txt in the distribution for a
| - * full listing of individual contributors.
| - *
| - * This is free software; you can redistribute it and/or modify it
| - * under the terms of the GNU Lesser General Public License as
| - * published by the Free Software Foundation; either version 2.1 of
| - * the License, or (at your option) any later version.
| - *
| - * This software is distributed in the hope that it will be useful,
| - * but WITHOUT ANY WARRANTY; without even the implied warranty of
| - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
| - * Lesser General Public License for more details.
| - *
| - * You should have received a copy of the GNU Lesser General Public
| - * License along with this software; if not, write to the Free
| - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
| - * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
| - */
| -package org.jboss.test.messaging.jms.bridge;
| -
| -import java.util.Properties;
| -
| -import org.jboss.jms.jndi.JMSProviderAdapter;
| -import org.jboss.jms.server.bridge.Bridge;
| -import org.jboss.logging.Logger;
| -import org.jboss.test.messaging.tools.ServerManagement;
| -import org.jboss.test.messaging.tools.TestJMSProviderAdaptor;
| -import org.jboss.test.messaging.tools.aop.PoisonInterceptor;
| -
| -/**
| - * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
| - * @version <tt>$Revision$</tt>
| - *
| - * $Id$
| - *
| - */
| -public class SimpleCrashWithRestartTest extends BridgeTestBase
| -{
| - private static final Logger log = Logger.getLogger(ReconnectTest.class);
| -
| - public SimpleCrashWithRestartTest(String name)
| - {
| - super(name);
| - }
| -
| - protected void setUp() throws Exception
| - {
| - super.setUp();
| -
| - //Now install local JMSProviderAdaptor classes
| -
| - Properties props1 = new Properties();
| - props1.putAll(ServerManagement.getJNDIEnvironment(1));
| -
| - JMSProviderAdapter targetAdaptor =
| - new TestJMSProviderAdaptor(props1, "/XAConnectionFactory", "adaptor1");
| -
| - sc.installJMSProviderAdaptor("adaptor1", targetAdaptor);
| -
| - sc.startRecoveryManager();
| - }
| -
| - protected void tearDown() throws Exception
| - {
| - super.tearDown();
| -
| - sc.stopRecoveryManager();
| -
| - sc.uninstallJMSProviderAdaptor("adaptor1");
| -
| - log.debug(this + " torn down");
| - }
| -
| - /*
| - * Send some messages
| - * Crash the server after prepare but on commit
| - * Bring up the destination server
| - * Send some more messages
| - * Verify all messages are received
| - */
| - public void testCrashAndRestart() throws Exception
| - {
| - Bridge bridge = null;
| -
| - try
| - {
| - final int NUM_MESSAGES = 10;
| -
| - bridge = new Bridge(cff0, cff1, sourceQueueFactory, targetQueueFactory,
| - null, null, null, null,
| - null, 1000, -1, Bridge.QOS_AT_MOST_ONCE,
| - NUM_MESSAGES, -1,
| - null, null, false);
| -
| - bridge.start();
| -
| - sendMessages(cf0, sourceQueue, 0, NUM_MESSAGES, true);
| -
| - checkMessagesReceived(cf1, targetQueue, Bridge.QOS_ONCE_AND_ONLY_ONCE, NUM_MESSAGES, true);
| -
| - ServerManagement.kill(1);
| -
| -
| - // >30 sec (timeout on remoting)
| - Thread.sleep(35000);
| -
| - ServerManagement.start(1, "all", false);
| - ServerManagement.deployQueue("targetQueue", 1);
| -
| - setUpAdministeredObjects();
| -
| - sendMessages(cf0, sourceQueue, 0, NUM_MESSAGES, true);
| -
| - checkMessagesReceived(cf1, targetQueue, Bridge.QOS_AT_MOST_ONCE, NUM_MESSAGES, true);
| - }
| - finally
| - {
| - if (bridge != null)
| - {
| - try
| - {
| - bridge.stop();
| - }
| - catch (Exception e)
| - {
| - log.error("Failed to stop bridge", e);
| - }
| - }
| - }
| - }
| -
| - // Inner classes -------------------------------------------------------------------
| -}
| Index: src/main/org/jboss/messaging/core/impl/JDBCPersistenceManager.java
| ===================================================================
| --- src/main/org/jboss/messaging/core/impl/JDBCPersistenceManager.java (.../branches/Branch_JBossMessaging_1_4_0_SP3_CP) (revision 4568)
| +++ src/main/org/jboss/messaging/core/impl/JDBCPersistenceManager.java (.../tags/JBossMessaging_1_4_0_SP3_CP02) (revision 4568)
| @@ -2556,7 +2556,7 @@
| map.put("CREATE_COUNTER",
| "CREATE TABLE JBM_COUNTER (NAME VARCHAR(255), NEXT_ID BIGINT, PRIMARY KEY(NAME))");
| // Id cache
| - map.put("CREATE_ID_CACHE", "CREATE TABLE JBM_ID_CACHE (NODE_ID INTEGER, CNTR INTEGER, JBM_ID VARCHAR(255), PRIMARY KEY(NODE_ID, CNTR))");
| + map.put("CREATE_ID_CACHE", "CREATE TABLE JBM_ID_CACHE (NODE_ID INTEGER, CNTR INTEGER, JBM_ID VARCHAR(255), PRIMARY KEY(NODEID, CNTR))");
| return map;
| }
|
| @@ -2603,8 +2603,8 @@
| "UPDATE JBM_MSG_REF SET CHANNEL_ID = ? WHERE CHANNEL_ID = ?");
| map.put("MOVE_REFERENCE",
| "UPDATE JBM_MSG_REF SET CHANNEL_ID = ? WHERE MESSAGE_ID = ? AND CHANNEL_ID = ?");
| - map.put("LOAD_ID_CACHE", "SELECT CNTR, JBM_ID FROM JBM_ID_CACHE WHERE NODE_ID = ?");
| - map.put("UPDATE_ID_IN_CACHE", "UPDATE JBM_ID_CACHE SET JBM_ID = ? WHERE NODE_ID = ? AND CNTR = ?");
| + map.put("LOAD_ID_CACHE", "SELECT CNTR, ID FROM JBM_ID_CACHE WHERE NODE_ID = ?");
| + map.put("UPDATE_ID_IN_CACHE", "UPDATE JBM_ID_CACHE SET JBM_ID = ? WHERE NODE_ID = ? CNTR = ?");
| map.put("INSERT_ID_IN_CACHE", "INSERT INTO JBM_ID_CACHE (NODE_ID, CNTR, JBM_ID) VALUES (?, ?, ?)");
|
I have probably said this before, but doing work on the CP branch ***must be tracked by a corresponding JIRA***.
I know what one of the changes is for (NODE_ID bug), but unless someone comes up with a JIRA and explanation for the others I will just revert them.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4160165#4160165
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4160165
16 years