[Microcontainer] - Re: Retrieve all metadata from a deployment unit.
by beve
In our case the file we are looking of is in a subdirectory and I think this is the problem.
getMetaDataFiles does not look for files recursively in all metadata locations.
// Look in the meta data location
| List<VirtualFile> results = new ArrayList<VirtualFile>();
| for (VirtualFile location : metaDataLocations)
| {
| List<VirtualFile> result = location.getChildren(new MetaDataMatchFilter(name, suffix));
| if (result != null && result.isEmpty() == false)
| {
| ...
There is another constructor for MetaDataMatcher that takes VisitorAttributes. When using the constructor with name and suffix the attributes will be set to VisitorAttributes.LEAVES_ONLY:
| if (attributes == null)
| attributes = VisitorAttributes.LEAVES_ONLY;
Using the second constructor and setting VisitorAttributes.RECURSE_LEAVES_ONLY does what we want:
| List<VirtualFile> results = new ArrayList<VirtualFile>();
| for (VirtualFile location : metaDataLocations)
| {
| List<VirtualFile> result = location.getChildren(new MetaDataMatchFilter(name, suffix, VisitorAttributes.RECURSE_LEAVES_ONLY));
| if (result != null && result.isEmpty() == false)
| {
| ...
This might be by design but is there a way for us to accomplish this?
Thanks,
/Daniel
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4226477#4226477
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4226477
17 years, 2 months
[EJB 3.0] - Re: NullPointerException in JavaEEComponentHelper with JBoss
by jaikiran
Ah, you have circular dependency here! AStatelessBean injects BStatelessBean and BStatelessBean injects AStatelessBean.
Add a @org.jboss.ejb3.annotation.IgnoreDependency (in addition to @EJB) to any one end of the injection. For example:
| import org.jboss.ejb3.annotation.IgnoreDependency;
|
| @Stateless
| public class AStatelessSessionBean implements AStatelessSession
| {
| // we have a circular dependency, so add @IgnoreDependency
| @EJB
| @IgnoreDependency
| private BStatelessSession bean;
|
| @TransactionAttribute(TransactionAttributeType.REQUIRED)
| public String sayHello( String name )
| {
| return bean.sayHello(name);
| }
|
| public String greetingPhrase()
| {
| return "Hello there";
| }
| }
|
| @Stateless
| public class BStatelessSessionBean implements BStatelessSession
| {
| @EJB
| //@EJB(mappedName="ifssimpletest/AStatelessSessionBean/local")
| private AStatelessSession bean;
|
| @TransactionAttribute(TransactionAttributeType.REQUIRED)
| public String sayHello( String name )
| {
| return bean.greetingPhrase() + ", " + name + "!\n";
| }
| }
|
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4226454#4226454
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4226454
17 years, 2 months
[EJB 3.0] - Re: NullPointerException in JavaEEComponentHelper with JBoss
by japase
Hi,
As suggested I've created a new topic regarding the EJB injection in web services (http://www.jboss.org/index.html?module=bb&op=viewtopic&t=154200).
I've also tried to test different configurations to surround the main problem (I have now a smaller application, but still build upon our framework, which seems behave in the same way as the "big" one, ifsapp.ear; we've also got a newer build of JBoss 5.1 through Red Hat support: 5.1.0.CR1; could it be of interest to get the log files from this version?).
But during my tests I found it totally impossible to deploy EJBs with mutual dependencies:
| @Stateless
| public class AStatelessSessionBean implements AStatelessSession
| {
| @EJB
| //@EJB(mappedName="ifssimpletest/BStatelessSessionBean/local")
| private BStatelessSession bean;
|
| @TransactionAttribute(TransactionAttributeType.REQUIRED)
| public String sayHello( String name )
| {
| return bean.sayHello(name);
| }
|
| public String greetingPhrase()
| {
| return "Hello there";
| }
| }
|
| @Stateless
| public class BStatelessSessionBean implements BStatelessSession
| {
| @EJB
| //@EJB(mappedName="ifssimpletest/AStatelessSessionBean/local")
| private AStatelessSession bean;
|
| @TransactionAttribute(TransactionAttributeType.REQUIRED)
| public String sayHello( String name )
| {
| return bean.greetingPhrase() + ", " + name + "!\n";
| }
| }
|
I've tested with and without 'mappedName'; I've also tested to pack both EJBs to a single jar file - nothing helps (I have a very simple test application with two EJBs as above and one servlet calling one of the EJBs - this application works perfectly on both GlassFish 2.1 and webLogic 10.3).
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4226445#4226445
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4226445
17 years, 2 months