Null Pointer Exception in Stateless Session Beans(EJB 3.0)
I am executing a simple HelloUser example i code session bean interface and implementing session bean class in the EJB project.
package ejb3inaction.ejb;
import javax.ejb.Remote;
@Remote
public interface HelloUser {
public void sayHello(String name);
package ejb3inaction.ejb;
import javax.ejb.Stateless;
@Stateless
public class HelloUserBean implements HelloUser {
public void sayHello(String name) {
System.out.println("Hello " + name + " welcome to EJB 3 In Action!");
And in the client project i code this class and add JAR file of the EJB project.
package ejb3inaction.example;
import javax.ejb.EJB;
import ejb3inaction.ejb.*;
public class HelloUserClient {
@EJB
private static HelloUser helloUser;
public static void main(String[] args) {
helloUser.sayHello("Curious George");
System.out.println("Invoked EJB successfully .. see server console for output");
I am using netbeans 6.0(10 M) and Sun Application server 9.
it gives NullPointer Exception at the following line...
helloUser.sayHello("Curious George");
how i can resolve this error.
regards,
deemy
Well, helloUser is just a null reference, you haven't created an instance of HelloUser to use, hence the NPE
Similar Messages
-
Exception creating stateless session bean
hello, can some one tell what is the cause and the solution of the folowing exception :
EJB5070 Exception creating stateless session bean : [{0}]
com.sun.enterprise.InjectionException: Exception attempting to inject Env-Prop: ejb3.INplateformFacade/timerService@Field-Injectable Resource. Class name = ejb3.INplateformFacade Field name=[email protected]@ejb3.INplateformFacade/timerService@@ into class ejb3.INplateformFacade
at com.sun.enterprise.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:387)
at com.sun.enterprise.util.InjectionManagerImpl.inject(InjectionManagerImpl.java:206)
at com.sun.enterprise.util.InjectionManagerImpl.injectInstance(InjectionManagerImpl.java:127)
at com.sun.ejb.containers.StatelessSessionContainer.createStatelessEJB(StatelessSessionContainer.java:533)
at com.sun.ejb.containers.StatelessSessionContainer.access$100(StatelessSessionContainer.java:111)
at com.sun.ejb.containers.StatelessSessionContainer$SessionContextFactory.create(StatelessSessionContainer.java:772)
at com.sun.ejb.containers.util.pool.NonBlockingPool.getObject(NonBlockingPool.java:199)
at com.sun.ejb.containers.StatelessSessionContainer._getContext(StatelessSessionContainer.java:486)
at com.sun.ejb.containers.BaseContainer.getContext(BaseContainer.java:1675)
at com.sun.ejb.containers.BaseContainer.preInvoke(BaseContainer.java:1229)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:195)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:127)
at $Proxy63.tachePlanifier(Unknown Source)
thanx on advancei dont think so it is a typo in the name.
here is my source code :
@Stateless
public class INplateformFacade implements INplateformFacadeLocal {
@PersistenceContext
private EntityManager em;
private Date datePrevis;
@Resource
TimerService timerService;
@Timeout
public void traitementPlanifier(Timer timer) throws NamingException {
listerLeReprtoir(ChercherReprtoir());
public void tachePlanifier(Date datePrevis) {
this.datePrevis = datePrevis;
timerService.createTimer(datePrevis, null);
} -
Call stateless session bean EJB 2.0 from Webdynpro Java UI
Hello,
Can someone please tell me asto how to call a stateless session bean EJB 2.0 from Webdynpro Java UI?
The NWDS version is 7.0.
Thanks and Regards,
AryaHi Aryadipta
Please check this pdfs
https://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/b00917dc-ead4-2910-3ebb-b0a63e49ef10&overridelayout=true
Steps for calling stateless session bean in Webdynpro java
Go to NWDS -> open perspective ->j2ee
select EJB Module Project ->create a project with name
Open the Project -->RC on ejb-jar.xml -> Select new --> EJB
Give name to EJB Bean (First letter should be in capital letters)
select the type of bean as Stateless session bean and give the package name to store that EJB bean.
After that Expand ejb-jar.xml and then select the <projectEJB>
Double click on this on method tab double click you will get business method where we will create the methods for business logic
Double click on projectEJB and then RC on bean tab and write required business logic in bean window as follows(based on requirement we will design a business logic).
After writing the business logic go to project -> rebuild
Till now we have created one EJB jar file
then go to File-->Enterprise Application Project -->create a project (projectEAR)
After creating a project click on next-> here we will have ear projects and then we select specific project required for our application.(here select projectEJB)
After that Calculate EAR project will be available on j2ee explorer.
Right click on <Bean> here
select New->Web Service->give a name to webservice and select Default configuration type as simple SOAP
-->click next -> Finish.
That webservice and related are created in ejb-jar.xml .
Expand the ejb-jar.xml.and double click on < webservice>
RC ProjectEJB -> Build EJB Archive RC on CalculateEAR ->Build applicationarchive.
Expand the projectEAR->RC on CalculateEAR.ear->Deploy to J2EE Engine
Double click on calculateEAR.ear ->Webservice navigator tab ->we eill servers expand the node
select the specific WebService
Here we test the webservice by click on Test and test it.
After that go to Web dynpro perspective ->create one webdynpro Project and one component
RC on model> Select import Web Service model(last)>give model name and package
and select radio button as local file system or URL
Go to WSnavigator->copy the WSDL path and paste it in model WSDL path and click on finish.
from here onwards steps are same as that adaptive RFC model
Hope it helps
Thanks
Tulasi Palnati
Edited by: Tulasi Palnati on Aug 26, 2009 12:15 PM
Edited by: Tulasi Palnati on Aug 26, 2009 12:43 PM -
Stateless Session Bean + EJB Question + Jboss
Hello,
If I have a stateless session bean on a linux machine and it works locally what do i need to do to access a method in the session bean from a remote windows machine.
I would like to be able to execute my client jar file on a windows machine and have it access the jboss server on the linux machine. what do i need to do?
i have the session bean working locally on both windows and linux machine. do i need to to have a JSP/Servlet to access the session bean? can the session bean not be accessed directly? what should my classpath look like? do I need to include extra jar files in my client jar file.?
Thanks,
JoyceThanks guys for the help but I am still a little lost.
My Client windows machine has the client jar file and all the other jar files. This is my client class
package helloworld.client;
import javax.naming.Context;
import javax.naming.InitialContext;
import java.util.Hashtable;
import java.util.Properties;
import helloworld.interfaces.HelloWorldHome;
import helloworld.interfaces.HelloWorld;
public class HelloClient
public static void main(String[] args)
Hashtable prop = new Hashtable();
prop.put ("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
prop.put ("java.naming.provider.url","jnp://172.16.220.160:1099");
prop.put ("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
try
Context ctx = new InitialContext(prop);
Object obj = ctx.lookup("ejb/helloworld/HelloWorld");
System.out.println(obj);
HelloWorldHome home = (HelloWorldHome)javax.rmi.PortableRemoteObject.narrow(obj, HelloWorldHome.class);
HelloWorld helloWorld = home.create();
String str = helloWorld.sayHelloEJB("JOYCE is COOL");
System.out.println(str);
helloWorld.remove();
catch(Exception e)
e.printStackTrace();
I get a NullPointer ie the home object is null. The IP address is the IP of the Linux machine that has Jboss running on.
Questions are:
1. Do I need to have Tomcat running on my client machine if I am to connect via HTTP? Does this alter my client code.?
2. My JNDI lookup is what is causing the problem. Does my jboss.xml and my ejb-jar.jar look okay to you.
jboss.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS//EN" "http://www.jboss.org/j2ee/dtd/jboss.dtd">
<jboss>
<enterprise-beans>
<session>
<ejb-name>helloworld/HelloWorld</ejb-name>
<jndi-name>ejb/helloworld/HelloWorld</jndi-name>
</session>
</enterprise-beans>
<resource-managers>
</resource-managers>
</jboss>
ejb-jar.jar
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar >
<description>No Description.</description>
<display-name>Generated by XDoclet</display-name>
<enterprise-beans>
<!-- Session Beans -->
<session >
<description><![CDATA[No Description.]]></description>
<ejb-name>helloworld/HelloWorld</ejb-name>
<home>helloworld.interfaces.HelloWorldHome</home>
<remote>helloworld.interfaces.HelloWorld</remote>
<ejb-class>helloworld.session.HelloWorldBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Bean</transaction-type>
</session>
<!--
To add session beans that you have deployment descriptor info for, add
a file to your merge directory called session-beans.xml that contains
the <session></session> markup for those beans.
-->
<!-- Entity Beans -->
<!--
To add entity beans that you have deployment descriptor info for, add
a file to your merge directory called entity-beans.xml that contains
the <entity></entity> markup for those beans.
-->
<!-- Message Driven Beans -->
<!--
To add message driven beans that you have deployment descriptor info for, add
a file to your merge directory called message-driven-beans.xml that contains
the <message-driven></message-driven> markup for those beans.
-->
</enterprise-beans>
<!-- Relationships -->
<!-- Assembly Descriptor -->
<assembly-descriptor >
<!-- finder permissions -->
<!-- transactions -->
<!-- finder transactions -->
</assembly-descriptor>
</ejb-jar>
Do I need RMI ? Do I need to concern myself with CORBA? All Im looking for is a step by step to understanding what I need to configure? Is their some way I can debug?
Thanks alot,
Joyce -
How to use jta in toplink and stateless session bean EJB 3.0?
I have an application with techologies jsf,stateless session bean, adf, toplink
generated by toplink workbench.
In web side ı want to use two methods in stateless session bean which are updated
different tables. I call these methods in my page backing bean.
I also want to JTA in web side. My first methods is done correctly, but second method has an error. I wanto to rollback all transaction.
How can ı do that? with using JTA in Toplink...Yuichi
Did you manage to solve this? I'm doing something similar and seeing the same problem, although they're up to 7.3 SP7.
Any help greatly appreciated.
Lewis -
Class Cast Exception in Stateless session bean
Hi,
i am getting a class cast exception in this particular line....
in my EJBClient program i get this error..
//Getting a reference to the bean's home interface in client program
SimpleSessionHome home=(SimpleSessionHome)PortableRemoteObject.narrow(ref, SimpleSessionHome.class);Wher SimpleSessionHome is my Home interface.
I am not able to correct the error. Plz help me.
Thanks,
AkshathaHi,
Make sure you are looking up the correct JNDI name. And, what king of Classloading is being used.
This could be an issue if there are different classloader in action.
According to the JBoss 4 Admin Guide.
Most developers know that the type of a class in Java is a function of the fully qualified name of the class. However the type is also a function of the java.lang.ClassLoader that is used to define that class.
Feel free to forward your queries / comment.
Pawan. -
I have a stateless Session Bean EJBs deployed on the OC4J Application Server that calls this method:
public String getCurrentTime()
return ""+ new java.util.Date();
I try to access it from a client running on the same machine(windows nt).
DateEJBClient dateEJBClient = new DateEJBClient();
try
Context context = getInitialContext();
DateEJBHome dateEJBHome = (DateEJBHome)PortableRemoteObject.narrow(context.lookup("DateEJB"), DateEJBHome.class);
DateEJB dateEJB;
// Use one of the create() methods below to create a new instance
dateEJB = dateEJBHome.create();
// Call any of the Remote methods below to access the EJB
System.out.println("Date & Time >>> "+dateEJB.getCurrentTime());
catch(Throwable ex)
Any idea why I get this error?
com.evermind.server.rmi.OrionRemoteException: jazn.com/admin is not allowed to call this EJB method, check your security settings (method-permission in ejb-jar.xml and security-role-mapping in orion-application.xml).
at DateEJBHome_StatelessSessionHomeWrapper3.create(DateEJBHome_StatelessSessionHomeWrapper3.java:40)
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:324)
at com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.java:124)
at com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.java:48)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
at java.lang.Thread.run(Thread.java:534)
at connection to localhost/127.0.0.1 as admin
at DateEJBHome_StatelessSessionHomeWrapper3.create(DateEJBHome_StatelessSessionHomeWrapper3.java:40)
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:324)
at com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.java:124)
at com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.java:48)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
at java.lang.Thread.run(Thread.java:534)
Process exited with exit code 0.I beleive you need the POI jar file in the <ias_home>/j2ee//home/applib directory or in your app severs PATH.
-
Odd marshalling problems with EJB 3.0 stateless session bean
Hello,
I began encountering marshalling exceptions when invoking methods on a previously functionining facade bean. The problem seems to be almost arbitrary, in that certain packages receive marshalling exceptions, while others do not (my main client started failing, but then I realized that a simple test class was still working, along with oddly JSFs that invoke that main client, which fails outside of that scope). Is there some config issue with stateless session beans (in 3.0) that I might be missing? There are no duplicate versions of these class; they have not been modified; they've been compiled with the current IDE. Any help would be appreciated. Thanks.
full stack trace:
com.evermind.reflect.UndeclaredExceptionTypeException: oracle.oc4j.rmi.OracleRemoteException
at __Proxy1.findAllViewRight(Unknown Source)
at com.jwt.gui.menus.beans.ViewRightBean.<init>(ViewRightBean.java:34)
at com.jwt.gui.menus.beans.ViewRightBean.main(ViewRightBean.java:63)
oracle.oc4j.rmi.OracleRemoteException: Invocation error: java.rmi.UnmarshalException: Error deserializing return-value: java.io.InvalidClassException: com.jwt.gui.menus.persistence.ViewRight; local class incompatible: stream classdesc serialVersionUID = 2365320765203750319, local class serialVersionUID = -8750611773395720631
at com.evermind.server.rmi.RMICall.throwRecordedException(RMICall.java:142)
at com.evermind.server.rmi.RMIClientConnection.obtainRemoteMethodResponse(RMIClientConnection.java:472)
at com.evermind.server.rmi.RMIClientConnection.invokeMethod(RMIClientConnection.java:416)
at com.evermind.server.rmi.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:63)
at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(RecoverableRemoteInvocationHandler.java:28)
at com.evermind.server.ejb.StatelessSessionRemoteInvocationHandler.invoke(StatelessSessionRemoteInvocationHandler.java:43)
at __Proxy1.findAllViewRight(Unknown Source)
at com.jwt.gui.menus.beans.ViewRightBean.<init>(ViewRightBean.java:34)
at com.jwt.gui.menus.beans.ViewRightBean.main(ViewRightBean.java:63)
Nested exception is:
java.rmi.UnmarshalException: Error deserializing return-value: java.io.InvalidClassException: com.jwt.gui.menus.persistence.ViewRight; local class incompatible: stream classdesc serialVersionUID = 2365320765203750319, local class serialVersionUID = -8750611773395720631
at com.evermind.server.rmi.RMICall.EXCEPTION_ORIGINATES_FROM_THE_REMOTE_SERVER(RMICall.java:109)
at com.evermind.server.rmi.RMICall.throwRecordedException(RMICall.java:128)
at com.evermind.server.rmi.RMIClientConnection.obtainRemoteMethodResponse(RMIClientConnection.java:472)
at com.evermind.server.rmi.RMIClientConnection.invokeMethod(RMIClientConnection.java:416)
at com.evermind.server.rmi.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:63)
at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(RecoverableRemoteInvocationHandler.java:28)
at com.evermind.server.ejb.StatelessSessionRemoteInvocationHandler.invoke(StatelessSessionRemoteInvocationHandler.java:43)
at __Proxy1.findAllViewRight(Unknown Source)
at com.jwt.gui.menus.beans.ViewRightBean.<init>(ViewRightBean.java:34)
at com.jwt.gui.menus.beans.ViewRightBean.main(ViewRightBean.java:63)
oracle.oc4j.rmi.OracleRemoteException: Invocation error: java.rmi.UnmarshalException: Error deserializing return-value: java.io.InvalidClassException: com.jwt.gui.menus.persistence.ViewRight; local class incompatible: stream classdesc serialVersionUID = 2365320765203750319, local class serialVersionUID = -8750611773395720631
at com.evermind.server.rmi.RMICall.throwRecordedException(RMICall.java:142)
at com.evermind.server.rmi.RMIClientConnection.obtainRemoteMethodResponse(RMIClientConnection.java:472)
at com.evermind.server.rmi.RMIClientConnection.invokeMethod(RMIClientConnection.java:416)
at com.evermind.server.rmi.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:63)
at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(RecoverableRemoteInvocationHandler.java:28)
at com.evermind.server.ejb.StatelessSessionRemoteInvocationHandler.invoke(StatelessSessionRemoteInvocationHandler.java:43)
at __Proxy1.findAllViewRight(Unknown Source)
at com.jwt.gui.menus.beans.ViewRightBean.<init>(ViewRightBean.java:34)
at com.jwt.gui.menus.beans.ViewRightBean.main(ViewRightBean.java:63)
Nested exception is:
java.rmi.UnmarshalException: Error deserializing return-value: java.io.InvalidClassException: com.jwt.gui.menus.persistence.ViewRight; local class incompatible: stream classdesc serialVersionUID = 2365320765203750319, local class serialVersionUID = -8750611773395720631
at com.evermind.server.rmi.RMICall.EXCEPTION_ORIGINATES_FROM_THE_REMOTE_SERVER(RMICall.java:109)
at com.evermind.server.rmi.RMICall.throwRecordedException(RMICall.java:128)
at com.evermind.server.rmi.RMIClientConnection.obtainRemoteMethodResponse(RMIClientConnection.java:472)
at com.evermind.server.rmi.RMIClientConnection.invokeMethod(RMIClientConnection.java:416)
at com.evermind.server.rmi.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:63)
at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(RecoverableRemoteInvocationHandler.java:28)
at com.evermind.server.ejb.StatelessSessionRemoteInvocationHandler.invoke(StatelessSessionRemoteInvocationHandler.java:43)
at __Proxy1.findAllViewRight(Unknown Source)
at com.jwt.gui.menus.beans.ViewRightBean.<init>(ViewRightBean.java:34)
at com.jwt.gui.menus.beans.ViewRightBean.main(ViewRightBean.java:63)Hello,
I began encountering marshalling exceptions when invoking methods on a previously functionining facade bean. The problem seems to be almost arbitrary, in that certain packages receive marshalling exceptions, while others do not (my main client started failing, but then I realized that a simple test class was still working, along with oddly JSFs that invoke that main client, which fails outside of that scope). Is there some config issue with stateless session beans (in 3.0) that I might be missing? There are no duplicate versions of these class; they have not been modified; they've been compiled with the current IDE. Any help would be appreciated. Thanks.
full stack trace:
com.evermind.reflect.UndeclaredExceptionTypeException: oracle.oc4j.rmi.OracleRemoteException
at __Proxy1.findAllViewRight(Unknown Source)
at com.jwt.gui.menus.beans.ViewRightBean.<init>(ViewRightBean.java:34)
at com.jwt.gui.menus.beans.ViewRightBean.main(ViewRightBean.java:63)
oracle.oc4j.rmi.OracleRemoteException: Invocation error: java.rmi.UnmarshalException: Error deserializing return-value: java.io.InvalidClassException: com.jwt.gui.menus.persistence.ViewRight; local class incompatible: stream classdesc serialVersionUID = 2365320765203750319, local class serialVersionUID = -8750611773395720631
at com.evermind.server.rmi.RMICall.throwRecordedException(RMICall.java:142)
at com.evermind.server.rmi.RMIClientConnection.obtainRemoteMethodResponse(RMIClientConnection.java:472)
at com.evermind.server.rmi.RMIClientConnection.invokeMethod(RMIClientConnection.java:416)
at com.evermind.server.rmi.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:63)
at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(RecoverableRemoteInvocationHandler.java:28)
at com.evermind.server.ejb.StatelessSessionRemoteInvocationHandler.invoke(StatelessSessionRemoteInvocationHandler.java:43)
at __Proxy1.findAllViewRight(Unknown Source)
at com.jwt.gui.menus.beans.ViewRightBean.<init>(ViewRightBean.java:34)
at com.jwt.gui.menus.beans.ViewRightBean.main(ViewRightBean.java:63)
Nested exception is:
java.rmi.UnmarshalException: Error deserializing return-value: java.io.InvalidClassException: com.jwt.gui.menus.persistence.ViewRight; local class incompatible: stream classdesc serialVersionUID = 2365320765203750319, local class serialVersionUID = -8750611773395720631
at com.evermind.server.rmi.RMICall.EXCEPTION_ORIGINATES_FROM_THE_REMOTE_SERVER(RMICall.java:109)
at com.evermind.server.rmi.RMICall.throwRecordedException(RMICall.java:128)
at com.evermind.server.rmi.RMIClientConnection.obtainRemoteMethodResponse(RMIClientConnection.java:472)
at com.evermind.server.rmi.RMIClientConnection.invokeMethod(RMIClientConnection.java:416)
at com.evermind.server.rmi.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:63)
at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(RecoverableRemoteInvocationHandler.java:28)
at com.evermind.server.ejb.StatelessSessionRemoteInvocationHandler.invoke(StatelessSessionRemoteInvocationHandler.java:43)
at __Proxy1.findAllViewRight(Unknown Source)
at com.jwt.gui.menus.beans.ViewRightBean.<init>(ViewRightBean.java:34)
at com.jwt.gui.menus.beans.ViewRightBean.main(ViewRightBean.java:63)
oracle.oc4j.rmi.OracleRemoteException: Invocation error: java.rmi.UnmarshalException: Error deserializing return-value: java.io.InvalidClassException: com.jwt.gui.menus.persistence.ViewRight; local class incompatible: stream classdesc serialVersionUID = 2365320765203750319, local class serialVersionUID = -8750611773395720631
at com.evermind.server.rmi.RMICall.throwRecordedException(RMICall.java:142)
at com.evermind.server.rmi.RMIClientConnection.obtainRemoteMethodResponse(RMIClientConnection.java:472)
at com.evermind.server.rmi.RMIClientConnection.invokeMethod(RMIClientConnection.java:416)
at com.evermind.server.rmi.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:63)
at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(RecoverableRemoteInvocationHandler.java:28)
at com.evermind.server.ejb.StatelessSessionRemoteInvocationHandler.invoke(StatelessSessionRemoteInvocationHandler.java:43)
at __Proxy1.findAllViewRight(Unknown Source)
at com.jwt.gui.menus.beans.ViewRightBean.<init>(ViewRightBean.java:34)
at com.jwt.gui.menus.beans.ViewRightBean.main(ViewRightBean.java:63)
Nested exception is:
java.rmi.UnmarshalException: Error deserializing return-value: java.io.InvalidClassException: com.jwt.gui.menus.persistence.ViewRight; local class incompatible: stream classdesc serialVersionUID = 2365320765203750319, local class serialVersionUID = -8750611773395720631
at com.evermind.server.rmi.RMICall.EXCEPTION_ORIGINATES_FROM_THE_REMOTE_SERVER(RMICall.java:109)
at com.evermind.server.rmi.RMICall.throwRecordedException(RMICall.java:128)
at com.evermind.server.rmi.RMIClientConnection.obtainRemoteMethodResponse(RMIClientConnection.java:472)
at com.evermind.server.rmi.RMIClientConnection.invokeMethod(RMIClientConnection.java:416)
at com.evermind.server.rmi.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:63)
at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(RecoverableRemoteInvocationHandler.java:28)
at com.evermind.server.ejb.StatelessSessionRemoteInvocationHandler.invoke(StatelessSessionRemoteInvocationHandler.java:43)
at __Proxy1.findAllViewRight(Unknown Source)
at com.jwt.gui.menus.beans.ViewRightBean.<init>(ViewRightBean.java:34)
at com.jwt.gui.menus.beans.ViewRightBean.main(ViewRightBean.java:63) -
Max Beans in Cache causes NULL Pointer Exception
Hi All,
a rather weird event (from our perspective) occurs when we do the
following:
We have an entity bean set to max beans in cache 100 (default value of
our deployment tool ), the database table related to that bean holds
lets say 300 entries.
Doing a find all and in the same session bean instanciated transaction a
processing loop over the enumeration of beans we get an NULL Pointer
exception when accesing the 101 Bean. Neverthless the Weblogic server
increases the cache size automatically but obviously not fast enough and
not on time.
has anyone experienced the same problem and has a fix for it, appart
from increasing the cache size in the deployment descriptor ?
any help welcome
MichaelHi Michael.
Can you post the stack trace of the NullPointerException? Was it in
your code or ours? Also, what version of WebLogic are you using?
-- Rob
Rob Woollen
Software Engineer
BEA WebLogic
[email protected]
Michael Rupprecht wrote:
Hi All,
a rather weird event (from our perspective) occurs when we do the
following:
We have an entity bean set to max beans in cache 100 (default value of
our deployment tool ), the database table related to that bean holds
lets say 300 entries.
Doing a find all and in the same session bean instanciated transaction a
processing loop over the enumeration of beans we get an NULL Pointer
exception when accesing the 101 Bean. Neverthless the Weblogic server
increases the cache size automatically but obviously not fast enough and
not on time.
has anyone experienced the same problem and has a fix for it, appart
from increasing the cache size in the deployment descriptor ?
any help welcome
Michael -
Calling EJB 3.0 Stateless Session Bean
Dear all,
I created a stateless session bean with a hello world method on it. Now i want to call the method from a BeanDecorator class, through a getter metod. When i use the jndi lookup in my getter, i can call the helloWorld method without a problem. However, when i dont use the jndi lookup, and only use the @EJB annotation, i always get a nullpointer.
This is working:
InitialContext ic = new InitialContext();
test = (TestLocal)ic.lookup("test.be/ear~bd/LOCAL/TestBean/"+TestLocal.class.getName());
test.helloWorld()
This gives nullpointer:
@EJB
private TestLocal test;
test.helloWorld();
What is the correct way to consume session beans without having to explicitly code the jndi lookup?
Kind regards.Hi,
any annotation like this can be used only in "managed classes" like Session Beans, Servlets etc. Managed classes are those classes managed by the J2EE server. Managed here means, lifetime controlled by server.
You can find this in J2EE specification.
Frank -
Some methods not working in EJB 3.0 stateless session bean
Hi,
I am trying to build an application with EJB 3.0 stateless session bean in weblogic 10. In that during build (using ant 1.6) it showing error as one of the ejb-class should have anotataion as @stateless, @stateful or @messageDiven
But i have given it corrrectly.
When I comment some of the methods the same bean is working fine. While i have annoatated some of the methods with @transaction attribute annotataion.
So, should i write all those methods there any particular order or what.
Can anybody pls tell me, what can be the problem as weblogic.appc is giving such error?Hi,
I am trying to build an application with EJB 3.0 stateless session bean in weblogic 10. In that during build (using ant 1.6) it showing error as one of the ejb-class should have anotataion as @stateless, @stateful or @messageDiven
But i have given it corrrectly.
When I comment some of the methods the same bean is working fine. While i have annoatated some of the methods with @transaction attribute annotataion.
So, should i write all those methods there any particular order or what.
Can anybody pls tell me, what can be the problem as weblogic.appc is giving such error? -
NameNotFoundException EJB 3.0 Stateless Session Bean
Hi i am new to ejb 3.0 as well as ejb actually. I encountered an error trying out a small stateless session bean application.
23:15:02,312 ERROR [STDERR] javax.naming.NameNotFoundException: com.afis.ct.ri.session.ejb.ReportIncidentSession not bound
23:15:02,312 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
23:15:02,312 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
23:15:02,312 ERROR [STDERR] at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
23:15:02,312 ERROR [STDERR] at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
23:15:02,312 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)
23:15:02,312 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
23:15:02,312 ERROR [STDERR] at javax.naming.InitialContext.lookup(InitialContext.java:351)
23:15:02,312 ERROR [STDERR] at com.afis.ct.servlets.ri.ValidateIdentityServlet.validateIdentity(ValidateIdentityServlet.java:64)
23:15:02,312 ERROR [STDERR] at com.afis.ct.servlets.ri.ValidateIdentityServlet.processRequest(ValidateIdentityServlet.java:35)
23:15:02,312 ERROR [STDERR] at com.afis.ct.servlets.ri.ValidateIdentityServlet.doGet(ValidateIdentityServlet.java:19)
23:15:02,312 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
23:15:02,312 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
23:15:02,328 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
23:15:02,328 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
23:15:02,328 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
23:15:02,328 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
23:15:02,328 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
23:15:02,328 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
23:15:02,328 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
23:15:02,328 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
23:15:02,328 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
23:15:02,328 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
23:15:02,328 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
23:15:02,328 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
23:15:02,328 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
23:15:02,328 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
23:15:02,328 ERROR [STDERR] at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
23:15:02,328 ERROR [STDERR] at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
23:15:02,328 ERROR [STDERR] at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
23:15:02,328 ERROR [STDERR] at java.lang.Thread.run(Thread.java:595)My remote interface looks like
package com.afis.ct.ri.session.ejb;
import javax.ejb.Remote;
@Remote
public interface ReportIncidentSession {
public boolean isIdentityValid(String identity);
}My bean looks like
package com.afis.ct.ri.session.ejb;
import javax.ejb.Stateless;
@Stateless
public class ReportIncidentSessionBean implements ReportIncidentSession {
public ReportIncidentSessionBean() {
super();
public boolean isIdentityValid(String identity) {
return true;
}Finally i am calling from a servlet which is part of a web application under the same hood(ear) as the ejb jar file.
InitialContext ctx=new InitialContext();
ReportIncidentSession session=(ReportIncidentSession)ctx.lookup(ReportIncidentSession.class.getName());
return session.isIdentityValid(identity);I have done nothing more than making sure there is no compilation error, and i feel some mandatory steps are missing.. So thanks for any help!
Marvelous.Hi DRS, i tried your recommendation and injected the following on top of my servlet class:
EJB(name="ReportIncidentSessionBean", businessInterface=ReportIncidentSession.class)
public class ValidateIdentityServlet extends HttpServlet implements
ValidateIdentity {The original beanInterface you mentioned had an error.
And upon deployment, JBoss wasn't able to generate a deployment descriptor hinting at the annotations.
23:50:08,765 ERROR [MainDeployer] Could not create deployment: file:/C:/Program Files/jboss-4.0.4.GA/server/Marvelous/deploy/Avian Flu Information System.ear/Avian Flu Information System Web.war/
java.lang.UnsupportedOperationException: FIXME: should ignore annotations for missing classes
at org.jboss.lang.AnnotationHelper.getAnnotations(AnnotationHelper.java:98)
at org.jboss.lang.AnnotationHelper.getAnnotation(AnnotationHelper.java:75)
at org.jboss.lang.AnnotationHelper.isAnnotationPresent(AnnotationHelper.java:60)
at org.jboss.ws.server.WebServiceDeployerJSE.isWebserviceDeployment(WebServiceDeployerJSE.java:152)
at org.jboss.ws.server.WebServiceDeployer.create(WebServiceDeployer.java:101)
at org.jboss.ws.server.WebServiceDeployerJSE.create(WebServiceDeployerJSE.java:66)
at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.create(SubDeployerInterceptorSupport.java:180)
at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:91)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy49.create(Unknown Source)
at org.jboss.deployment.MainDeployer.create(MainDeployer.java:953)
at org.jboss.deployment.MainDeployer.create(MainDeployer.java:943)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:807)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:771)
at sun.reflect.GeneratedMethodAccessor11.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy6.deploy(Unknown Source)
at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:610)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:274)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:225)Your input is greatly appreciated! -
Stateless session Bean - xml and ejb-jar.xml file ???
Dear Experts,
Stateless-session bean
For Creating an ear file
we need ejb-jar.xml and weblogic-ejb-jar.xml files
Is these files are already available
or we have to type these files ??
Advance Thanks
Rengaraj.RMy best advice: surrender to use an IDE.
You wonder sometimes at how much productivity (read as 'time') could be wasted by doing something that could be done automatically. For a learning experience or a once only exercise is fine but as a routine thing, not worth it.
Cheers -
EJB: Stateless Session Bean create() Question.
Lets say I have a stateless session bean that fetches data from my database. The point of the bean is to just do large SQL searches and funnel data back to the client. The prolem I have is that I am somehow fighting memory leaks. Despite having checked the code a number of times, the memory usage on my appserver continues to climb no matter what I do. I have theorized that the problem might be in the way Im using ma DataFetchBean (DFB).
When I start the client, he obtains a user session. This is a stateful session bean that he uses for almost all communication with the server. Then I call "getDataFetchBean" in the user session which calls DataFetchBeanHome.create(). Then the client holds onto the returned reference, using it for the live of his connection. As he disconnects, he calls remove on the bean.
Question is this:
1) Is it better for me to call create() prior to each call to the stateless session bean ?
2) Do you have any theories on why im loosing memory with this setup?
TIA
-- Rob1. But I thought you were using a 'stateful session bean'?
2. For stateless session beans, there is no direct link between a remote reference and an instance of the bean. It is safe to hang on to the remote reference as long as you would like, of course it may go stale if the server dies. You will also find that the create() method does not actually contact the server, so doing it each usage costs very little. So, either way you should be fine.
3. As for memory leaks, make sure that you are closing all statements, result sets, etc. promptly. These are commonly the problem. Also, use hprof or some other profile tool to determine what types of data you are allocating and (with better tools) what types of data you may be holding on to references to.
Chuck -
Null Pointer exception in accessing EJB in 9.0.3
Hi
The application is working fine with 9.0.2, but when I deployed in 9.0.3 it is giving Null Pointer Exception, throwing the error message in Stack Trace.
==========================================================
java.lang.NullPointerException
at com.evermind.server.ejb.EJBUtils.cloneOneObjectInstance(EJBUtils.java:416)
at com.evermind.server.ejb.EJBUtils.cloneArrayList(EJBUtils.java:599)
at com.evermind.server.ejb.EJBUtils.cloneObject(EJBUtils.java:357)
at ETOperationUtilitiesSession_StatelessSessionBeanWrapper136.getHouseChargesPrefs(ETOperationUtilitiesSession_StatelessSessionBeanWrapper136.java:5965)
at ETAHouseDocumentController.doPost(ETAHouseDocumentController.java:615)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:721)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
at com.evermi[i]Long postings are being truncated to ~1 kB at this time.Hi
The Problem which I posted earlier seems to be like..
If a EJB (Remote) has a method that returns an ArrayList, and one of the entries of the ArrayList is null, we get a NullPointerException, when clonnning the ArrayList .
This looks same as the one posted in relation EJB-Remote returning HashMap has null values.
Maybe you are looking for
-
Why again funtion modules in ABAP OO ?
if you look at the code inside cl_gui_frontend_services->gui_upload they use gui_upload function. there is no difference. internally the class also uses GUI_UPLOAD .......... there is conflict like data consistancy problem with function module .. why
-
How do I contact apple with unknown charges to my account
My account was charged almost $30.00 for apps that I did not purchase! How do I contact apple about these charges?
-
Sort by Artist / Date in List View
I like to have my albums sorted by Artist and then chronologically by Release Date This is fine in Grid View as i can sort by Artist and within that by Date. But when i switch to List View it sorts by Artist and within that by Album Title. There does
-
Invalid Format message-Please Help!
I hooked up a 26" tv monitor to my mini mac tonight. Everything was running great. I went into account settings to try to change the monitor display and make my fonts a little larger to accommodate the new monitor. The computer stopped suddenly and n
-
What can be done if ur camcorder is not qualified for FCE HD 3.5?
I recently brought the HDV Sony HC3 and the Final Cut Express HD 3.5... the problem i have now is that the Final Cut express HD 3.5 did not support my camcorder, do i have to wait for the new software update for my camcorder to be in the qualifed dev