[Design of EJB 3.0] - Re:
by ALRubinger
"bstansberry(a)jboss.com" wrote :
| 2) @CacheConfig.name. Specifies the name of the JBC instance to use to store clustered beans. Default was "jboss.cache:service=EJB3SFSBClusteredCache"; Al's recent changes converted it to "". I prefer "" -- using an ObjectName is too much of an implementation detail to be leaking as a default value.
|
| This change in defaults is breaking deployments of clustered SFSBs, so I'm going to have to add code to figure out what to do when the value is "".
Yes, by centralizing @CacheConfig from 2 annotations (in separate packages) to one, the context of the SFSB (clustered or not) should determine the default for "name", so for the time being I kept it as an empty String.
Maybe we introduce some logic:
if(bean.getAnnotation(Clustered.class)!=null)
| {
| bean.getAnnotation(CacheConfig).setName = DefaultClusteredInterface.class;
| }
| else
| {
| bean.getAnnotation(CacheConfig).setName = DefaultNonClusteredInterface.class;
| }
...and change "name" from a String to a Class<?>. ?
S,
ALR
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4105812#4105812
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4105812
18 years, 4 months
[Design of EJB 3.0] - Re:
by scott.stark@jboss.org
"bstansberry(a)jboss.com" wrote :
| 1) @Clustered.loadBalancePolicy. Specifies an impl of LoadBalancePolicy interface. Default is LoadBalancePolicy.class, i.e. the interface itself, not an impl.
| ...
|
Falling back to hard-coded defaults seems ok, but the code that is setting up the proxy factory should be also getting the full configuration setup based on a container default configuration. I'd rather move away from the injected default annotations to a complete pojo metadata model where the "Stateless Bean" aop domain has a complete specification.
"bstansberry(a)jboss.com" wrote :
| 2) @CacheConfig.name. Specifies the name of the JBC instance to use to store clustered beans. Default was "jboss.cache:service=EJB3SFSBClusteredCache"; Al's recent changes converted it to "". I prefer "" -- using an ObjectName is too much of an implementation detail to be leaking as a default value.
|
| This change in defaults is breaking deployments of clustered SFSBs, so I'm going to have to add code to figure out what to do when the value is "".
The only thing I can see to do here is to change the default to something like DefaultClusteredCache and expect that the factory bean is configured to alias this correctly.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4105809#4105809
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4105809
18 years, 4 months
[Design of EJB 3.0] - "Empty" default values in annotations
by bstansberry@jboss.com
There are a couple of places I've seen quasi-empty values used as defaults for annotation attributes. In both cases, the quasi-empty value can be taken to mean the user is saying "use the server default, whatever that is in the current context".
Question is, how should that "server default" be configured? Currently it is hard coded. Shouldn't it be externalized? If so, how, since EJB3 is using class annotations as the mechanism for passing around metadata, rather than mutable objects from jboss-metadata.jar?
Examples:
1) @Clustered.loadBalancePolicy. Specifies an impl of LoadBalancePolicy interface. Default is LoadBalancePolicy.class, i.e. the interface itself, not an impl.
The clustered proxy factories check for this condition and instantiate a hard coded default impl. StatelessClusteredProxyFactory uses RoundRobin; stateful uses FirstAvailable. So, context in which the annotation is applied helps drive the meaning of the attribute.
See http://www.jboss.com/index.html?module=bb&op=viewtopic&t=123791
and http://www.jboss.com/index.html?module=bb&op=viewtopic&t=120423
for discussion of why externalized configuration of these defaults could be helpful.
2) @CacheConfig.name. Specifies the name of the JBC instance to use to store clustered beans. Default was "jboss.cache:service=EJB3SFSBClusteredCache"; Al's recent changes converted it to "". I prefer "" -- using an ObjectName is too much of an implementation detail to be leaking as a default value.
This change in defaults is breaking deployments of clustered SFSBs, so I'm going to have to add code to figure out what to do when the value is "".
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4105759#4105759
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4105759
18 years, 4 months
[Design of Management Features on JBoss] - Re: Using xinclude in config files
by snacker
It's not working...
I couldn't find any command/env properties to set, so I created a dummy DocumentBuilderFactory class which sets namespaceaware and xincludeaware to true then proxies all calls to org.apache.xerces.jaxp.DocumentBuilderFactoryImpl.
| package debug;
|
| import javax.xml.parsers.DocumentBuilder;
| import javax.xml.parsers.DocumentBuilderFactory;
| import javax.xml.parsers.ParserConfigurationException;
| import javax.xml.validation.Schema;
|
| public class DebugDocumentBuilderFactory extends DocumentBuilderFactory{
|
| public static final String DEFAULT_FACTORY_IMPL_CLASS = "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl";
| public static final String PROP_FACTORY_IMPL_CLASS = "debug.factoryImplClass";
| private final DocumentBuilderFactory m_dbf;
|
| public DebugDocumentBuilderFactory(){
| String className = System.getProperty( PROP_FACTORY_IMPL_CLASS, DEFAULT_FACTORY_IMPL_CLASS );
| try{
| m_dbf = (DocumentBuilderFactory) Class.forName( className ).newInstance();
| m_dbf.setNamespaceAware( true );
| m_dbf.setXIncludeAware( true );
| }catch( Exception e ){
| throw new RuntimeException( "ERROR: could not create impl class " + className, e );
| }
| }
|
| ////////////////////
| /// proxy all calls to implementation
| ////////////////////
| public DocumentBuilder newDocumentBuilder()throws ParserConfigurationException{ return m_dbf.newDocumentBuilder(); }
| public void setAttribute( String name, Object value )throws IllegalArgumentException{ m_dbf.setAttribute( name, value ); }
| public Object getAttribute( String name )throws IllegalArgumentException{ return m_dbf.getAttribute( name ); }
| public void setFeature( String name, boolean value )throws ParserConfigurationException{ m_dbf.setFeature( name, value ); }
| public boolean getFeature( String name )throws ParserConfigurationException{ return m_dbf.getFeature( name ); }
| public Schema getSchema () { return m_dbf.getSchema (); }
| public boolean isCoalescing () { return m_dbf.isCoalescing (); }
| public boolean isExpandEntityReferences () { return m_dbf.isExpandEntityReferences (); }
| public boolean isIgnoringComments () { return m_dbf.isIgnoringComments (); }
| public boolean isIgnoringElementContentWhitespace () { return m_dbf.isIgnoringElementContentWhitespace (); }
| public boolean isNamespaceAware () { return m_dbf.isNamespaceAware (); }
| public boolean isValidating () { return m_dbf.isValidating (); }
| public boolean isXIncludeAware () { return m_dbf.isXIncludeAware (); }
| public void setCoalescing ( boolean coalescing ){ m_dbf.setCoalescing ( coalescing ); }
| public void setExpandEntityReferences ( boolean expandEntityRef ){ m_dbf.setExpandEntityReferences ( expandEntityRef ); }
| public void setIgnoringComments ( boolean ignoreComments ){ m_dbf.setIgnoringComments ( ignoreComments ); }
| public void setIgnoringElementContentWhitespace ( boolean whitespace ){ m_dbf.setIgnoringElementContentWhitespace( whitespace ); }
| public void setNamespaceAware ( boolean awareness ){ m_dbf.setNamespaceAware ( awareness ); }
| public void setSchema ( Schema schema ){ m_dbf.setSchema ( schema ); }
| public void setValidating ( boolean validating ){ m_dbf.setValidating ( validating ); }
| public void setXIncludeAware ( boolean state ){ m_dbf.setXIncludeAware ( state ); }
| public String toString(){
| return super.toString() + "{" + m_dbf + "}" ;
| }
| }
|
The error I'm getting looks like it is paritally working, because it does see the TCPPING element, but for some reason it says it's "null":
| 14:30:47,425 INFO [STDOUT] JAXP: find factoryId =javax.xml.parsers.DocumentBuilderFactory
| 14:30:47,425 INFO [STDOUT] JAXP: found system property, value=debug.DebugDocumentBuilderFactory
| 14:30:47,425 INFO [STDOUT] JAXP: created new instance of class debug.DebugDocumentBuilderFactory using ClassLoader: org.jboss.mx.loading.UnifiedClassLoader3@4f80d6{ url=file:/C:/jboss/server/all/conf/ ,addedOrder=1}
| 14:30:47,425 INFO [ServiceConfigurator] Problem configuring service jboss.cache:service=CacheA
| org.jboss.deployment.DeploymentException: Exception setting attribute ClusterConfig = [TCP: null] on mbean jboss.cache:service=CacheA; - nested throwable: (java.lang.StringIndexOutOfBoundsException: String index out of range: -1)
| at org.jboss.system.ServiceConfigurator.setAttribute(ServiceConfigurator.java:669)
| at org.jboss.system.ServiceConfigurator.configure(ServiceConfigurator.java:314)
| at org.jboss.system.ServiceConfigurator.internalInstall(ServiceConfigurator.java:442)
| at org.jboss.system.ServiceConfigurator.install(ServiceConfigurator.java:153)
| at org.jboss.system.ServiceController.install(ServiceController.java:215)
| at sun.reflect.GeneratedMethodAccessor16.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:597)
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
| at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
| at $Proxy4.install(Unknown Source)
| at org.jboss.deployment.SARDeployer.create(SARDeployer.java:232)
| at org.jboss.deployment.MainDeployer.create(MainDeployer.java:935)
| at org.jboss.deployment.MainDeployer.create(MainDeployer.java:925)
| at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:789)
| at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:753)
| at sun.reflect.GeneratedMethodAccessor18.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:597)
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
| at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:118)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
| at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:127)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
| at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
| at $Proxy9.deploy(Unknown Source)
| at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:319)
| at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:507)
| at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:192)
| at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:265)
| at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:274)
| at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:230)
| at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:597)
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
| at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:943)
| at $Proxy0.start(Unknown Source)
| at org.jboss.system.ServiceController.start(ServiceController.java:428)
| at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:597)
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
| at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
| at $Proxy4.start(Unknown Source)
| at org.jboss.deployment.SARDeployer.start(SARDeployer.java:285)
| at org.jboss.deployment.MainDeployer.start(MainDeployer.java:989)
| at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:790)
| at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:753)
| at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:737)
| 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 org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
| at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:118)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
| at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:127)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
| at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
| at $Proxy5.deploy(Unknown Source)
| at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:453)
| at org.jboss.system.server.ServerImpl.start(ServerImpl.java:330)
| at org.jboss.Main.boot(Main.java:187)
| at org.jboss.Main$1.run(Main.java:438)
| at java.lang.Thread.run(Thread.java:619)
| Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
| at java.lang.AbstractStringBuilder.setLength(AbstractStringBuilder.java:143)
| at java.lang.StringBuffer.setLength(StringBuffer.java:153)
| at org.jboss.cache.TreeCache.setClusterConfig(TreeCache.java:676)
| 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 org.jboss.mx.interceptor.AttributeDispatcher.invoke(AttributeDispatcher.java:121)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
| at org.jboss.mx.interceptor.ModelMBeanAttributeInterceptor.invoke(ModelMBeanAttributeInterceptor.java:88)
| at org.jboss.mx.interceptor.PersistenceInterceptor.invoke(PersistenceInterceptor.java:61)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
| at org.jboss.mx.server.AbstractMBeanInvoker.setAttribute(AbstractMBeanInvoker.java:442)
| at org.jboss.mx.server.MBeanServerImpl.setAttribute(MBeanServerImpl.java:593)
| at org.jboss.system.ServiceConfigurator.setAttribute(ServiceConfigurator.java:665)
| ... 83 more
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4105687#4105687
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4105687
18 years, 4 months