Running JUnit tests with Embedded Jboss - jboss

I need to run junit tests for classes using ejb3 beans. In our case setting up jboss just for this purpose is not an option and therefore we need an alternative way to simulate the ejb communication. I've read that this should be possible with Embedded Jboss's EJB3StandaloneBootstrapper, but the problem is that I cannot get it to work properly.
I was wondering if anyone of you know of a good tutorial which explains all the details, including how to configure the various files (embedded-jboss-beans.xml, ejb3-interceptor-aop.xml etc). With the embedded jboss package came a tutorial for junit with example code, however, the build script in it failed. If you don't know a tutorial, do you at least know where I could find a working example of embedded jboss + junit?

I did a presentation on using the embedded JBoss and had a download with example code. Hope this helps.

I believe Jakarta Cactus is the proper framework to run such tests.

Related

How to use OpenJpa using persistence.xml without using Enhance.xml ..?

How can I use OpenJpa ,with using Persistence.xml configuration same we use in jpa, I dont want to use Enhance.xml.
If you rely on some non-IDE tool to build your app, you can enhance automatically during buildtime. For Maven, for example, see this
If you are running in a JavaEE container you will get enhancement for free. The other option when running in a JSE environment is to configure the -javaagent.
Take a look at the section titled 'Explicit javaagent support'. As for JavaEE stuff, I'd suggest getting ahold of the Pro JPA 2 book. It is very good at describing usage of JPA in an EE environment.

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

WebLogic and OSGi

Is there a way to run an OSGi container in the Weblogic Application Server? I know that it works with JBoss, Glassfish and there are possibilities to add an Equinox servlet bridge to your OSGi project (implementation of the bridge is too old). But I want something similar to JBoss/Glassfish functionality where it is very easy to deploy your OSGi environment, because there are already OSGi implementations. Most of the articels I found were very old and there are no more recent ones. Can someone help with hints or better some links?
Maybe Bnd could create a .war file for me, but how can I achieve it. I read there is a possibility. Example would be great!
EDIT
Just for those who still look into that case. Since version 12.1.2 Weblogic supports OSGi out-of-the-box.
I'd consider the Apache Felix Http bridge. It worked a lot better for me than the ancient Equinox bridge (I messed around with it for a while, but never got it to work well), after I switched to Felix I got something working pretty quickly.
If I understand you correctly, you want to make a 'plain' war file, that can be deployed in any Java EE server. If that's the case, there is nothing OSGi about your war file, so I don't think Bnd will do anything for you.
WebLogic now supports OSGi in version 12.1.2 . See this

How to use Jersey with Eclipse Helios?

My base need is to use the Jersey framework to develop very basic REST webservices.
I've read several tutorials regarding Jersey (JAX-RS framework) and writing webervices but so for I've not found an easy way to setup a development environment based on Eclipse Helios and Glassfish (Open Source Edition). When creating a Webservice in Eclipse, it seems to use JAX-WS, or when creating a Dynamic Web App, Eclipse reports a credentials error (I use admin/admin) or a wrong user name / password.
The tutorials I've found either use myEclipse, or Tomcat, or Maven. The later works pretty well but I wish I could avoid using the command line because creating the web.xml and other files like that one is really scary, and I'm not sure these files are supposed to be human-written. So I suppose (maybe I'm wrong) using a IDE will make things easier.
What do guys use ? How do you generate these files ? Do you use Eclipse only for writting code or also use the deploy facilities?
Any pointers are appreciated !
Thank you
SCO
You DO need to modify web.xml whenever it's needed. Especially with JAX-RS, you will have to define your servlet in web.xml.
I recommand you to use Maven. There are plenty of exemple in the web to do so. Good luck, JAX-RS is really great ! Maven is also nice.
I also use eclipse for creating and consuming web service based applications. In addition to WTP, I also use Axis plugins to make things easier (through wizards, highlighting as well as for schema verification).
The bottomline is to find the plugins that suit you the best

How to create stand-alone lift web application?

How to make a standalone lift application? Which tools/libraries to use? How does the performance compare to using lift application as a war in some application server?
With onejar maven plugin http://onejar-maven-plugin.googlecode.com/svn/mavensite/usage.html and maven I could package jetty and project with dependencies inside one jar.
The part of the question on performance doesn't really fit with the rest. You are primarily asking how to package the Lift application as a single JAR/WAR. This doesn't have anything to do with the runtime.
At runtime you will still be running inside a Servlet container (could be Jetty, Tomcat or a full-blown Java EE server). How you package your application won't affect the performance.
You could take a look at Hudson (a great Continuous Integration Server) to see how they deliver as a single WAR file that contains an embedded Servlet container. You can download the WAR file and run it from the command line: java -jar hudson.war
I know this is an old question, but...
If you are using sbt, I wrote a plugin to produce 'executable' wars like those mentioned above.
https://github.com/glenford/sbt-jetty-embed