[EJB 3.0] - JNDI Issue - Deploying EJB3 using Eclipse to JBoss 5
by yetti
Hello,
I've got a question that I think someone can help me with pretty quickly. I've got a stateless session bean that I've created based on this tutorial:
http://www.myeclipseide.com/documentation/quickstarts/ejb3/
My project name is different but the architecture of the project is the same -> a package that contains the bean, an interface, a local and remote. Then I have a simple tester app where I'm trying to call the bean using the remote.
JBoss starts just fine using both the command line as well as starting from within Eclipse. The bean deploys just fine either with a restart of JBoss or a redeploy. Where I am having trouble is running the tester application, specifically getting the JNDI name correct. When I set up the project I did NOT do support for Entity beans/JPA. Below is a snippet of the log from JBoss starting/deploying the bean:
----------------------------------------
11:20:06,218 INFO [JBossASKernel] Created KernelDeployment for: com.acmeco.serverapp.ftp
11:20:06,234 INFO [JBossASKernel] installing bean: jboss.j2ee:jar=com.acmeco.serverapp.ftp,name=FTPBean,service=EJB3
11:20:06,234 INFO [JBossASKernel] with dependencies:
11:20:06,234 INFO [JBossASKernel] and demands:
11:20:06,234 INFO [JBossASKernel] jboss.ejb:service=EJBTimerService
11:20:06,234 INFO [JBossASKernel] and supplies:
11:20:06,234 INFO [JBossASKernel] Class:com.acmeco.serverapp.ftp.ejb3.FTPBeanLocal
11:20:06,234 INFO [JBossASKernel] jndi:FTPBean/local-com.acmeco.serverapp.ftp.ejb3.FTPBeanLocal
11:20:06,234 INFO [JBossASKernel] jndi:FTPBean/remote-com.acmeco.serverapp.ftp.ejb3.FTPBeanRemote
11:20:06,234 INFO [JBossASKernel] jndi:FTPBean/local
11:20:06,234 INFO [JBossASKernel] jndi:FTPBean/remote
11:20:06,234 INFO [JBossASKernel] Class:com.acmeco.serverapp.ftp.ejb3.FTPBeanRemote
11:20:06,234 INFO [JBossASKernel] Added bean(jboss.j2ee:jar=com.acmeco.serverapp.ftp,name=FTPBean,service=EJB3) to KernelDeployment of: com.acmeco.serverapp.ftp
11:20:06,312 INFO [SessionSpecContainer] Starting jboss.j2ee:jar=com.acmeco.serverapp.ftp,name=FTPBean,service=EJB3
11:20:06,328 INFO [EJBContainer] STARTED EJB: com.acmeco.serverapp.ftp.ejb3.FTPBean ejbName: FTPBean
11:20:06,406 INFO [JndiSessionRegistrarBase] Binding the following Entries in Global JNDI:
FTPBean/remote - EJB3.x Default Remote Business Interface
FTPBean/remote-com.acmeco.serverapp.ftp.ejb3.FTPBeanRemote - EJB3.x Remote Business Interface
FTPBean/local - EJB3.x Default Local Business Interface
FTPBean/local-com.acmeco.serverapp.ftp.ejb3.FTPBeanLocal - EJB3.x Local Business Interface
-----------------------------------
Here is the code in the testing client app:
package com.acmeco.serverapp.ftp.ejb3;
|
| import javax.naming.InitialContext;
| import javax.naming.NamingException;
|
| public class FTPBeanTestClient {
|
| /**
| * @param args
| */
| public static void main(String[] args) {
| // TODO Auto-generated method stub
| try {
| InitialContext ctx = new InitialContext();
| FTPBeanRemote bean = (FTPBeanRemote) ctx.lookup("com.acmeco.serverapp.ftp.ejb3.FTPBean/FTPBean");
| bean.doWork();
| } catch (NamingException e){
| e.printStackTrace();
| }
| }
|
| }
|
I know I'm doing something dumb with the InitialContext.
1. What should I be putting into the client app context lookup?
2. Am I doing something else wrong/dumb?
Thanks in advance,
yetti
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4223747#4223747
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4223747
15 years, 9 months
[EJB/JBoss] - JBoss/ActiveMQ Messages never delivered to MDB
by rchristy
I have a very simple MDB (I am using JBoss 4.2.2 and ActiveMQ 5.,1 and 5.2 both have same behavior) that just consumes messages and throws them away. I can easily reproduce a scenario where I load 100 messages on the queue, 1 to 3 messages will never be delivered to the my MDB. If I stop/start the MDB, they get delivered fine. I tried moving to ActiveMQ 5.2 (I originally was 5.1) and I see the exact behavior. I can also reproduce the same issue but stopping the MDB, loading the messages on the queue, then starting the MDB. Again, messages that never get delivered.
Is there something wrong with this example?
@MessageDriven(activationConfig =
{
@ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue"),
@ActivationConfigProperty(propertyName="destination", propertyValue="mylilmdb.test.queue"),
@ActivationConfigProperty(propertyName="maximumRedeliveries", propertyValue="0"),
@ActivationConfigProperty(propertyName="acknowledgeMode", propertyValue="Auto-acknowledge")
})
@ResourceAdapter("activemq-rar.rar")
@PoolClass (value=org.jboss.ejb3.StrictMaxPool.class, maxSize=1)
public class MyLilMDB implements MessageListener {
static Logger logger = Logger.getLogger(MyLilMDB.class);
@Resource
private MessageDrivenContext mdc;
public void onMessage(Message message) {
try {
TextMessage msg = (TextMessage)message;
String xml = msg.getText();
logger.info("Chopped Message:" + xml.substring(0, 100));
}
catch (Exception e) {
logger.error(e.getMessage(),e);
mdc.setRollbackOnly();
}
}
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4223746#4223746
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4223746
15 years, 9 months