[JBoss ESB Development] - Re: SOAPProxy+AS5: INVM contract unavailable w/classpath URI
by dward
It doesn't look like the ContractProviderLifecycleResource can be used to help in this circumstance.
I question the usefulness of providing a wsdl contract for non-HTTP addresses at this time. May I suggest that for now (ie: the 4.x ESB stream, pre-5.x), we handle this case by not dumping an exception, but instead give the user the message:
'classpath:///helloworld.wsdl' unavailable: WSDL address URI format unsupported by contract application.
only IF they click on a contract link whose contract was loaded with a "classpath://" uri AND they are not using the HttpGateway? (The HTTP contract via classpath would still be available in that case, thanks to ContractProviderLifecycleResource.)
I made this change locally, but won't commit it to JBESB_4_7_CP until I hear that this is the approach we want to take. Of course I'm all ears too if someone has another option.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4269870#4269870
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4269870
15 years, 1 month
[JBoss Microcontainer Development] - Re: Supporting qualifiers in MC
by kabir.khan@jboss.com
There is a problem with qualifier annotations applied via xml/beanmetadata. Currently, they if @Inject is used, e.g.
| public class InjectAnnotationPlugin extends PropertyAnnotationPlugin<Inject>
| {
| public final static InjectAnnotationPlugin INSTANCE = new InjectAnnotationPlugin();
|
| protected InjectAnnotationPlugin()
| {
| super(Inject.class);
| }
|
| @Override
| protected ValueMetaData createValueMetaData(PropertyInfo info, MetaData retrieval, Inject annotation)
| {
| return createTheMetaData(retrieval, annotation);
| }
|
| @Override
| public ValueMetaData createValueMetaData(ParameterInfo parameterInfo, MetaData retrieval, Inject annotation, ValueMetaData previousValue)
| {
| return createTheMetaData(retrieval, annotation);
| }
|
| private ValueMetaData createTheMetaData(MetaData retrieval, Inject annotation)
| {
| HashSet<Object> annotationSet = null;
| if (retrieval != null)
| {
| Annotation[] annotations = retrieval.getAnnotationsAnnotatedWith(Qualifier.class);
| if (annotations.length > 0)
| {
| annotationSet = new HashSet<Object>(annotations.length);
| for (Annotation ann : annotations)
| annotationSet.add(ann);
| }
| }
| return ValueUtil.createValueMetaData(annotation, annotationSet);
| }
|
| }
|
The annotationSet goes into AbstractInjectionValueMetaData as qualifiers. The annotation qualifiers are ignored if
| <inject/>
|
is used since then the InjectAnnotationPlugin is not triggered.
I am not handling these in any special way at the moment. I probably need to do something similar to what I have done for the supplied annotation qualifiers in CommonAnnotationAdapter
| protected void handleAnnotations(BeanInfo info, MetaData retrieval, U handle, boolean isApplyPhase) throws Throwable
| {
| ...
| //Existing code
| // class
| ClassInfo classInfo = info.getClassInfo();
| for (Annotation annotation : retrieval.getAnnotations())
| {
| for(T plugin : getPlugins(ElementType.TYPE, annotation, null, annotationClasses))
| {
| if (isApplyPhase)
| applyPlugin(plugin, annotation, classInfo, retrieval, handle);
| else
| cleanPlugin(plugin, annotation, classInfo, retrieval, handle);
| }
| }
|
| //New code to handle meta-annotations on class
| Map<Class<? extends Annotation>, Set<T>> metaAnnotationsForType = metaAnnotationsPluginsMap.get(ElementType.TYPE);
| if (metaAnnotationsForType != null)
| {
| for (Entry<Class<? extends Annotation>, Set<T>> entry : metaAnnotationsForType.entrySet()) //Qualifer is registered here
| {
| for (Annotation annotation : retrieval.getAnnotationsAnnotatedWith(entry.getKey()))
| {
| for (T plugin : entry.getValue())
| {
| if (isApplyPhase)
| applyPlugin(plugin, annotation, classInfo, retrieval, handle);
| else
| cleanPlugin(plugin, annotation, classInfo, retrieval, handle);
| }
| }
| }
| }
| ...
|
The plugin that handles adding the qualifiers
| public class SuppliedQualifierAnnotationPlugin extends ClassAnnotationPlugin<Annotation> implements MetaAnnotationPlugin<ClassInfo, Qualifier>
| {
| public static final SuppliedQualifierAnnotationPlugin INSTANCE = new SuppliedQualifierAnnotationPlugin();
|
| protected SuppliedQualifierAnnotationPlugin()
| {
| super(Annotation.class);
| addTypes(ElementType.TYPE);
| }
|
| protected boolean isElementTypeSupported(ElementType type)
| {
| return true;
| }
|
| @Override
| protected boolean isCleanup()
| {
| return true;
| }
|
| @Override
| protected List<? extends MetaDataVisitorNode> internalApplyAnnotation(ClassInfo info, MetaData retrieval, Annotation annotation, KernelControllerContext context) throws Throwable
| {
| if (context != null)
| {
| MetaDataRetrieval instanceMetaData = context.getKernel().getMetaDataRepository().getMetaDataRepository().getMetaDataRetrieval(context.getScopeInfo().getMutableScope());
| QualifiersMdrUtil.addQualifiersToMdrRetrieval(instanceMetaData, QualifierType.SUPPLIED, null, annotation);
| }
| return null;
| }
|
| @Override
| protected void internalCleanAnnotation(ClassInfo info, MetaData retrieval, Annotation annotation, KernelControllerContext context) throws Throwable
| {
| if (context != null)
| {
| MetaDataRetrieval instanceMetaData = context.getKernel().getMetaDataRepository().getMetaDataRepository().getMetaDataRetrieval(context.getScopeInfo().getMutableScope());
| QualifiersMdrUtil.removeQualifiersFromMdrRetrieval(instanceMetaData, QualifierType.SUPPLIED, null, annotation);
| }
| }
|
| //From MetaAnnotationPlugin
| public Class<Qualifier> getMetaAnnotation()
| {
| return Qualifier.class;
| }
| }
|
However, that means checking everything for qualifiers annotations in the annotation adapter. My initial idea is to do something along the lines of this pseudo-code for each parameter/property, but I will sleep on it
| for (ParameterMetaData pmd : constructorInfo.getParameters())
| {
| if (pmd.getValue() != null && pmd.getValue() instanceof AbstractInjectionValueMetaData)
| {
| Map<Class<? extends Annotation>, Set<T>> metaAnnotationsForType = metaAnnotationsPluginsMap.get(ElementType.PARAMETER);
|
| for (Entry<Class<? extends Annotation>, Set<T>> entry : metaAnnotationsForType.entrySet()) //Qualifer is registered here
| {
| for (Annotation annotation : retrieval.getAnnotationsAnnotatedWith(entry.getKey()))
| {
| for (T plugin : entry.getValue())
| applyMetaAnnotationPlugin(plugin, annotation, parameterInfo, pmd, retrieval, handle); //Can get the AbstractInjectionValueMetaData from pmd internally and set the annotation in the set of qualifiers there
| }
| }
| }
| }
|
If the value is a collection, array etc. I would also need to go into each element checking for AIVMD.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4269861#4269861
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4269861
15 years, 1 month
[JBoss ESB Development] - SOAPProxy+AS5: INVM contract unavailable w/classpath URI
by dward
This post is to discuss options for fixing https://jira.jboss.org/jira/browse/JBESB-3034.
Using ESB 4.7 deployed in AS 5.1, if you configure the SOAPProxy with a wsdl property using a classpath URI (like "classpath://helloworld.wsdl"), then attempt to look at the INVM service contract at http://localhost:8080/contract/, you will get the following error:
11:48:24,707 ERROR [AbstractWsdlContractPublisher] Failed to load WSDL contract information from WS Endpoint 'classpath:///helloworld.wsdl'.
| java.lang.NullPointerException
| at org.jboss.soa.esb.actions.soap.proxy.SOAPProxyWsdlContractPublisher.getWsdl(SOAPProxyWsdlContractPublisher.java:60)
| at org.jboss.soa.esb.actions.soap.AbstractWsdlContractPublisher.getContractInfo(AbstractWsdlContractPublisher.java:141)
| at org.apache.jsp.contract_jsp._jspService(contract_jsp.java:126)
| at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
| at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
| at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
| ...
When deploying ESB into JBoss AS 4.2.3, both the HTTP and INVM wsdl is available through the contract JSP app. But when deploying ESB into JBoss AS 5.1, only the HTTP wsdl is available.
I believe the problem is classloading visibility. In the contract JSP app, when clicking on the INVM wsdl link, the classloader of the web tier is used to lookup the classpath URL resource of "helloworld.wsdl". This is no problem on AS 4.2.3, most likely because of the behavior of the UnifiedClassLoader. However, on AS 5.1, classloading is obviously different, so the URL resource cannot be found. One would have to use the classloader of the deployed esb archive, I would assume (as that's where helloworld.wsdl lives).
But why does the HTTP wsdl link work through the contract JSP app, no matter if AS 4.2.3 or 5.1 is used? Because during the esb archive deployment, when the HttpGatewayServlet is initialized, the wsdl is obtained using the ContractProviderLifecycleResource, which handles it.
Thoughts on what we should do about this?
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4269844#4269844
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4269844
15 years, 1 month
[JBoss AS Development] - org.jboss.util.collection.ConcurrentSkipListMap fails when r
by kabir.khan@jboss.com
Adding this test to common-core
| package org.jboss.test.util.test.collection;
|
| import java.util.Map;
|
| import org.jboss.util.collection.ConcurrentSkipListMap;
|
| /**
| *
| * @author <a href="kabir.khan(a)jboss.com">Kabir Khan</a>
| * @version $Revision: 1.1 $
| */
| public class ConcurrentSkipListMapSecureTestCase extends AbstractMapUnitTest
| {
| @Override
| protected void setUp() throws Exception
| {
| super.setUp();
| System.setSecurityManager(new SecurityManager());
| }
|
| @Override
| @SuppressWarnings("unchecked")
| protected Map createEmptyMap()
| {
| return new ConcurrentSkipListMap();
| }
| }
|
fails with the message:
| java.lang.ExceptionInInitializerError
| at org.jboss.test.util.test.collection.ConcurrentSkipListMapSecureTestCase.createEmptyMap(ConcurrentSkipListMapSecureTestCase.java:46)
| at org.jboss.test.util.test.collection.AbstractMapUnitTest.testBasicOperations(AbstractMapUnitTest.java:21)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:597)
| at junit.framework.TestCase.runTest(TestCase.java:168)
| at junit.framework.TestCase.runBare(TestCase.java:134)
| at junit.framework.TestResult$1.protect(TestResult.java:110)
| at junit.framework.TestResult.runProtected(TestResult.java:128)
| at junit.framework.TestResult.run(TestResult.java:113)
| at junit.framework.TestCase.run(TestCase.java:124)
| at junit.framework.TestSuite.runTest(TestSuite.java:232)
| at junit.framework.TestSuite.run(TestSuite.java:227)
| at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:81)
| at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
| at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
| at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
| at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
| at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
| at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
| Caused by: java.lang.RuntimeException: java.security.AccessControlException: access denied (java.lang.RuntimePermission accessDeclaredMembers)
| at java.util.concurrent.atomic.AtomicReferenceFieldUpdater$AtomicReferenceFieldUpdaterImpl.<init>(AtomicReferenceFieldUpdater.java:189)
| at java.util.concurrent.atomic.AtomicReferenceFieldUpdater.newUpdater(AtomicReferenceFieldUpdater.java:65)
| at org.jboss.util.collection.ConcurrentSkipListMap.<clinit>(ConcurrentSkipListMap.java:356)
| ... 21 more
| Caused by: java.security.AccessControlException: access denied (java.lang.RuntimePermission accessDeclaredMembers)
| at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)
| at java.security.AccessController.checkPermission(AccessController.java:546)
| at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
| at java.lang.SecurityManager.checkMemberAccess(SecurityManager.java:1662)
| at java.lang.Class.checkMemberAccess(Class.java:2157)
| at java.lang.Class.getDeclaredField(Class.java:1879)
| at java.util.concurrent.atomic.AtomicReferenceFieldUpdater$AtomicReferenceFieldUpdaterImpl.<init>(AtomicReferenceFieldUpdater.java:181)
| ... 23 more
|
I have tried changing the class
| $svn diff
| Index: src/main/java/org/jboss/util/collection/ConcurrentSkipListMap.java
| ===================================================================
| --- src/main/java/org/jboss/util/collection/ConcurrentSkipListMap.java (revision 3838)
| +++ src/main/java/org/jboss/util/collection/ConcurrentSkipListMap.java (working copy)
| @@ -%ld,%ld +%ld,%ld @@
|
| package org.jboss.util.collection;
|
| +import java.security.AccessController;
| +import java.security.PrivilegedAction;
| import java.util.AbstractCollection;
| import java.util.AbstractMap;
| import java.util.AbstractSet;
| @@ -%ld,%ld +%ld,%ld @@
| /** Updater for casHead */
| private static final
| AtomicReferenceFieldUpdater<ConcurrentSkipListMap, HeadIndex>
| - headUpdater = AtomicReferenceFieldUpdater.newUpdater
| - (ConcurrentSkipListMap.class, HeadIndex.class, "head");
| -
| + headUpdater;
| +
| + static
| + {
| + headUpdater = AccessController.doPrivileged(new PrivilegedAction<AtomicReferenceFieldUpdater<ConcurrentSkipListMap, HeadIndex>>()
| + {
| +
| + public AtomicReferenceFieldUpdater<ConcurrentSkipListMap, HeadIndex> run()
| + {
| + return AtomicReferenceFieldUpdater.newUpdater
| + (ConcurrentSkipListMap.class, HeadIndex.class, "head");
| + }
| + });
| + }
| /**
| * compareAndSet head node
| */
|
but that still fails with the message
| java.lang.ExceptionInInitializerError
| at org.jboss.test.util.test.collection.ConcurrentSkipListMapSecureTestCase.createEmptyMap(ConcurrentSkipListMapSecureTestCase.java:46)
| at org.jboss.test.util.test.collection.AbstractMapUnitTest.testBasicOperations(AbstractMapUnitTest.java:21)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:597)
| at junit.framework.TestCase.runTest(TestCase.java:168)
| at junit.framework.TestCase.runBare(TestCase.java:134)
| at junit.framework.TestResult$1.protect(TestResult.java:110)
| at junit.framework.TestResult.runProtected(TestResult.java:128)
| at junit.framework.TestResult.run(TestResult.java:113)
| at junit.framework.TestCase.run(TestCase.java:124)
| at junit.framework.TestSuite.runTest(TestSuite.java:232)
| at junit.framework.TestSuite.run(TestSuite.java:227)
| at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:81)
| at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
| at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
| at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
| at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
| at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
| at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
| Caused by: java.lang.RuntimeException: java.security.AccessControlException: access denied (java.lang.RuntimePermission accessDeclaredMembers)
| at java.util.concurrent.atomic.AtomicReferenceFieldUpdater$AtomicReferenceFieldUpdaterImpl.<init>(AtomicReferenceFieldUpdater.java:189)
| at java.util.concurrent.atomic.AtomicReferenceFieldUpdater.newUpdater(AtomicReferenceFieldUpdater.java:65)
| at org.jboss.util.collection.ConcurrentSkipListMap$1.run(ConcurrentSkipListMap.java:367)
| at org.jboss.util.collection.ConcurrentSkipListMap$1.run(ConcurrentSkipListMap.java:1)
| at java.security.AccessController.doPrivileged(Native Method)
| at org.jboss.util.collection.ConcurrentSkipListMap.<clinit>(ConcurrentSkipListMap.java:362)
| ... 21 more
| Caused by: java.security.AccessControlException: access denied (java.lang.RuntimePermission accessDeclaredMembers)
| at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)
| at java.security.AccessController.checkPermission(AccessController.java:546)
| at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
| at java.lang.SecurityManager.checkMemberAccess(SecurityManager.java:1662)
| at java.lang.Class.checkMemberAccess(Class.java:2157)
| at java.lang.Class.getDeclaredField(Class.java:1879)
| at java.util.concurrent.atomic.AtomicReferenceFieldUpdater$AtomicReferenceFieldUpdaterImpl.<init>(AtomicReferenceFieldUpdater.java:181)
| ... 26 more
|
Probably because the privileged block is not is the same jar as the AtomicReferenceFieldUpdater?
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4269809#4269809
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4269809
15 years, 1 month