[EJB/JBoss] - Trouble building simple EJB
by tamscot
Hi, just going through an example ejb and then adapting the method used to create my own bean. Trouble is when I edit the main Bean class, in this case JujitsuFacadeBean, it comes up with some parse error and starts to create an interface in the ejbModule package.
IDE is Eclipse 3.2.
JDK is 5.
xdoclet is 1.2.3
Jboss is 4.0.5.
i followed the example as per the book. Where am I going wrong?
Here is the errors reported in the console...
| Buildfile: /home/tam/workspace/JuJitent/.metadata/.plugins/org.eclipse.jst.j2ee.ejb.annotations.xdoclet/tempAnt.xml
| init:
| ejbdoclet:
| [ejbdoclet] (XDocletMain.start 47 ) Running <deploymentdescriptor/>
| [ejbdoclet] Generating EJB deployment descriptor (ejb-jar.xml).
| [ejbdoclet] Error parsing File /home/tam/workspace/JuJitent/JujitsuEJB/ejbModule/com/jujitsu/ejb/JujitsuFacadeBean.java:Encountered "<"[" ...
| [ejbdoclet] "." ...
| [ejbdoclet] "(" ...
| [ejbdoclet] (XDocletMain.start 47 ) Running <remoteinterface/>
| [ejbdoclet] Generating Remote interface for 'com.jujitsu.ejb.JujitsuFacadeBean'.
| [ejbdoclet] (TemplateEngine.invokeMethod 547 ) Invoking method failed: xdoclet.modules.ejb.intf.InterfaceTagsHandler.extendsFrom, line=10 of template file: jar:file:/home/tam/opt/xdoclet-1.2.3/lib/xdoclet-ejb-module-1.2.3.jar!/xdoclet/modules/ejb/intf/resources/remote.xdt
| [ejbdoclet] java.lang.reflect.InvocationTargetException
| [ejbdoclet] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| [ejbdoclet] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| [ejbdoclet] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| [ejbdoclet] at java.lang.reflect.Method.invoke(Method.java:585)
| plus more errors...
|
This is the code for JujitsuFacadeBean, this implements the interface JujitsuFacade whose jar file has been included in the project.
| /**
| *
| */
| package com.jujitsu.ejb;
|
| import java.rmi.RemoteException;
| import java.util.Set;
|
| import javax.ejb.EJBException;
| import javax.ejb.SessionContext;
|
| import com.jujit.model.Club;
| import com.jujit.model.Instructor;
| import com.jujit.model.Student;
| import com.jujit.services.ClubFacade;
| import com.jujit.services.JujitsuFacade;
|
|
| /**
| *
| * <!-- begin-user-doc -->
| * A generated session bean
| * <!-- end-user-doc -->
| * *
| * <!-- begin-xdoclet-definition -->
| * @ejb.bean name="JujitsuFacade"
| * description="An EJB named JujitsuFacade"
| * display-name="JujitsuFacade"
| * jndi-name="JujitsuFacade"
| * type="Stateless"
| * transaction-type="Container"
| * @ejb.transaction
| * type="Supports"
| * <!-- end-xdoclet-definition -->
| * @generated
| */
|
| public abstract class JujitsuFacadeBean implements JujitsuFacade, javax.ejb.SessionBean {
| private JujitsuFacade jujitsuFacade;
|
| /**
| * @ejb.interface-method view-type="both"
| */
| public boolean doesClubExist(String clubId){
| return jujitsuFacade.doesClubExist(clubId);
| }
|
| /**
| *(a)ejb.interface-method view-type="both"
| */
| public boolean createClub(Club newClub){
| return jujitsuFacade.createClub(newClub);
| }
|
| /**
| * @ejb.interface-method view-type="both"
| */
| public Instructor findInstructor(String id){
| return jujitsuFacade.findInstructor(id);
| }
|
| /**
| * @ejb.interface-method view-type="both"
| */
| public Student findStudent(String id){
| return jujitsuFacade.findStudent(id);
| }
|
|
| /**
| * @ejb.interface-method view-type="both"
| */
| public Club findClub(String id){
| return jujitsuFacade.findClub(id);
| }
|
| /**
| * @ejb.interface-method view-type="both"
| */
| public Set<Student> getStudentsForClub(String clubId){
| return jujitsuFacade.getStudentsForClub(clubId);
| }
| /**
| *
| * <!-- begin-xdoclet-definition -->
| * @ejb.create-method view-type="remote"
| * <!-- end-xdoclet-definition -->
| * @generated
| *
| * //
| */
| public void ejbCreate() {
| jujitsuFacade = ClubFacade.getJujitsuFacade();
| }
|
| /**
| *
| * <!-- begin-xdoclet-definition -->
| * @ejb.interface-method view-type="remote"
| * <!-- end-xdoclet-definition -->
| * @generated
| *
| * //TODO: Must provide implementation for bean method stub
| */
| public String foo(String param) {
| return null;
| }
|
| /* (non-Javadoc)
| * @see javax.ejb.SessionBean#ejbActivate()
| */
| public void ejbActivate() throws EJBException, RemoteException {
| // TODO Auto-generated method stub
|
| }
|
| /* (non-Javadoc)
| * @see javax.ejb.SessionBean#ejbPassivate()
| */
| public void ejbPassivate() throws EJBException, RemoteException {
| // TODO Auto-generated method stub
|
| }
|
| /* (non-Javadoc)
| * @see javax.ejb.SessionBean#ejbRemove()
| */
| public void ejbRemove() throws EJBException, RemoteException {
| // TODO Auto-generated method stub
|
| }
|
| /* (non-Javadoc)
| * @see javax.ejb.SessionBean#setSessionContext(javax.ejb.SessionContext)
| */
| public void setSessionContext(SessionContext arg0) throws EJBException,
| RemoteException {
| // TODO Auto-generated method stub
|
| }
|
| /**
| *
| */
| public JujitsuFacadeBean() {
| // TODO Auto-generated constructor stub
| }
| }
|
Suprisingly the build after editing starts to assemble an interface JujitsuFacade...terribly.
| /*
| * Generated by XDoclet - Do not edit!
| */
| package com.jujitsu.ejb;
|
| /**
| * Remote interface for JujitsuFacade.
| * @generated
| * @wtp generated
| */
| public interface JujitsuFacade
| extends
|
Thats as far as it got.
Any help appreciated.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4106857#4106857
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4106857
18 years, 8 months
[EJB/JBoss] - help! - remote ejb call over ssl
by kdolan
Hi! I'm sorry if this post is a bit general but I'm not sure what to include.
I have two jboss servers (4.0.3) running on two different machines - one on each machine. I have servlet code running in one of the machines trying to remotely access an ejb running on the other machine. This is working great!
Now I need to make sure the remote call is secure. So, I have configured the machine running the ejb to use SSL following all of the jboss docs and googled posts I can possibly find. This now breaks everything - the servlet code can no longer talk to the remote ejb.
I've thoroughly googled and searched jboss and javaranch forums for help re: how to properly configure the client to work again but everything I have found (which is not much) does not seem to solve the problem.
Has anyone ever gotten this to work? If so, how did you do it?
Any other suggestions? helpful documentation? posts? questions?
Desperately seeking solution...
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4106853#4106853
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4106853
18 years, 8 months
[JBossCache] - How can I register PojoCache under AS 4.2.1?
by isthisusernameavailable
Hello,
I'm a newbie trying to get JBoss Cache working under a AS 4.2.1 cluster. I'm hoping our forum gurus can help me register a cluster-wide PojoCache correctly.
Here's my setup.
1. Install AS 4.2.1 successfully.
2. Download JBossCache-1.4.1.SP6.
3. Change JBossCache-1.4.1.SP6/etc/META-INF/pojocache-service.xml to use JBossTransactionManagerLookup instead of DummyTransactionManagerLookup.
4. Copy the modified JBossCache-1.4.1.SP6/etc/META-INF/pojocache-service.xml to <JBOSS_HOME>/server/all/deploy.
5. Start JBoss in "-c all" server mode.
6. Create a stateless bean that has this code in its @PostConstruct method:
MBeanServer server = MBeanServerLocator.locateJBoss();
| cache = (PojoCacheMBean)MBeanProxyExt.create(PojoCacheMBean.class, "jboss.cache:service=PojoCache,cacheType=Cache", server);
(Similar to what's shown in http://www.redhat.com/docs/manuals/jboss/jboss-eap-4.2/doc/cache/Cache_Fr...)
7. In my business method, try to access the cache to find a @PojoCacheable CacheItem
CacheItem item = (CacheItem)m_cache.getObject(name);
This throws the following exception in my server.log:
javax.management.InstanceNotFoundException: jboss.cache:service=PojoCache is not registered.
|
So my questions are:
1. Am I using the correct .xml file to configure PojoCache? It seems odd that I need to download the .4.1.SP6 distro just to get a config file, when AS 4.2.1 apparently already has the necessary libraries, so perhaps I'm not using the correct configuration xml file.
2. Assuming I'm using the correct xml file, what step am I missing to register the PojoCache service?
3. Am I accessing the cluster-wide PojoCache correctly with the create() method above? Is there a way to access it with a JDK5 annotation like @Resource?
Thanks in advance,
John
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4106844#4106844
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4106844
18 years, 8 months