Arquillian + Glassfish embedded - ejb

I'm trying to write integration tests to my jee application with arquillian and embedded ejb server (glassfish 3.1.2.2). My application uses jsr 303 bean validation. When I try to execute test I receive:
Caused by: org.glassfish.embeddable.GlassFishException: PlainTextActionReporterFAILUREorg.jvnet.hk2.config.TransactionFailure: HV000100: Unable to parse META-INF/validation.xml.Could not change the attributes: HV000100: Unable to parse META-INF/validation.xml.
at com.sun.enterprise.glassfish.bootstrap.ConfiguratorImpl.configure(ConfiguratorImpl.java:71)
at com.sun.enterprise.glassfish.bootstrap.GlassFishImpl.configure(GlassFishImpl.java:71)
at com.sun.enterprise.glassfish.bootstrap.GlassFishImpl.(GlassFishImpl.java:65)
I found same problem on https://java.net/jira/browse/GLASSFISH-17381. Is there anybody who faced and resolved this issue?
Thanks

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.

javax.servlet.ServletException: SRVE0207E [duplicate]

This question already has answers here:
javax.servlet.UnavailableException after an upgrade to WAS 7
(3 answers)
Closed 6 months ago.
While publishing EAR file on WAS7.0 server , I'm getting below exception.
I have placed all the required jars at WEB-INF/lib, rebuild app many times but unable to resolve it...
com.ibm.wsspi.webcontainer.extension.WebExtensionProcessor createServletWrapper
Servlet action is currently unavailable: SRVE0203E: Servlet [action]: Action Servlet
was found, but is missing another required class.
SRVE0206E: This error typically implies that the servlet was originally compiled
with classes which cannot be located by the server.
SRVE0187E: Check your class path to ensure that all classes required by the servlet
are present.SRVE0210I: This problem can be debugged by recompiling the servlet using
only the classes in the application's runtime class path
com.ibm.wsspi.webcontainer.extension.WebExtensionProcessor createServletWrapper Error
occured while preparing the servlet for initialization.
javax.servlet.ServletException: SRVE0207E: Uncaught initialization exception created
by servlet
What should I do to resolve this? Getting 404 when I hit application on server.
My web.xml file is validated and has no errors.
Please tell me probable solution to resolve this exception.
This is because of compatibility issue.
I was getting this error when I included jersey jars. Some of the jars need minimum jdk 1.7
I reduced the version of my jars in pom.xml.
It is working fine for me.

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.

CDI on GlassFish 3.1.1 b12 generates error "WELD-001408 Unsatisfied dependencies"

I'm trying to evaluate CDI on Glassfish 3.1 and even though I have accomplished to make it work well, when I'm trying to split my code in separate deployment modules I get a weird error. More specifically:
I have two classes bundled in the same utility project (let's say the CommonLib.jar); the classnames are UserDatabase and UserDatabaseEntityManager and their definitions are as below (in the PS at the end of this message).
I also have an EAR with an EJB3.1 module in it.
When I choose to deploy the CommonLib.jar as a "Bundled Library" of the EAR, then I get the following error:
Error occurred during deployment: Exception while loading the app : WELD-001408 Unsatisfied dependencies for type [EntityManager] with qualifiers [#UserDatabase] at injection point [[field] #UserDatabase #Inject com.test.TestEJB.itemPersistenceEm]. Please see server.log for more details.
Same error as above I get also when I deploy the CommonLib.jar as a shared library (jar file copied under $glasshfish_installation_path/domains/domain1/lib)
BUT, if I choose to just have the two classes (UserDatabase and UserDatabaseEntityManager) in the EJB project (thus they are compiled within the EJB module), then the injection works fine.
Am I facing a classloader issue? Any ideas how I can get past this issue?
Just a guess, because I faced a very similar problem with Glassfish and CDI a few days ago: Do you have a beans.xml in every JAR, i.e. in the CommonLib.jar and the EJB JAR, so that CDI scans both of them?
My problem resulted from the fact that I thought placing a beans.xml into the EAR would be sufficient, which is not the case.
Sounds like you're running into some of the Glassfish CDI integration issues we've found while working on Seam 3. It could be a couple of them, so you'll have to take a look at see which one it may be. Try testing on JBoss AS7 or Apache TomEE and see if you still have problems.

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

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.

Resources