I want to write an Java EE 6 app, on JBoss 7.1, with JPA (Hibernate as JPA provider) and SqlServer.
The build tool is, for better or worse, Maven 3.
What does Maven arrange/set up for me in terms of connecting Jboss 7 to a database and JPA?
Do I need to set up a JDBC driver, as well as a datasource, or does Maven automagically set these up for me via transitive dependencies and its build cycle? In other words, do I need go into standalone.xml as well as into the module folder and modify a module.xml file, etc?
I can't find a tutorial that has all of the steps or a sample pom.xml.
No Maven will not automagically set up dependencies on JDBC providers. You must declare them explicitly in your own project pom.
As far as a tutorial, the canonical references and tutorials are on the Sonatype web site.
See: Maven by Example
and specifically regarding project dependencies in Maven: the Complete Reference:
http://books.sonatype.com/mvnref-book/reference/pom-relationships-sect-project-dependencies.html
Related
We have a multi-module (war-packaged) project that uses com.google.appengine - appengine-maven-plugin target being ear file.
We have migrated succesfully to Java8 and EndpointsV2. It builds and runs fine in Cloud. However the following requirement is still a bit questionmark in the migration instructions. What is the reason behind this incompatibility and requirement? Or is it just related to for example "discovery docs" that we are not using anyway?
The old App Engine Maven plugin, with group com.google.appengine, is incompatible with the Endpoints Framework plugin. You must use the new version shown above
https://cloud.google.com/endpoints/docs/frameworks/java/migrating
If you aren't using discovery docs or generated client libraries and are only using Endpoints as a library dependency, you can remove the Endpoints plugin and the error should go away.
Has anyone been able to use camel-blueprint together with logback? It seems that there are dependencies in camel blueprint which forces you to use log4j even though the log4j dependencies are removed from the pom. After running the project it starts to download the slf4j-log4j12 and then then complains of multiple bindings because it finds both log4j and logback.
I did the same with a camel java project and it worked fine to switch to logback. Does camel-blueprint force you to use log4j as its logging implementation?
Answer found via nabble forum in through discussion with the camel community. For more details go here:
http://camel.465427.n5.nabble.com/camel-blueprint-force-usage-of-log4j-td5772826.html#a5772852
Essentially there are certain dependencies in the maven plugin which uses log4j. For production in JBoss Fuse or Karaf, its Pax logging.
I am migrating an EAR application containing MBeans from JBoss 6 AS to Wildfly 8.2.0 AS. In my EAR application, MBeans depend on EJB before initialization.
In JBoss 6 AS, #DependsOn annotation used in MBean maintained the sequence of the deployment i.e. Dependent EJB gets deployed and then, MBean gets deployed.
In Wildfly 8.2.0, I am trying to implement the same and #DependsOn is not working.
I tried the below in jboss-service.xml to have MBeans deployed only after the deployment of EAR file but this did not happen.
<mbean code="sample.HelloWorldService" name="sample:service=HelloWorld,id=1">
<depends>jboss.j2ee:service=EARDeployment,url='application.ear'</depends>
</mbean>
I also tried #startup in EJB but I cannot control the sequence i.e. 1. EJB deployment 2. MBeans deployment.
Can anyone please help about how to control the order of deployment in Wildfly 8.2.0. I need to deploy EJB first and then MBeans. Many thanks.
Just a comment
About the EJB that you want to get from the MBeans, maybe you are misunderstanding the specificaction of jboss-deployment-structure.xml. It express an initialization dependency between singleton components (even if the related EJB are singleton be aware about possible problems with DependsOn like WLFY-4251).
Workaround
Due to you are working with Jboss/Wildfly Server, you have the option to use the jboss-deployment-structure.xml for specify dependency between modules.
Perhaps, as your are packing all in the same EAR application, you can separate the components into modules, let's say one MBean.sar module that contains the MBeans and other RelatedEJBs.jar module with the EJBs referenced by your MBeans.
Then you define the next dependency of MBeans.sar over RelatedEJBs.jar,
<jboss-deployment-structure>
...
<sub-deployment name="RelatedEJBs.jar">
...
</sub-deployment>
<sub-deployment name="MBeans.sar">
<dependencies>
<!-- Adds a dependency on the ejb jar. This could also be done with a Class-Path entry -->
<module name="deployment.YouApp.ear.RelatedEJBs.jar" />
</dependencies>
</sub-deployment>
</jboss-deployment-structure>
Edit: A useful migration guide to Wildfly.
I'm trying to use Google Cloud Endpoints with Android client, built by Maven.
The problem is that appengine-maven-plugin v1.8.3+ require Maven v3.1.0+
[ERROR] Failed to execute goal com.google.appengine:appengine-maven- plugin:1.8.4:endpoints_get_discovery_doc (default) on project pro-gae: The plugin com.google.appengine:appengine-maven-plugin:1.8.4 requires Maven version 3.1.0 -> [Help 1]
while android-maven-plugin v3.6.1 doesn't (and will not) work with Maven v3.1.0 (see devs discussion at https://code.google.com/p/maven-android-plugin/issues/detail?id=395). The error
A required class was missing while executing com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.6.1:generate-sources: Lorg/sonatype/aether/RepositorySystem;
So I'm kinda locked out. One plugin asks for v3.1.0+, while the other one claims Maven 3.1.0 to be fatally buggy. So I left out to generate Endpoints client sources manually.
Any other ideas, besides waiting for fixed Maven 3.1.1? It doesn't seem to happen soon, because Maven 3.1.0 was released more than two months ago.
The latest version of the Android Maven Plugin is 3.8.0 and it now requires Maven 3.1.1+. This should allow you to use the latest appengine plugin as well. And Maven 3.1.1 has been released in the meantime as well.
Update Sept 2015: Latest version of the plugin is 4.3.0 with 4.3.1 around the corner. The 4x branch works with Maven 3.0.5+ but we strongly encourage users to use the latest Maven release.
Hmm, looks resolved by just using older version (1.8.2) of appengine-maven-plugin.
One other way of building is to configure the Run Configuration to use an external Maven Runtime.
To do this in Eclipse for Windows :
Right Click Project -> Run Configuration -> Create a new configuration -> In Main tab configure Maven Runtime.
I hope this helps.
I'm using maven-gae-plugin to manage a Google AppEngine project but I don't know how to include the libraries required to use JPA.
Google's documentation says:
The classpath must contain the JARs 'datanucleus-core-*.jar', 'datanucleus-jpa-*', 'datanucleus-enhancer-*.jar', 'asm-*.jar', and 'geronimo-jpa-*.jar' (where * is the appropriate version number of each JAR) from the 'appengine-java-sdk/lib/tools/' directory, as well as all of your data classes.
How can I tell the plugin to put all the jars in the classpath?
So far I just edited the pom.xml file setting gae.version to 1.7.3 (Leaving datanucleus.version to 1.1.5 and I run mvn gae:unpack but I cannot get it to work.
First, I have problems with javax.persistance that is not found. Do I have to add it manually to pom.xml?
If I do it, the development server starts, but I cannot work with the storage: I get the following error:
SEVERE: Found Meta-Data for class com.sharecost.entities.User but this class is not enhanced!! Please enhance the class before running DataNucleus.
I found a solution to the second part of my question. Looking at the POM.xml file I discovered that the all entities are supposed to be in a **/model package.
I still don't know if the manual inclusion of the javax.persistence dependency is actually required.