[JBoss Microcontainer Development] - ClassPool bootstrap refactoring
by Kabir Khan
Kabir Khan [http://community.jboss.org/people/kabir.khan%40jboss.com] created the discussion
"ClassPool bootstrap refactoring"
To view the discussion, visit: http://community.jboss.org/message/539242#539242
--------------------------------------------------------------
Following on from http://community.jboss.org/message/539041#539041 http://community.jboss.org/message/539041#539041 I have started refactoring how the ClassPools are initialized during bootstrap and moving code into the classpools project. The following (uncommitted, but working) test in ClassPools demonstrates how I see this working in the bootstrap.
/**
* Simulates the steps to be taken during AS bootstrap
*/
public void testBootstrap() throws Exception
{
//Initialize the config. This wires together the parts of the system
JBossClClassPoolConfig config = JBossClClassPoolConfig.getInstance();
assertNotNull(config.getClassPoolFactory());
assertNotNull(config.getClassPoolRepository());
assertNotNull(config.getDomainRegistry());
assertNotNull(config.getRegisterModuleCallback());
assertNull(config.getClassLoading());
//Check that the classpool factory works before we have deployed the classpool system
ClassLoader urlCl = createChildURLLoader(null, JAR_A_URL);
ClassPool urlPool = config.getClassPoolRepository().registerClassLoader(urlCl);
assertNotNull(urlPool);
CtClass aUrl = urlPool.get(CLASS_A);
CtClass stringUrl = urlPool.get(String.class.getName());
//Install the bean to get notified when ClassLoading is installed
BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder("JBossClClassPoolConfig", JBossClClassPoolConfig.class.getName());
builder.setFactoryClass(JBossClClassPoolConfig.class.getName());
builder.setFactoryMethod("getInstance");
ValueMetaData inject = builder.createContextualInject(null, null, AutowireType.BY_NAME, InjectOption.CALLBACK);
((AbstractInjectionValueMetaData)inject).setValue("ClassLoading");
builder.addPropertyMetaData("classLoading", inject);
getDelegate().deploy(builder.getBeanMetaData());
//Deploy the ClassLoading. This causes the RegistryModuleCallback
//to get installed as a module registry in ClassLoading
getDelegate().deployCommon();
assertNotNull(config.getClassLoading());
testScenario = new ClassPoolTestScenario<CLDeploymentBuilder>(getClassLoaderFactory(), config.getClassPoolRepository());
ClassPool poolA = testScenario.createLoader(new CLDeploymentBuilder("A", JAR_A_URL));
CtClass aDomain = poolA.get(CLASS_A);
assertNotSame(aUrl, aDomain);
assertSame(stringUrl, poolA.get(String.class.getName()));
ClassPool poolB = testScenario.createLoader(new CLDeploymentBuilder("B", JAR_B_URL));
assertSame(aDomain, poolB.get(CLASS_A));
}
The JBossClClassPoolConfig singleton wires together a lot of the things that are needed for running this in AS (getters ommitted)
public class JBossClClassPoolConfig
{
private static volatile JBossClClassPoolConfig config;
private final DomainRegistry domainRegistry;
private final RegisterModuleCallback registerModuleCallback;
private ClassLoading classLoading;
private JBossClDelegatingClassPoolFactory classPoolFactory;
private ClassPoolRepository classPoolRepository;
private JBossClClassPoolConfig(DomainRegistry domainRegistry, RegisterModuleCallback registerModuleCallback, JBossClDelegatingClassPoolFactory classPoolFactory)
{
this.domainRegistry = domainRegistry;
this.registerModuleCallback = registerModuleCallback;
this.classPoolFactory = classPoolFactory;
classPoolRepository = ClassPoolRepository.getInstance();
classPoolRepository.setClassPoolFactory(classPoolFactory);
}
public static JBossClClassPoolConfig getInstance()
{
if (config == null)
{
config = initialize();
}
return config;
}
private synchronized static JBossClClassPoolConfig initialize()
{
if (config != null)
return config;
DomainRegistry domainRegistry = new VFSClassLoaderDomainRegistry();
RegisterModuleCallback registerModuleCallback = new RegisterModuleCallback(domainRegistry);
JBossClDelegatingClassPoolFactory classPoolFactory = new JBossClDelegatingClassPoolFactory(domainRegistry, registerModuleCallback);
return new JBossClClassPoolConfig(domainRegistry, registerModuleCallback, classPoolFactory);
}
/**
* Set the classLoading. This should be set via a property
* by the MC
*
* @param cl the classLoading to set
*/
public void setClassLoading(ClassLoading cl)
{
if (cl != null)
cl.addModuleRegistry(registerModuleCallback);
else if (classLoading != null)
classLoading.removeModuleRegistry(registerModuleCallback);
classLoading = cl;
}
}
So basically all the AS bootstrap will need to do is to call JBossClClassPoolConfig.getInstance() to initialize the classpool parts, and then deploy the JBossClClassPoolConfig bean whose purpose is to add the RegisterModuleCallback as a module registry in ClassLoading once that is deployed.
With this in place and with a few small changes to how the aop classes work, what is in bootstrap/aop.xml will reuse things from JBossClClassPoolConfig where appropriate.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/539242#539242]
Start a new discussion in JBoss Microcontainer Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
15 years, 11 months
Re: [jboss-dev-forums] [JBoss ESB Development] - Annotation based Action classes
by Hans Wolffenbuttel
Hans Wolffenbuttel [http://community.jboss.org/people/h.wolffenbuttel] replied to the discussion
"Annotation based Action classes"
To view the discussion, visit: http://community.jboss.org/message/539213#539213
--------------------------------------------------------------
Hi Tom,
Does this mean you could have more then one @ProcessMethod with differend parameters where the kind of payload will activate the right one for the job?
I will illustrate: Say you have differend kinds of orders: orders-send-by-mail, orders-picked-up-at-location and express-orders. All these orders are converted by unmarshalling it from XML to Java-objects. Then the actionclass would look like:
public class HandleOrderAction{
@ProcessMethod
public OrderAcknowledgment processOrder(MailOrder purchaseOrder){ // Do your thing with the order...
return new OrderAcknowledgment(....);
}
@ProcessMethod
public OrderAcknowledgment processOrder(PickupOrder purchaseOrder){ // Do your thing with the order...
return new OrderAcknowledgment(....);
}
@ProcessMethod
public OrderAcknowledgment processOrder(ExpressOrder purchaseOrder){ // Do your thing with the order...
return new OrderAcknowledgment(....);
}
}
So when an expressorder is placed, the processmethod will call the method with the ExpressOrder as incoming parameter, when a mailorder is placed the method will be called with the MailOrder parameter and so on.
Will this work or is this possible in any way?
regards,
Hans
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/539213#539213]
Start a new discussion in JBoss ESB Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
15 years, 11 months
Re: [jboss-dev-forums] [JBoss Microcontainer Development] - ClassPoolRepository vs JBossclDelegatingClassPoolRepository
by Flavia Rainone
Flavia Rainone [http://community.jboss.org/people/flavia.rainone%40jboss.com] replied to the discussion
"ClassPoolRepository vs JBossclDelegatingClassPoolRepository"
To view the discussion, visit: http://community.jboss.org/message/539202#539202
--------------------------------------------------------------
> Ales Justin wrote:
>
> This sounds too much of an impl detail to be left to external (non-Classpool) libs to handle.
> Hence my suggestion is to make this a spi/configuration on Classpool side,
> so users (other libs) don't have to think about it when using it -- they simply use what Classpool provides.
In that case, I assume that the best option is:
> (...) keeping ClassPoolRepository the way it is, getting rid of JBossClDelegatingClassPoolRepository, and having the ClassPoolFactory providing a plugin class containing the extra steps required for classloader registration.
This way, from an external point of view, all you have to do is: always use ClassPoolRepository; inject your ClassPoolFactory into ClassPoolRepository.
I implemented a first version of this as part of issue CLASSPOOL-2, which added to the spi package:
- a new interface, ClassLoaderRegistryHandler, responsible for handling the register and unregister calls in ClassPoolRepository
- a ClassLoaderRegistryHandlerFactory interface, that can be implemented by ClassPoolFactories that require a non-default ClassLoaderRegistryHandlers
That way, ClassPoolRepository.setClassPoolFactory checks for whether the CPFactory implements ClassLoaderRegistryHandlerFactory. If it does, ClassPoolRepository uses the factory to create a new ClassLoaderRegistryHandler for itself.
Plus:
- JBossClDelegatingClassPoolRepository has been renamed to JBossClRegistryHandler, is no longer a public class, and implements ClassLoaderRegistryHandler
- JBossclDelegatingClassPoolFactory implements ClassLoaderRegistryHandlerFactory so it can provide JBossClRegistryHandler to ClassPoolRepository
Let me know what you think of this implementation and what do you think should be changed/improved.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/539202#539202]
Start a new discussion in JBoss Microcontainer Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
15 years, 11 months
Re: [jboss-dev-forums] [jBPM Development PVM] - Problem with deployment of process design
by Sukla Nag
Sukla Nag [http://community.jboss.org/people/SuklaJbpm] replied to the discussion
"Problem with deployment of process design"
To view the discussion, visit: http://community.jboss.org/message/539188#539188
--------------------------------------------------------------
Hi Huisheng
Thanks for the help you gave in mentioning the user's guide, I have now deploye the entrire jbpm4.3 which installed jboss, eclipse all in the same direvctory of jbpm.
But now when I am trying to design a process, I need a project to be created, in version 3 there was a bpmn project which I was able to create, but now there is only bpm process definition menu. When I am trying to ctreate a new bpmn process definition, it is asking for a existing project. I craeted a dynamic web project & then tried to create a process definition, I am having two problems
1. The xml file created is not accepted saying no dtd definition, I checked one sample jpdl file, mine is same, but it is showing errors
2. Now there is no depoment / creation of process archive menu in gpd. SO how do I create a process archive or deploy now ?
Also if I changr the source file, the diagram does not change.
Could you please suggest something ?
Thanks one again
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/539188#539188]
Start a new discussion in jBPM Development PVM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
15 years, 11 months
[JCA Development] - Rar working on jboss 4.0.2, not working on 5.1
by Ravi Samavedula
Ravi Samavedula [http://community.jboss.org/people/samavedulark] created the discussion
"Rar working on jboss 4.0.2, not working on 5.1"
To view the discussion, visit: http://community.jboss.org/message/539154#539154
--------------------------------------------------------------
Hi,
I had deployed an rar application on jboss 4.0.2 and it is working and when i moved to Jboss 5.1, it is throwing an error.
below is the error log.
0:09:37,283 INFO [TomcatDeployment] deploy, ctxPath=/
10:09:37,439 INFO [TomcatDeployment] deploy, ctxPath=/jmx-console
10:09:37,610 INFO [JBossASKernel] Created KernelDeployment for: hapi-0.5.jar
10:09:37,610 INFO [JBossASKernel] installing bean: jboss.j2ee:ear=jca-ear-1.3-SNAPSHOT.ear,jar=hapi-0.5.jar,name=hapi-0.5,service=EJB3
10:09:37,610 INFO [JBossASKernel] with dependencies:
10:09:37,610 INFO [JBossASKernel] and demands:
10:09:37,610 INFO [JBossASKernel] and supplies:
10:09:37,610 INFO [JBossASKernel] Added bean(jboss.j2ee:ear=jca-ear-1.3-SNAPSHOT.ear,jar=hapi-0.5.jar,name=hapi-0.5,service=EJB3) to KernelDeployment of: hapi-0.5.jar
10:09:39,108 INFO [ClientENCInjectionContainer] STARTED CLIENT ENC CONTAINER: hapi-0.5
10:09:39,186 INFO [SystemEventService] NODE_STARTED on node [HCA-5C1P1BS]
10:09:39,186 INFO [AbstractConnector] [aware] connector started
10:09:39,233 INFO [AbstractConnector] [datacaptor] connector started
10:09:39,249 INFO [AbstractConnector] [intellivue] connector started
*10:09:39,498 ERROR [ProfileServiceBootstrap] Failed to load profile: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):*
*DEPLOYMENTS MISSING DEPENDENCIES:*
* Deployment "gehc.com:service=KernelServiceMBean" is missing the following dependencies:*
* Dependency "jboss.j2ee:module=kernel-ejb-1.3-SNAPSHOT.jar,service=EjbModule" (should be in state "Create", but is actually in state "** NOT FOUND Depends on 'jboss.j2ee:module=kernel-ejb-1.3-SNAPSHOT.jar,service=EjbModule' **")*
* Deployment "jboss.j2ee:module="kernel-ejb-1.3-SNAPSHOT.jar",service=EjbModule" is missing the following dependencies:*
* Dependency "gehc.com:service=KernelServiceMBean" (should be in state "Create", but is actually in state "Configured")*
*DEPLOYMENTS IN ERROR:*
* Deployment "jboss.j2ee:module=kernel-ejb-1.3-SNAPSHOT.jar,service=EjbModule" is in error due to the following reason(s): ** NOT FOUND Depends on 'jboss.j2ee:module=kernel-ejb-1.3-SNAPSHOT.jar,service=EjbModule' ***
10:09:39,514 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on http-127.0.0.1-8080
10:09:39,545 INFO [AjpProtocol] Starting Coyote AJP/1.3 on ajp-127.0.0.1-8009
10:09:39,545 INFO [ServerImpl] JBoss (Microcontainer) [5.1.0.GA (build: SVNTag=JBoss_5_1_0_GA date=200905221053)] Started in 4m:33s:733ms
Thanks
Ravi S
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/539154#539154]
Start a new discussion in JCA Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
15 years, 11 months
Re: [jboss-dev-forums] [JMX Development] - Isolating the JBoss package tree from the execution environm
by Giampaolo Tomassoni
Giampaolo Tomassoni [http://community.jboss.org/people/g.tomassoni] replied to the discussion
"Isolating the JBoss package tree from the execution environm"
To view the discussion, visit: http://community.jboss.org/message/539075#539075
--------------------------------------------------------------
Well, I'm sorry for my very late reply to your, Jaikiran. But let me first thank for your interest in the matter, anyway.
> jaikiran pai wrote:
>
> So the data-directory value itself is just an "example". But i see what you mean. If we are providing an commented out example, we might as well provide one which uses the JBoss system property ${jboss.server.data.dir}.
>
Right. That was I meant.
> jaikiran pai wrote:You mean after you uncomment that section and point it to some location, the folder (if non-existent) does not get created, in AS 5.1.0? Can you post the exact configuration (i.e. the location you are using in that file)?
I have somewhere in my startup config files:
-Djboss.server.data.dir=/var/lib/jboss/data
One would expect that this dir had to be more or less like the default jboss.server.data.dir: an empty directory owned by jboss. But this doesn't seem enough, since starting jboss with that setting and an empty /var/lib/jboss/data, one gets the following error in boot.log:
16:53:41,276 DEBUG [AttributePersistenceService] Starting failed jboss:service=AttributePersistenceService
java.lang.NullPointerException
at org.jboss.system.pm.XMLAttributePersistenceManager.create(XMLAttributePersistenceManager.java:184)
at org.jboss.system.pm.AttributePersistenceService.startService(AttributePersistenceService.java:186)
at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:376)
at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:322)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
...
16:53:41,279 ERROR [AbstractKernelController] Error installing to Start: name=jboss:service=AttributePersistenceService state=Create mode=Manual requiredState=Installed
One has to create the xmbean-attrs directory in it, then everything gets fine. Maybe the problem may be circumvented by specifying some further attribute in the AttributePersistenceManagerConfig entry,
There is nowere an error explicitly stating that, so it is a bit tricky to isolate this as the source of the problem.
> jaikiran pai wrote:
>
> You mean after you uncomment that section and point it to some location, the folder (if non-existent) does not get created, in AS 5.1.0? Can you post the exact configuration (i.e. the location you are using in that file)?
>
> > "g.tomassoni" wrote:
> > 2) adding the url of my external deploy directory to the URLs attribute of URLDeploymentScanner in jboss-service.xml (JBoss 4.x) or as a new uri element to the property applicationURIs in bootstrap/profile.xml (JBoss 5.x).
> >
> >
> > but I would like to know if I have any way of adding a further deploy uri after JBoss startup, in example through JMX. The basic idea is to let JBoss start and then use JMX or whatever to contact the running JBoss and instruct it to have a look to that furter deploy URL. Is it possible? How?
>
>
> AS-5.1.0 is backed by ProfileService's DeploymentManager which is the official API for managing deployments. I am not sure where this feature is available in the current API.
>
Ok, thank you: I'm going to see if I can find somthing about the +ProfileService's DeploymentManager+, then.
> jaikiran pai wrote:
>
> You have mix of questions/suggestions in this topic :) And both are not directly related to JMX itself.
Well, I'm sorry about both my "mixed mode" and, of course, about the fact I didn't get which was the right place to report/ask about this.
> jaikiran pai wrote:
>
> For the second question, i guess the best place would be the "Management" forum. But that's just my opinion. Let's see, if some moderator knows of a better place, he will move it appropriately.
I see they didn't move this, but I'm going to stick with your hint anyway.
Thankyou again for your prompt reply, Jaikira.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/539075#539075]
Start a new discussion in JMX Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
15 years, 11 months