Spring Petclinic (2013 version) doesn't work in JBoss AS 7 - eclipse

I'm trying to run the Spring Petclinic example on JBoss AS 7.1.1. I've imported the maven project from https://github.com/SpringSource/spring-petclinic/ to Eclipse Juno and successfully deployed it, but http://localhost:8080/petclinic/ gives me HTTP Status 404 error.
The only problem I can see from the log is
JBAS011006: Not installing optional component
org.springframework.web.context.request.async.StandardServletAsyncWebRequest
due to exception:
org.jboss.as.server.deployment.DeploymentUnitProcessingException:
JBAS011054: Could not find default constructor for class
org.springframework.web.context.request.async.StandardServletAsyncWebRequest
but according to Spring3.2 and jboss as 7 it's normal behavior.
I've found some advices about modifying the Petclinic sample for JBoss, but all of them are for the old version of the sample, not the updated 2013 version (http://blog.springsource.org/2013/03/21/spring-petclinic-is-on-github/).
The sample works fine with Tomcat 7.0.39.
Update:
The problem only occurs when I run the sample from Eclipse using JBoss. As Andrzej said, building the app with standalone maven and deploying the resulting war works fine.
The problem is JBoss/JBoss Tools use incorrect war name and context root when deploying from Eclipse.
In pom.xml the war name is specified as <warName>petclinic</warName>, but JBoss uses "spring-petclinic" instead. Tomcat, Glassfish, and Weblogic don't have this problem and work correctly with deployment from Eclipse.
The workaround is either to use http://localhost:8080/spring-petclinic/ instead of http://localhost:8080/petclinic/ or configure the context root via WEB-INF/jboss-web.xml:
<jboss-web>
<context-root>petclinic</context-root>
</jboss-web>

The Spring Petclinic (2013 version) works well with Jboss AS7. Tried it with two Jboss versions. What you need is to build app with maven and deploy it to standalone/deployments folder.
Problem is running it from Eclipse Juno.

Related

How can I load Java EE application dependency from WildFly modules

I am migrating my JBoss from 4.0.5 to WildFly 9.0.2 release, and my application has some dependency from JRE/lib/rt.jar, but when I deploy that application on WildFly, application gives error like ClassNotFoundException. If I add rt.jar as dependency in lib directory then application works.
So does anyone knows how to overcome from this problem.
Eg.
javax.xml.parsers.SAXParser.class which is available in rt.jar.

Eclipse IDE: java.lang.IllegalArgumentException: Not an managed type

I'm trying to deploy an EAR application on a Weblogic 10.3.3 server. When using the Weblogic admin-console on http://localhost:7001/console/, it works fine. When using Intellij IDEA, it works fine.
However, when deploying from Eclipse Mars, I have the following error, caused by Spring JPA:
Caused By: java.lang.IllegalArgumentException: Not an managed type: class package.xxx.MyClass
at org.hibernate.ejb.metamodel.MetamodelImpl.managedType(MetamodelImpl.java:171)
at org.springframework.data.jpa.repository.support.JpaMetamodelEntityInformation.<init>(JpaMetamodelEntityInformation.java:68)
at org.springframework.data.jpa.repository.support.JpaEntityInformationSupport.getMetadata(JpaEntityInformationSupport.java:65)
at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getEntityInformation(JpaRepositoryFactory.java:149)
at investmentcafe.ngs.dao.BaseRepositoryFactoryBean$NGSRepositoryFactory.getTargetRepository(BaseRepositoryFactoryBean.java:34)
I'm using Spring 3.2.14.RELEASE, with Spring-data-jpa 1.6.6.RELEASE. The problem occurs on Eclipse Mars.1 (4.5.1 build 20150924-1200), with the Oracle WebLogic Server Tools version 8.4.0.201510191754. I'm deploying "as a virtual application" from the Weblogic tools.
I'm quite puzzled by this strange behavior. Any ideas on how to explain such Eclipse-specific behavior and/or on how to troubleshoot/fix it?
It seems that moving the hibernate .xml file in the META-INF folder fixed the problem. (So the persistence.xml can be renamed, but cannot be moved #GiveEclipseSomeLove)

Eclipse Luna with JBoss Tools does not export libraries

I'm attempting to upgrade our environment to Eclipse Luna w/ JBoss Tools from our current Indigo instance. Most things are sorted well enough, but I'm running into a wall when deploying our application to a JBoss server within Eclipse.
As far as I can see, the lib/ directory of the .ear file generated contains none of the transitive dependencies from maven that we would normally expect to see, and as a result the application does not deploy or run correctly on the server. For clarity, we use the 'use workspace metadata' deployment option on the JBoss server within Eclipse.
By contrast, if I right click on the relevant project within Eclipse and say Export... .ear file, the resulting .ear contains all the .jars that I'd expect inside the lib/ folder (there's over 50 of these things, so it's pretty easy to spot the difference). Subsequently dropping the .ear into the deploy directory of JBoss and starting a server manually has the application working fine.
Has anyone ever encountered this sort of issue within JBoss Tools / Luna, and if so what steps were taken to try and remediate it?
Cheers for any help.
Dave.
EDIT: For what it's worth, this is a JBoss Enterprise Application Platform 5.x server instance, and we're using JBoss EAP 5.2

"SEVERE: There is no installed container capable of handling this application" error while trying to deploy EJB jar in glassfish

I am using netbeans 7.2.1 and glassfish 3.1.2 server. I created an ejb project and while trying to deploy the ejb jar in the server, i see the below error in the server log:
SEVERE: Module type not recognized for module C:\Users\AppData\Roaming\NetBeans\7.2.1\config\GF3\domain1\applications\SAPLockBox
SEVERE: There is no installed container capable of handling this application SAPLockBox
The error also points out to
<target if="netbeans.home" name="-run-deploy-nb">
<nbdeploy debugmode="false" forceRedeploy="${forceRedeploy}"/>
</target>
in build-impl.xml. I have read many online posts and tried a few but no success so far.
Have you tried to run your ejb jar file not in your netbeans context, but outside of it?
What Java EE APIs do you use? You may have one, that it is not accessible to the glassfish server, but in netbeans compiles OK.

Java EE6 App + EJB in Glassfish 3.0/Netbeans 6.8?

Has anyone got this configuration working?
Latest Netbeans, latest Glassfish, I created an EJB project, also an EE Application.
The EJB in itself builds & deploys to Glassfish OK.
Now when I want to reference the EJB, I have to add the EJB jar to the EE Application path, if I don't do this the code does not compile.
But, the EJB jar gets packaged in the App jar and as a result when I try to deploy the app to Glassfish it says:
"java.lang.IllegalArgumentException:
Sniffers with type [ejb] and type
[appclient] should not claim the
archive at the same time. Please check
the packaging of your archive"
How do I tell Netbeans NOT TO package the EJB in the App jar? Or is the problem somewhere else?
btw. if I remove the EJB manually from the JAR then the app deploys successfully (with asadmin deploy), but when I try to run it with appclient, I get a NullPointerException.
Surely there must be a solution to this, I thought Netbeans was for web application development after all...
Edit: I found this:
http://forums.netbeans.org/topic23499.html
Which lists exactly the same steps that I did to resolve the problem.
Here is a solution candidate:
https://netbeans.org/bugzilla/show_bug.cgi?id=183488
Which basically says that Glassfish v3 is seriously broken, and it won't work.
Here is how I got it to work: the EJB and the EE Application MUST BE packaged in an EAR (project), and they MUST BE deployed within the EAR. Deploying the application jar individually WILL NOT WORK (at least not with Netbeans 6.8 + Glassfish v3).