-
1. Re: Class access / class visibility
ebross Jul 3, 2012 4:08 AM (in response to lucas_smith)Hi Lucas,
You are using Jboss 5, and If you are deploying a *.war file, then put the ejb-module.jar in the war-module/WEB-INF/lib and depoy.
-
2. Re: Class access / class visibility
lucas_smith Jul 3, 2012 5:49 AM (in response to lucas_smith)I know that it can be done in such way. But I do not want to do it. I want to deploy such modules separately. Is there any solution?
-
3. Re: Class access / class visibility
ebross Jul 3, 2012 7:10 AM (in response to lucas_smith)Hi Marc,
Another alternative, is to package the foo.war and foo.ejb in an foo.ear and deploy that foo.ear, in which case you wouldn't need the foo.ejb in the foo.war. I am not sure how else classes that are deployed in different modules can be visible to other modules without linking their libraries in one form or another.
-
4. Re: Class access / class visibility
periklis_douvitsas Jul 3, 2012 8:49 AM (in response to lucas_smith)They are visible. You can have a client deployed in war that speaks with the EJB (jar). So you can have in the deploy directory two files, one war and one jar . You don't have to include them anywhere else. You can have stateless ejb that implement remote interfaces. From the client you call the ejb like that
Context ctx = factory.getContext();
yourEJB yourContr = (yourEJB) ctx.lookup("blablaEJBBean/remote");
Of course, when you are programmign in an IDE like netbeans in order your client project (servlet) to compile you have to add the ejb project, in order to find the classes but you dont need to put this into war-module/WEB-INF/lib.
Do you have any error messages?
-
5. Re: Class access / class visibility
lucas_smith Jul 9, 2012 3:10 PM (in response to lucas_smith)Periklis Douvitsas, you are right.
Can you give me some explanation on which classes are visible to others?
-
6. Re: Class access / class visibility
periklis_douvitsas Jul 10, 2012 2:59 AM (in response to lucas_smith)1 of 1 people found this helpfulhere is an explanation how to call ejb3 using jboss 5
http://javahowto.blogspot.gr/2007/11/simple-ejb-3-on-jboss-application.html
what i do
i create an interface and i include all the methods that i want to be visible to clients
public interface ExampleEJB {
public Sometype getDataById(Long Id);
public List<IBla> getAllData();
}
i implement the class and the actual methods
@Stateless
public class ExampleEJBBean implements ExampleEJBRemote, ExampleEJBLocal {
@PersistenceContext(name = "blaPU")
EntityManager em;
@Resource private SessionContext context;
public ExampleEJBBean() {
}
public SometypegetDataById(Long Id) {
//implement the method
return sometype;
}
public List<IBla> getAllData(){
....
return list;
}
}
the local interface
import javax.ejb.Local;
/**
*
*/
@Local
public interface ExampleEJBLocal extends ExampleEJB {
}
the remote
import javax.ejb.Remote;
/**
*/
@Remote
public interface ExampleEJBRemote extends ExampleEJB {
}
you can call the methods getDataById, getAllData (from the client) that you implement in ExampleEJBBean and you expose in ExampleEJB interface.
is this what you asking for?
Hope this helps
-
7. Re: Class access / class visibility
lucas_smith Jul 10, 2012 2:20 PM (in response to periklis_douvitsas)Thank you.
The interface is needed because the Client needs it in classpath. So such interface can be placed in some kind of a library JAR.
To sum up, it can be stated that beans from bean package A.jar are visible to those from B.jar package despite the fact that they are deployed independently. Am I right? But on the other hand there is something like application classloaders...
-
8. Re: Class access / class visibility
periklis_douvitsas Jul 12, 2012 7:14 AM (in response to lucas_smith)Hi
yes, you are right.
Maybe you can have a look at this webpage for classloader configuration in jboss
https://community.jboss.org/wiki/ClassLoadingConfiguration
Is this what you asking?
Hope this helps