Example of EJB 3x project on Intellij Idea? - jboss

I am a Java user with recent migration to IntelliJ Idea and I am new to EJB, I wonder if there is any example of EJB 3.x example with IntelliJ Idea and JBoss 6? I did not found much material myself.
Thanks very much

There are a variety of EJB examples here:
http://openejb.apache.org/examples-trunk/
All of them have unit tests and can be run in Intellij (my preferred IDE by far) by either:
importing the Maven pom.xml as a new module or project
using Maven mvn idea:idea to generate the Intellij project
Here's one example with an accompanying video that shows it run in Intellij.
http://openejb.apache.org/examples-trunk/simple-stateless
http://www.youtube.com/watch?v=aLx2jta96xU
No audio in the video, point is to show it working. Seeing is believing as they say :)
It's not JBoss, but will teach you EJB and the knowledge is transferable.

Related

Apache Wicket Quick Start

I was trying to start learning about Apache Wicket (as it looked like an easy to use UI for Java) and as I like to work with Eclipse and Maven. I also like to work with Tomcat, however, Wicket seems to prefer Jetty at least in its tutorials. I do not know nothing about Jetty, however should not take ages to learn.
I tried the Wicket Quick Start and successfully imported the generated Maven project to Eclipse workspace.
But errors appear: e.g.
import org.eclipse.jetty.server.HttpConfiguration;
It seems Eclipse cannot find the jetty server classes. How to add these to the Eclipse project?
Does the creater of the Wicket Quick Start assumed that Jetty is already installed on the machine?
I installed it. However: what is the recommended way to make what jar file available to a maven project to have jetty server classes available? I would assume via the pom.xml but I doubt that is the case here - the given pom.xml would contain it.
Or is there some special plugin for Eclipse (Photon)?Run-Jetty-Run?. I wasn't brave enough to try that.
I would love to get the Wicket Quick Start running.
I also tried Eclipse + Tomcat + Apache Wicket Maven Setup with Hello World Example but it seems that it is outdated. I was not able to install qwickie to Eclipse as described.
I am using Eclipse Proton with Java 10.0.2 on Debian Stretch.
If you are using https://wicket.apache.org/start/quickstart.html then you can start the application these ways:
mvn jetty:run - this will use jetty-maven-plugin
Open in Eclipse src/test/java/com/example/Start.java and run it as a normal Java class with a main(String[]) method. This will use Jetty Maven dependencies to start an embedded Jetty server.
Wicket's Quickstart prefers Jetty because Jetty developers made it easy to use it in non production way, i.e. in development mode, for faster dev cycles. No need to build a .war file and deploy it.
On the other side Tomcat devs (disclaimer: I am a member of both Wicket and Tomcat teams) never spent time in this direction. Tomcat's Maven plugin has been abandoned long time ago. The best integration for starting embedded Tomcat is provided by Spring Boot project (I recommend it if you use Spring!).
So, just remove the Jetty related dependencies and plugin in pom.xml and the Start.java in src/test/java/.... Then you can continue developing with Eclipse and Tomcat the way you like to do it.

Best startup JSF 2.2 archetype

What is the best maven archetype to start a JSF 2.2 project in Eclipse EE with?
I am currently learning JSF and am looking for a clean maven archetype to start my JSF project with. I tried a few archetypes with jsf in the title, but they don't seem to create a "clean" (no problems found) in eclipse. I am looking for an answer from experience.
I think there is no best one as every archetype comes with stuff one does not want. Since every one is different some modifications will always be required.
I would give the appfuse archetypes a try: http://appfuse.org/display/APF/AppFuse+QuickStart
mvn archetype:generate -B -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-light-jsf-archetype -DarchetypeVersion=2.2.1 -DgroupId=com.mycompany -DartifactId=myproject -DarchetypeRepository=http://oss.sonatype.org/content/repositories/appfuse
I think they use MyFaces 2.1.9 but that should be easy to change :)
You could try this one: https://github.com/ignl/happyfacescrud
It contains quite a few features out of box.

