[EJB 3.0] - Re: Invalid invocation of local interface (null container)
by piscean
Thanks Jaikiran, I added remote interface and a client
HelloRemote.java
--------------------
package ejb.hello;
import javax.ejb.Remote;
@Remote
public interface HelloRemote {
public String hello();
}
-------------------------
HelloTestRemote.java
-------------------------
package ejb.web;
import javax.naming.InitialContext;
import ejb.hello.HelloRemote;
public class HelloTestRemote {
/**
* @param args
*/
public static void main(String[] args) {
try {
InitialContext ctx = new InitialContext();
HelloRemote hellor = (HelloRemote) ctx.lookup("HelloBean/remote");
if (hellor == null) {
System.out.println("Hello is null");
}
System.out.println("Output = " + hellor.hello());
}
catch (Exception ex) {
System.out.println("Error in main");
ex.printStackTrace();
}
}
}
I actually already had remote interface, So didn't deploy the jar again...just added new client.
I still get errors,....
---------------------------------
java.lang.reflect.UndeclaredThrowableException
at $Proxy0.hello(Unknown Source)
at ejb.web.HelloTestRemote.main(HelloTestRemote.java:20)
Caused by: java.lang.Exception: Can not make remoting client invocation due to not being connected to server.
at org.jboss.remoting.Client.invoke(Client.java:1555)
at org.jboss.remoting.Client.invoke(Client.java:530)
at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:41)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:46)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:40)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:72)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:103)
... 2 more
Error in main
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4067629#4067629
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4067629
18Â years, 9Â months
[EJB 3.0] - Invalid invocation of local interface (null container)
by piscean
I am a newbie to EJB3. I have some experience with EJB2, but having hardtime with EJB3. I am trying to write one very simple stateless session bean. The files are,
1. ejb.hello.HelloBean.java
2. ejb.hello.HelloLocal.java
3. WEB-INF/jndi.properties
The files contents are,
ejb.hello.HelloBean.java
----------------------------
/**
*
*/
package ejb.hello;
import javax.ejb.Stateless;
@Stateless
public class HelloBean implements HelloRemote, HelloLocal {
private String greeting = "Hello";
/* (non-Javadoc)
* @see ejb.hello.Hello#hello()
*/
public String hello() {
return "Hello";
}
/**
* @return the greeting
*/
public String getGreeting() {
return greeting;
}
/**
* @param greeting the greeting to set
*/
public void setGreeting(String greeting) {
this.greeting = greeting;
}
}
ejb.hello.HelloLocal.java
----------------------------
/**
*
*/
package ejb.hello;
import javax.ejb.Local;
@Local
public interface HelloLocal {
public String hello();
}
WEB-INF/jndi.properties
----------------------------
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
java.naming.provider.url=localhost:1099
My client is HelloTest.java
------------------------------
package ejb.web;
import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.InitialContext;
import ejb.hello.HelloLocal;
import ejb.hello.HelloRemote;
public class HelloTest {
/**
* @param args
*/
public static void main(String[] args) {
try {
InitialContext ctx = new InitialContext();
HelloLocal hellol = (HelloLocal) ctx.lookup("HelloBean/local");
if (hellol == null) {
System.out.println("Hello is null");
}
System.out.println("Output = " + hellol.hello());
}
catch (Exception ex) {
System.out.println("Error in main");
ex.printStackTrace();
}
}
}
I get errors
--------------
Error in main
javax.ejb.EJBException: Invalid invocation of local interface (null container)
at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:77)
at $Proxy0.hello(Unknown Source)
at ejb.web.HelloTest.main(HelloTest.java:24)
When I start jboss server, it did display following lines in logs so I assume, the bean got deployed allright..
-----------------------------------------------------------------------
18:01:02,203 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:jar=EHello.jar,name=HelloBean,service=EJB3 with dependencies:
18:01:02,484 INFO [EJBContainer] STARTED EJB: ejb.hello.HelloBean ejbName: HelloBean
18:01:02,578 INFO [EJB3Deployer] Deployed: file:/C:/jboss-4.2.0.GA/server/default/deploy/EHello.jar
I assume, ejb-jar.xml, jboss.xml files are not needed with EJB3, Am I right? What am I doing wrong?
Please help....
Thanks.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4067625#4067625
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4067625
18Â years, 9Â months
[JBoss Seam] - exception during destroy... need help
by henrik.lindberg
I get the exception below when the session context times out, and a stateful bean in conversation is destroyed. I have no clue as to how to get rid of this exception.
Any hint is of value.
I am running seam 2.0 Beta 1 and Jboss 4.2.1.GA.
| 00:39:24,109 WARN [Component] Exception calling stateful session bean default @Remove method: linkFactory
| javax.ejb.EJBException: javax.el.PropertyNotFoundException: Property 'facesContext' not found on type org.jboss.seam.Namespace
| at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:63)
| at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
| at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:83)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.stateful.StatefulRemoveInterceptor.invoke(StatefulRemoveInterceptor.java:97)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
| at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:106)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:204)
| at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:100)
| at $Proxy160.destroy(Unknown Source)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:597)
| at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
| at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
| at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:72)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
| at org.jboss.seam.ejb.RemoveInterceptor.aroundInvoke(RemoveInterceptor.java:41)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
| at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:106)
| at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:50)
| at org.javassist.tmp.java.lang.Object_$$_javassist_39.destroy(Object_$$_javassist_39.java)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:597)
| at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
| at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:124)
| at org.jboss.seam.Component.callComponentMethod(Component.java:1975)
| at org.jboss.seam.Component.callDefaultRemoveMethod(Component.java:1886)
| at org.jboss.seam.Component.destroy(Component.java:1245)
| at org.jboss.seam.contexts.Contexts.destroy(Contexts.java:251)
| at org.jboss.seam.contexts.Contexts.destroyConversationContext(Contexts.java:413)
| at org.jboss.seam.contexts.Lifecycle.endSession(Lifecycle.java:236)
| at org.jboss.seam.contexts.ServletLifecycle.endSession(ServletLifecycle.java:132)
| at org.jboss.seam.servlet.SeamListener.sessionDestroyed(SeamListener.java:49)
| at org.apache.catalina.session.StandardSession.expire(StandardSession.java:702)
| at org.apache.catalina.session.StandardSession.isValid(StandardSession.java:592)
| at org.apache.catalina.session.ManagerBase.processExpires(ManagerBase.java:682)
| at org.apache.catalina.session.ManagerBase.backgroundProcess(ManagerBase.java:667)
| at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1286)
| at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1571)
| at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1580)
| at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1580)
| at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1560)
| at java.lang.Thread.run(Thread.java:619)
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4067622#4067622
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4067622
18Â years, 9Â months