How to solve "NullPointerException" with "Server.processing" error while we are using Flex Builder 3 and BlazeDS? - apache-flex

I am using Flex builder 3, BlazeDS, and Java with Spring and Hibernate framework. I using the remote object to load a string from spring's configuration files. But in testing, I found this fault event like this:
RPC Fault
faultString="java.lang.NullPointerException"
faultCode="Server.Processing"
faultDetail="null"
I have checked the configuration in remote-config.xml and services-config.xml. But it looks good. Some people have talked about this problem around the Internet and I think you can help me and them.
I am using these environment:
Flex Builder 3
BlazeDS 3.2.0
JBoss server
Full stacktrace:
[RPC Fault faultString="java.lang.NullPointerException" faultCode="Server.Processing" faultDetail="null"]
at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::faultHandler()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:220]
at mx.rpc::Responder/fault()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\Responder.as:53]
at mx.rpc::AsyncRequest/fault()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\AsyncRequest.as:103]
at NetConnectionMessageResponder/statusHandler()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\messaging\channels\NetConnectionChannel.as:569]
at mx.messaging::MessageResponder/status()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\messaging\MessageResponder.as:222]

The java.lang.NullPointerException indicates an error being thrown on the server. To debug this, active debug logging on BlazeDS in the services-config.xml file. You should see detailed debug information in the server console.

When using the BlazeDS/Spring integration take care that you will need to use a custom exception translator in order to obtain meaningful exceptions. Please read this document http://static.springsource.org/spring-flex/docs/1.0.x/reference/html/ch02s08.html
In your case the error is not related to some configuration problems, it seems that is thrown inside your java method. Use a debugger in order to diagnose properly.

Related

Spring Boot Jetty not supported on GAE, but causes my tests to fail when removed?

I am building out an API using Spring Boot, which is being deployed to Google App Engine with Travis CI.
I started my code from Google's Starter Project (https://github.com/GoogleCloudPlatform/getting-started-java/tree/master/appengine-standard-java8/springboot-appengine-standard), which doesn't use the spring-boot-starter-jetty dependency. As such, my project also did not not require it, and everything was deploying fine.
That was until I decided to add a test that uses Spring's TestRestTemplate.getForEntity() method to hit a basic endpoint I could assert on, just to give me some peace of mind that the endpoint could be reached end-to-end. However, I got the following error when running the test locally:
java.lang.IllegalStateException: Failed to load ApplicationContext
[stacktrace]
Caused by: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.
[stacktrace]
Caused by: org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.
Looking around, it became apparent that I should add the spring-boot-starter-jetty, and the test started passing! Everything looked fine.
However, after committing and deploying to GAE, I now get a 500 Error when trying to hit the endpoint.
I did some digging in Stackdriver, and this is the error that's thrown:
java.lang.RuntimeException: javax.servlet.ServletException: Not running on Jetty, JSR-356 support unavailable
I presume that JSR-356 support is required by spring-boot-starter-jetty, which I presume GAE doesn't support, hence the error. I have reported this upstream here: https://issuetracker.google.com/issues/79235250
Is there a way I can add the dependency without JSR-356 support, or is there another way I can get some form of HTTP End-To-End test to pass?
You can view my source code here: https://github.com/bytelucas/nohold - the test in question is HTTPRequestTest.java.
Looks like Spring boot defaults the starter jetty to 9.1, can you try overriding the default to earlier versions of jetty by adding it (in POM) which uses JSR-353 to see if that fixes the issue instead.

UnityContainerBase.RegisterInstance<Interface> throwing ThreadSynchronizationLock Exception

I am working on a Silverlight application which gets data from WCF service. Once I receive the data from the service I am trying to register an instance of an object to the Unity container and I see that it throws ThreadSynchronizationLock exception.
Can anybody help me avoid this exception?
Known issue. The RegisterInstance method (actually the ContainerControlledLifetimeManager) will try to release a lock it doesn't have when doing RegisterInstance. This is actually a first-chance exception, is properly handled in the codebase, and only shows up in the debugger.
Basically, you don't need to avoid it, it's already handled properly inside the code.
Also, my understanding is that this behavior was changed in Unity 3.0 to avoid exactly these kinds of questions. :-)

encryption of the war using Spring

I hava met some problems .
I want to encrypt the war using Spring by a tool named ClassGuard ,but when I deploy it to Tomcat and started to launch it , some problems(seemed to be A fatal error has been detected by the Java Runtime Environment) arised .
have anyone used ClassGuard and met problems like this?
please help me...thanks in advance!
Although without the exception we can only speculate, the ClassGuard FAQ section clearly states that:
As of Version 1.5, ClassGuard supports Tomcat containers.
To use ClassGuard in combination with tomcat, you have to configure your web application for using the ClassGuard tomcat class
loader. This can be set in the context of the web application.
So make sure that:
You are using the latest stable version.
You are using the appropriate class loader.
A probably (although not sure if it is what you are after) easier way to discourage usage of your code would be through Obfuscation Tools such as these.

What is the best way to debug production error templates?

I am trying to create pretty error pages for my application by following this cookbook article. Sometimes a bug slips in, which causes the application to return a single line: 503 Service Unavailable. It would make my life a whole lot easier if only I could see the underlying error or exception thrown. Switching over to the development environment doesn't help either as the error templates are only used in production.
I figured out that I needed to add TwigBundle to assetic's configuration to use javascript and css assets. Problems like this are really hard to debug in the production environment.
Setting the debug mode to true in my front controller doesn't help, since production error templates get replaced by development templates.
EDIT
Thanks to Mike Purcell I managed to retrieve the errors provided. I got
Uncaught exception 'Symfony\Component\Routing\Exception\ResourceNotFoundException' in /[snip]/app/cache/prod/appprodUrlMatcher.php:669
Turns out the framework should be handling the exception, but in the case of a possible error inside the error Twig template, it just decides to throw a 503 error.
How do I turn on error reporting for the production environment in a Symfony2 application?
I'm tired of guessing what's wrong and clearing the cache. What is the best way to debug Twig's error templates in production?
The best way to see what errors are being thrown in production is to configure Monolog to email the errors too you or alternatively to a file.
Have a look at the Symfony2 Cookbook on emailing logs http://symfony.com/doc/master/cookbook/logging/monolog_email.html
To make the error pages look nicer have a look at this cookbook entry on how to do that http://symfony.com/doc/master/cookbook/controller/error_pages.html
There are open source tools specifically built for error reporting like Sentry, which has a native Symfony client.
disclaimer: I work for Sentry

404 Error using Flash Builder 4 BlazeDS wizard

My issue this time around is trying to use the new DCD BlazeDS wizard in Flash Builder 4. If I set my project up as a combined Java/Flex app I am unable to connect to the RDS servlet using the wizard. I get a 404 error every time.
I'm certain the service is set up correctly since my app can access the exposed java classes and BlazeMonster can see the exposed services.
Is anyone else having this issue and if so has anyone found a work-around? I'd very much like to use the code generation features of the wizard for my project.
Thanks as always,
Codeflayer
You also need to make sure you have the RDSDispatchServlet setup in the web.xml config file.

Resources