I'm using Play 1.2.7, somehow I found my project become weird, when I start the application, and visit any valid URL, it shows an NullPointerException:
Oops: NullPointerException
An unexpected error occured caused by exception NullPointerException: null
play.exceptions.UnexpectedException: Unexpected Error
at play.Play.start(Play.java:563)
at play.Play.detectChanges(Play.java:637)
at play.Invoker$Invocation.init(Invoker.java:198)
at Invocation.HTTP Request(Play!)
Caused by: java.lang.NullPointerException
at play.classloading.ApplicationCompiler$2.acceptResult(ApplicationCompiler.java:266)
at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:478)
at play.classloading.ApplicationCompiler.compile(ApplicationCompiler.java:282)
at play.classloading.ApplicationClassloader.getAllClasses(ApplicationClassloader.java:426)
at play.Play.start(Play.java:523)
... 3 more
And then I try to refresh the page, 2 or 3 time later, it become normal. What's going on here?
play doesn't support the following format in one class
public class A{
------
}
class B{
--
}
so make two different class instead of putting both in single class or use nested class.
It is a known bug: http://play.lighthouseapp.com/projects/57987/tickets/1379-unexpectedexception .
Maybe you use nested classes and Play has problems with it.
Related
Actually, I am facing below exception
ERROR : XML Read or Write is not done properly.
org.springframework.oxm.UncategorizedMappingException: Unknown JAXB exception; nested exception is javax.xml.bind.JAXBException: my_ClassName nor any of its super class is known to this context.
While making request that is throwing exception XMLMappingException. There is no code change in existing I just added new wsdl(converted to jar in proper place)but facing issue.
If anyone knows answer this question.
I tried the stack overflow solutions regarding this issue, solutions are not matching to my problem statement.
I am trying to mock static method using EasyMock+PowerMock. If I dont mock the static method, then I get the exception java.lang.ExceptionInInitializerError but with a different stack trace which is purely due to my code files and the error is obvious. However, if I mock the static method using EasyMock+PowerMock, the line PowerMock.mockStaticNice(Classname.class) throws the same exception but with a different stack trace. The stack trace is:
java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:386)
at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:219)
at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
at net.sf.cglib.proxy.Enhancer.createClass(Enhancer.java:317)
at org.easymock.internal.ClassProxyFactory.createProxy(ClassProxyFactory.java:175)
at org.easymock.internal.MocksControl.createMock(MocksControl.java:114)
at org.easymock.internal.MocksControl.createMock(MocksControl.java:88)
at org.easymock.internal.MocksControl.createMock(MocksControl.java:79)
at org.powermock.api.easymock.PowerMock.doCreateMock(PowerMock.java:2212)
at org.powermock.api.easymock.PowerMock.doMock(PowerMock.java:2163)
at org.powermock.api.easymock.PowerMock.mockStaticNice(PowerMock.java:331)
at PackageName(ClassName.java:125)
............................
The line 125 is PowerMock.mockStaticNice(Classname.class)
I have already tried this:
1) Mention class name containing static method in PrepareForTest({class1.class, class2.class, class3.class})
2) Mock static methods in #Before annotation.
I am stuck with this problem for the last 2 days. Kindly suggest solutions.
As I understood from your explanation the ExceptionInInitializerError is thrown during static initialisation of class? I've made such conclusion, because according to stacktrace the line PowerMock.mockStaticNice(Classname.class) is a first place where the class Classname is being loaded.
In this case you have to use #SuppressStaticInitializationFor(PackageName.ClassName`). More information you may find in PowerMock documentation: Suppress Unwanted Behavior
Oracle BPM Version 11.1.1.7. In a Humantask.task, Events tab, Content Change Callbacks section, I have entered the fully qualified class name of a class that implements NotesStore and the addNote and getNotes methods.
The class uses public methods in an AppModule to write and read comments using our custom table and these methods were well tested during development using the the BC tester and a temporary main in the callback class.
The project is compiled to a jar and placed in the BPM project's SCA-INF/lib folder, then the SCA and related ADF human task forms are deployed.
When a comment is made in the out of box human task comments section during a process instance, the class is called, but an exception occurs in the getNotes method at the line the AppModule is created:
java.lang.ClassCastException: oracle.jbo.common.ampool.PoolMgr
In the class, the AppModule is created as so:
AuditModule service = (AuditModule)Configuration.createRootApplicationModule("com.co.modules.AuditModule", "AuditModuleLocal");
I've tried adding a web.xml config file to the SCA BPM project with a filter as discussed in this post (last answer). This discusses triggering the ADF Context initialization, but I'm still getting the error.
The question is, how can I use a call back from a human task to call a method that uses AppModule public methods to do the DB work? Oracle's documentation is very sparse in this area (29.11.1).
UPDATE
Turns out that the stack trace shows that it is having problems looking up the data source name and is actually throwing a JBO error. If anyone runs in to this, check the stack trace for other issues.
UPDATE2
Finally got this to write task comments into the custom comments table. It turns out it doesn't seem possible to use an AppModule/Model approach in a comments callback class as there appears no way to initiate the needed ADF context when the class is called. By rewriting the class to access the DB directly in code the comment callback class does write the table. But, I am getting the same error as this post. Namely:
Exception invoking method from XML data control. Cause:oracle.bpel.services.workflow.client.WorkflowServiceClientException: java.rmi.UnmarshalException: cannot unmarshaling return; nested exception is:
Supplemental Detail java.io.IOException: Error: Unexpected type encountered in writeExternal oracle.bpel.services.workflow.client.WorkflowServiceClientException: java.rmi.UnmarshalException: cannot unmarshaling return; nested exception is:
java.io.IOException: Error: Unexpected type encountered in writeExternal
I suspect this is an Oracle framework issue as the types that are passed back are from the NotesStore implementation which are all passed back to the framework:
public class CommentsCallback implements NotesStore, Serializable...
public List<CommentType> getNotes(Task task)
Has anyone solved this? Full stacktrace at:
https://community.oracle.com/thread/3638940
After discussion with Oracle, the key to avoiding the unexpected type error is to use an ObjectFactory to populate the CommentType object. While we took a different approach ultimately, the below code was provided by Oracle as an example and might help someone trying to do this:
import oracle.bpel.services.workflow.task.model.ObjectFactory;
import oracle.bpel.services.workflow.task.model.CommentType;
import oracle.bpel.services.workflow.task.model.IdentityType;
...
ObjectFactory factory = new ObjectFactory()
CommentType commentType = factory.createCommentType();
IdentityType updatedBy = factory.createIdentityType();
updatedBy.setId("some user");
updatedBy.setType(IWorkflowConstants.IDENTITY_TYPE_USER);
updatedBy.setDisplayName("some user display name");
commentType.setUpdatedBy(updatedBy);
commentType.setComment("some comment");
...set the rest of the comment fields as necessary...
I'm implementing an edited version of the Secure controller, default in the latest Play Framework.
I have read several times that, if you want to customize the Secure behaviour, you're better off copying the source of the Secure module, and start customizing it.
So I did, and after editing the needed dependencies I received following error:
Execution exception
NullPointerException occured : null
In /app/controllers/SecureController.java (around line 194)
190:
security = classes.get(0);
191:
}
192:
if(security==null)System.out.println("security is null");
193:
try {
194:
return Java.invokeStaticOrParent(security, m, args);
195:
} catch(InvocationTargetException e) {
196:
throw e.getTargetException();
197:
}
198:
}
199:
200:
}
The first logic conclusion to jump to is: there are no classes that implement the needed Secure$Security inner class. But there most certainly is a subclass, so I was wondering how this error can be fixed.
A debugging session learns that the classes.get(0) does contain the class that has the #With annotation. So the null pointer exception must be caused by something within the class that contains the #With(SecureController). But I left that class just the way it was, I just edited the reference within the With annotation.
So my guess is that somehow, there is a null pointer within the class implementation.
But even when I implement default behaviour, without any references, it still generates a nullpointerexception.
EDIT:
I found the cause of this error, but the 'why' isn't clear.
This line is found in the implementation of the authenticate(...) method in the subclass of SecureController$Security:
flash.put("url", request.url);
Why does this fail?
I understand this situation may be very hard to reproduce, but I was wondering if someone already experienced the same issue.
Thanks for the help (on many Play! related topics) so far.
the Scope.Flash class does not allow you to store null values. Perhaps you unset or failed to set request.url elsewhere in your modifications?
Can anyone tell me why following exception comes?
java.rmi.ServerException: RuntimeException; nested exception is:
java.lang.IllegalStateException: Cannot obtain inMethodFlag for: getPrimaryKey
How to avoid it?
According to the AllowedOperationsFlags API it will be thrown when the getPrimaryKey() has been called at a wrong time, e.g. during ejbCreate(). It's hard to suggest a solution without more context about your particular problem and/or a SSCCE.