SEVERE: java.lang.NullPointerException - glassfish

When i try to run my index.jsp page which calls WebClient.jsp page, where i define my InitialContext() method, and implement my Bean in class AccountBean.java shows ..
SEVERE: java.lang.NullPointerException........
I use Glassfish v3, jdk1.6, eclipse Helios.

I can't give too specific an answer, but my recommendation for this issue is to make sure that every object you are trying to use is guaranteed to be pointing to an instance of the object.

Related

avatservice returns nullpointer exception in JIRA 6.4

For our project tab panel plugin, we are using AvatarService to show avatar of the assigned user for an issue. Until 6.3.9 it was working fine, but now after upgrading to 6.4.1 it seems to break and throws null pointer exception.
I'm obtaining AvatarService from TabPanel class's constructor and passing it to velocity in params.
But when the tab panel is loaded I get this error in the page's source:
org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getAvatarUrlNoPermCheck' in class com.atlassian.jira.avatar.AvatarServiceImpl threw exception java.lang.NullPointerException at shared/Panel.vm.
What could be wrong? Please help
Take a look it may be the same root cause:
The Base URL has been improperly specified.
Confirm that the Base URL in Configuring JIRA Options is the exact
same URL that you use to access the JIRA instance.

Glassfish 3: Calling method on ejb in ServletContextListener.contextDestroyed method leads to exception

I have an #Singleton ejb which will be called in a ServletContextListener contextInitialized and contextDestroyed method. The call in the contextDestroyed method leads to an Exception:
javax.ejb.EJBException: Attempt to invoke when container is in STOPPED
It looks as if the contextDestroyed method is called after the container went down leaving
me with no chance to access any resources like my ejb.
Does anyone know if there is any way to know about application shutdown before the container
is down?
Thanx in advance.
Cheers, Sven
You could use the #PreDestroy annotation on a method directly in your #Singleton bean. Thus marked, the method will be called before the bean destruction, during the application shutdown.

Glassfish Bean Validation weird error

I am using bean validation in my application. When there is no constraint validation errors everything works nicely. Every time there is a validation error, Glassfish throws the following exception:
Caused by: java.lang.ClassNotFoundException: javax.validation.groups.Default: java.net.MalformedURLException: Unknown protocol: osgi
at com.sun.corba.ee.impl.util.JDKBridge.loadClassM(JDKBridge.java:325)
at com.sun.corba.ee.impl.util.JDKBridge.loadClass(JDKBridge.java:228)
at com.sun.corba.ee.impl.javax.rmi.CORBA.Util.loadClass(Util.java:640)
at com.sun.corba.ee.impl.util.RepositoryId.getClassFromType(RepositoryId.java:628)
at com.sun.corba.ee.impl.orbutil.RepIdDelegator.getClassFromType(RepIdDelegator.java:169)
at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.readClass(CDRInputStream_1_0.java:1439)
The bean-validation.jar is present in glassfish/modules folder. The startup doesn't throw any exceptions regarding validation.
PS. Note that we are using remote beans with CORBA.
Reproducable on GlassFish 3.1.2.2 and 3.1.1.
I traced this problem to serialization of the ConstraintValidationException through CORBA. Somehow the bean-validation module is not loaded properly with osgi and the javax.validation.groups.Default class is missing. I made a quick workaround so that the ConstraintValidationException is intercepted and never sent through CORBA. Instead the validation error information is gathered in a custom Exception class that can be actually serialized through the services.

Maven GAE Plugin using Google Cloud SQL

Good morning,
I am trying to local test my web application, which makes use of:
Spring (core + MVC)
Google AppEngine
Google Cloud SQL
Hibernate
In this page https://developers.google.com/cloud-sql/docs/developers_guide_java Google explains how to make the hello world run, and that's right.
I deploy to AppEngine with no problems.
The next need is testing on the local system, with a local standard mysql instance and that document goes ahead in the explanation. You can give your local access credentials by command-line or by Google Eclipse Plugin.
But I am using the Maven GAE Plugin http://www.kindleit.net/maven_gae_plugin/ and simple mvn gae:run ends up with this error:
Cannot resolve reference to bean 'mySessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mySessionFactory' defined in ServletContext resource [/WEB-INF/spring/root-context.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: System property rdbms.driver must be set.:
java.lang.IllegalStateException: System property rdbms.driver must be set.
at com.google.appengine.api.rdbms.dev.LocalRdbmsServiceLocalDriver.registerDriver(LocalRdbmsServiceLocalDriver.java:80)
That's a pretty descriptive error, so I desperately tried:
mvn gae:run -Drdbms.server=local -Drdbms.driver=com.mysql.jdbc.Driver -Drdbms.url=jdbc:mysql://localhost:3306/prova?user=root&password=pass
... with no result! :-(
Help! O.O
Solved using plugin's jvmFlags

Local stateless EJB injection within singleton startup EJB

is this possible somehow? Following scenario:
statelesse local EJB with name A
singleton startup EJB with name B
B contains a reference to A
I tried but my application server (WAS) fails on application startup with the error that A was not found. The console log also makes clear that A was not started at the moment the B is loaded but some other stateless EJBs are started before B. Making A also a singleton EJB and letting B depond on A via annotation #DependsOn({"A"}) produced an error, too, stating that dependent bean A was not found. Using A in a web module works fine.
Any ideas what' I do wrong? Thx for any help!
Steffen Harbich
If A is in a different module/application as B, then you need to ensure that the module of A is configured to start before the module of B. You can either use initialize-in-order in application.xml, or use module starting weights in the admin console.