Configure and Run Maven 2 Core WAR Project in Eclipse Indigo and Tomcat 7

I know this is not a new question to you guys, who use Maven. But I'm really new to this. I have searched Stackoverflow and Google for hours, but didn't find a step-by-step working guide (with screenshots).
I am using Eclipse Indigo, Tomcat 7 and now want to create a webapp with Maven. I have few basic needs to create this project. The m2e plugin's archetype seems most confusing to me. Although, it looks like a plug-and-play one, but I couldn't setup a struts2 project from archetype and build successfully.
The project should have strus2, spring and hibernate dependencies configured.
There should be a war and atleast one core module in the project.
I should be able to build and run it from Eclipse on Tomcat 7 server.
Please help guys. I think, there must be some ready-to-learn resource on the web. Please share it.
did you have a look at the AppFuse modular archetype: appfuse-modular-struts
http://docs.codehaus.org/display/MAVENUSER/Archetypes+List
http://appfuse.org/display/APF/Using+Struts+2
to have the list of available archetypes you can type: mvn archetype:generate

Eclipse configuration to support dual Equinox/Felix environments

What are some configuration changes to make Eclipse PDE best support working with both Equinox and Felix?
Here's an example problem I'm currently having. I can run my application ok via the Eclipse OSGi Framework launcher. Similarly, there are no compilation problems in PDE. However, when running in Felix I will get NoClassDefFoundErrors:
java.lang.NoClassDefFoundError: org/w3c/dom/DOMException
My understanding is it's my Eclipse setup that is at fault here; org.w3c.dom is not a 'default' OSGi package and shouldn't be loaded when I run it in Eclipse. Similarly, the import in my code for org.w3c.dom.DOMException should be an error.
I know how to fix this for Felix: declare an Import-Package. But that's not my question. My question is how to force Eclipse PDE to take on a closer configuration to Felix... basically to make it stricter in loading packages?
I think Equinox does behave like Felix, if you run it stand alone. It's more of an Eclipse legacy thing than an Equinox thing, as stated on osgi.org.
As far as I know, there isn't any way to override the boot delegation from Eclipse, but I'd love to be proven wrong, as I've faced this problem often.
If you are developing a server application I recommend to not use the PDE at all. I am using maven and the maven bundle plugin to develop my bundles. Then I deploy on Apache karaf. Debugging also is quite simple by using the karaf dev:watch command and remote debugging. I never really missed the PDE features and they never worked well with my maven build.
This sounds like that launcher is setting bootdelegation to legacy mode. See the following page on the OSGi Wiki: http://wiki.osgi.org/wiki/Why_does_Eclipse_find_javax.swing_but_not_Felix%3F

JBoss Seam Project errors

I have a JBoss Seam project that a coworker created about a year ago. I'm taking over it now and it needs some work done. So I'm trying to setup the project in Eclipse Indigo. Here is the list of things I have installed so far:
JBoss 4.2.2 GA
JBoss Seam 2.2.0 GA
Glassfish v2.1
JBoss Seam Tools Plugin for Eclipse Indigo
For some reason I am not able to build the project to get an ear for JBoss. The errors I have are one in glassfish-builld.xml which says "Target clean does not exist in this project." And then I have errors in a bunch of generic.jsp file (I have no idea what their purpose is). The error for those is that a library for JBoss Seam called org.jboss.seam.wiki.util.WikiUtil cannot be found.
Can someone point me in the right direction to get this setup and running on JBoss?
Also org.jboss.seam.wiki.util.WikiUtil is a class that is a part of... Seam example project that is added to JBoss Seam distribution in examples/wiki directory. So if you really need it you will be able to find it there. But honestly I don't see any reason to put any dependency to Seam examples in project. Consider just deleting / commening out the code that refers to this class becasue it is probably some quick and dirty test code.
Do you want to run it on Glassfish or Jboss?
Did you import an entire eclipse project or create a new one?
I would first check the referenced libraries to see if there's anything missing(Libraries under Java Build Path for Helios, not sure if that differs from Indigo). Add a -verbose tag to the build and check out the output.