[EJB3] - Lookup and invoke a _local_ EJB via a remote EJB by a remote client
by Matthias M.
Matthias M. [https://community.jboss.org/people/virtuellesnugat] created the discussion
"Lookup and invoke a _local_ EJB via a remote EJB by a remote client"
To view the discussion, visit: https://community.jboss.org/message/742757#742757
--------------------------------------------------------------
Hi there,
I'm new to the jboss AS and the EJB. The book I've read doesn't help me, since the new JNDI naming changes so much.
But during the last days I've managed to setup the server, deploy some remote stateful and stateless session beans. But now I'm trying something different:
* Local stateless session bean named "TimeBean", with it's interface "ITimeLocal"
* Remote stateless session bean named "CallerBean", with it's interface "ICallerRemote"
* and a remote Client named "CallerClientBean"
*ITimeLocal*
package test.jboss.umweg.server.local;
import javax.ejb.Local;
@Local
public interface ITimeLocal {
public long getTime();
}
*TimeBean*
package test.jboss.umweg.server.local;
import java.util.Date;
import javax.ejb.Local;
import javax.ejb.Stateless;
@Stateless
@Local(ITimeLocal.class)
public class TimeBean implements ITimeLocal {
@Override
public long getTime() {
return new Date().getTime();
}
}
So that's just the local bean. It was deployed successfully and the JNDI Bindings where created.
The call from the CallerClientBean to the CallerBean works fine (I tested with "return 0").
But when I tried the real call it wouldn't work:
Extracted from *CallerBean*
@Override
public long askTime() {
// lookup and invoke Local Bean, return time
try {
Context context = getInitialContext();
ITimeLocal szb = (ITimeLocal) context.lookup(getJndiName());
long time = szb.getTime();
System.out.println("Time: " + time);
return time;
} catch (NamingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return 0;
}
I build the *InitialContext* like this (+though I didn't set a "jboss-ejb-client.properties" on server side, *maybe that's a problem*+):
private InitialContext getInitialContext() throws NamingException {
Hashtable p = new Hashtable();
p.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
return new InitialContext(p);
}
And I tried two different *JNDI* names:
* the same I've been building the other ones:
ejb:/TimeBean//TimeBean!test.jboss.umweg.server.local.ITimeLocal
* and the global JNDI binding I got from the deploy:
java:global/TimeBean/TimeBean!test.jboss.umweg.server.local.ITimeLocal
But I guess my main-problem is, that I'm not aware of howto call a local bean. And I couldn't find anything really helpful. I didn't post the Exceptions (first runtime, the illegalState), but I bet my faults are obvious to most people here :)
Thanks!!
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/742757#742757]
Start a new discussion in EJB3 at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
12 years, 3 months
JBoss 5.1.0: classLoader is not connected to a domain (probably undeployed?) for class java.lang.Math
by Jari Fredriksson
Hello list.
My setup is a Liferay CE 6.0.6 on JBoss AS 5.1.0. I have a strange error
in my process causing some headache.
java.lang.Math... but I googled a bit with this error and found similar
reports with other standard JDK classes too, so it not the class, but
something with JBoss.
Any ideas?
2012-06-19 16:53:44,972 ERROR [fi.dise.provisioning.PersonAccount]
(liferay/scheduler_dispatch)
java.lang.IllegalStateException:
BaseClassLoader@1734e3de{vfsfile:/home/liferay/jboss-5.1.0/server/default/deploy/masters2.war/}
classLoader is not connected to a domain (probably undeployed?) for
class java.lang.Math
at
org.jboss.classloader.spi.base.BaseClassLoader.loadClassFromDomain(BaseClassLoader.java:793)
at
org.jboss.classloader.spi.base.BaseClassLoader.loadClass(BaseClassLoader.java:441)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at
fi.dise.provisioning.PersonAccount.updateStatus(PersonAccount.java:332)
at
fi.dise.provisioning.PersonProvisioningEngine.receive(PersonProvisioningEngine.java:695)
at sun.reflect.GeneratedMethodAccessor1098.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
com.liferay.portal.kernel.bean.ClassLoaderBeanHandler.invoke(ClassLoaderBeanHandler.java:54)
at $Proxy1082.receive(Unknown Source)
at
com.liferay.portal.kernel.scheduler.messaging.SchedulerEventMessageListenerWrapper.receive(SchedulerEventMessageListenerWrapper.java:57)
at
com.liferay.portal.kernel.messaging.InvokerMessageListener.receive(InvokerMessageListener.java:63)
at
com.liferay.portal.kernel.messaging.ParallelDestination$1.run(ParallelDestination.java:61)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
12 years, 3 months
[JBoss Messaging] - XA transaction does not work correctly
by fregg
fregg [https://community.jboss.org/people/fregg] created the discussion
"XA transaction does not work correctly"
To view the discussion, visit: https://community.jboss.org/message/742713#742713
--------------------------------------------------------------
Hello,
i encountered strange problem. I test XA with different JMS providers and JBoss 5.1.
Currently I test JBoss Messaging 1.4.8. It has two queues: X and Y.
On the JBoss 5.1 I deployed 2 MDBs.
First MDB is listening on Queue X and sends message to Queue Y.
Second MDB is listening on Queue Y and sends message to Queue X.
With this scenario, assuming that transactions works correctly, the sum of messages on Queues X and Y should be constant.
Unfortunately it isn't...
When I crash the JBoss(with kill -9) I can see that some messages are missing. It happens also when i crash the JBM server.
I use Oracle as persistence in JBM.
Here is my connection factory def:
<tx-connection-factory>
<jndi-name>JmsXA</jndi-name>
<xa-transaction/>
<track-connection-by-tx />
<rar-name>jms-ra.rar</rar-name>
<connection-definition>org.jboss.resource.adapter.jms.JmsConnectionFactory</connection-definition>
<config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Queue</config-property>
<config-property name="JmsProviderAdapterJNDI" type="java.lang.String">java:/DefaultJMSProvider</config-property>
<max-pool-size>20</max-pool-size>
<!--security-domain-and-application>JmsXARealm</security-domain-and-application-->
</tx-connection-factory>
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/742713#742713]
Start a new discussion in JBoss Messaging at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
12 years, 3 months
[JBoss Messaging] - XA transaction does not work correctly
by fregg
fregg [https://community.jboss.org/people/fregg] created the discussion
"XA transaction does not work correctly"
To view the discussion, visit: https://community.jboss.org/message/742711#742711
--------------------------------------------------------------
Hello,
i encountered strange problem. I test XA with different JMS providers and JBoss 5.1.
Currently I test JBoss Messaging 1.4.8. It has two queues: X and Y.
On the JBoss 5.1 I deployed 2 MDBs.
First MDB is listening on Queue X and sends message to Queue Y.
Second MDB is listening on Queue Y and sends message to Queue X.
With this scenario, assuming that transactions works correctly, the sum of messages on Queues X and Y should be constant.
Unfortunately it isn't...
When I crash the JBoss(with kill -9) I can see that some messages are missing. It happens also when i crash the JBM server.
I use Oracle as persistence in JBM.
Here is my connection factory def:
<tx-connection-factory>
<jndi-name>JmsXA</jndi-name>
<xa-transaction/>
<track-connection-by-tx />
<rar-name>jms-ra.rar</rar-name>
<connection-definition>org.jboss.resource.adapter.jms.JmsConnectionFactory</connection-definition>
<config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Queue</config-property>
<config-property name="JmsProviderAdapterJNDI" type="java.lang.String">java:/DefaultJMSProvider</config-property>
<max-pool-size>20</max-pool-size>
<!--security-domain-and-application>TibcoXARealm</security-domain-and-application-->
</tx-connection-factory>
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/742711#742711]
Start a new discussion in JBoss Messaging at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
12 years, 3 months
[jBPM] - JBPM namedquery not found
by Anderson Junqueira
Anderson Junqueira [https://community.jboss.org/people/ajbr] created the discussion
"JBPM namedquery not found"
To view the discussion, visit: https://community.jboss.org/message/742657#742657
--------------------------------------------------------------
Guys,
Hi there, I´m having a problem related to JBPM configuration:
Our architecture defines that corporate mapped entities should be deployed in a single ejb package file as a library in our server (jboss 5 eap) because it is shared across several applications.
This ejb pack have all the hibernate/JPA configuration and some EJBs that provide the query and data manipulation for my entities.
Now, our application is deployed in some modules:
an EAR
an EJB client interfaces jar.
an EJB implementation jar.
a WEBAPP war file.
Well, my problem is:
All my business logic are concentrated on my EJB jar and it does not have hibernate configured for it uses that corporate entities pack, and it has to manipulate some jbpm workflows.
I am having NamedQueries not found example.
Searching over the net, I found the queries orm files, but, the hibernate is configured on another jar.
I will have to configure and initialize the JBPM inside my EJB jar? or there is any other solution I could use?
My config:
Database: ORACLE 10g
App Server: JBOSS 5 EAP 5.1
JBPM: 3.2.3 (don't blame me, it's the client requirement)
WebApp: JSF 2, PRIMEFACES (I know, I know, jboss 5 is for JSF1, but they upgraded the libs and it seems to work, we are waiting until jboss eap 6 come out)
EJB: v3.0
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/742657#742657]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
12 years, 3 months