How to use CDI on TomEE - eclipse

I'm currently writing JSF code and using Mojarra 2.1.6-FCS, using Tomcat and Eclipse Juno. Now I want to move to CDI, for I discovered it's more practical than JSF.
I need to know stuff like whether I need web.xml and faces-config.xml in order to write and run CDI code; in JSF it's not required.
I just need easy step-by-step instructions for deploying to TomEE. Any flash put into my asking would be way appreciated, thanks a punch.

You don't need web.xml or faces.config.xml just to use CDI. The only thing you need is beans.xml (which can be an empty file!), placed inside the WEB-INF directory.
I can't give you step-by-step instructions for deploying a CDI application on TomEE, but it should be no different to deploying any other application. Have you read the TomEE and Eclipse tutorial?

here a sample http://tomee.apache.org/examples-trunk/jsf-cdi-and-ejb/
hope it will help you

Related

Glassfish Hot Deploy with File Synchronization

I was looking for someway to perform hot deployment on glassfish. I was find this guide:
http://entjavastuff.blogspot.se/2010/11/hot-deploying-from-eclipse.html
which is exactly what I am looking for. Unfortunately, this is for JBoss. I do not know how to handle it for Glassfish.
Can you please help me transform the part "Configure destinations" to Glassfish directories instead?
Best regards
It would be exactly the same, except, rather than pointing the synchronization of files to the JBoss deploy directory, you would point them to the glassfish/domains/domain1/autodeploy directory.
Forget that.
"File open failure" compiling java class to glassfish autodeploy
If somebody find a Java EE 6 container you can do autodeploy, please share it. I have pass the last month trying do do an autodeploy on JBoss, WebLogic and Glassfish. It never worked.
Lesson learned: Do not use Java EE. Use Spring on a simple tomcat.

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

Jboss4 inside OSGI

Is it possible to run Jboss 4.2.3 as a bundle inside OSGI container? What would be the challenges associated with it?
For those who cares, I am looking at running dcm4chee inside OSGI.
While not impossible it would be incredibly hard, a simpler alternative would be to embed OSGi inside JBoss, see:
http://felix.apache.org/site/apache-felix-framework-launching-and-embedding.html
and
Programmatically Start OSGi (Equinox)?
and
http://njbartlett.name/2011/03/07/embedding-osgi.html
http://www.dcm4che.org/jira/browse/DCM-308 Looks like they're adding support to make the Jars valid bundles - couldn't you just work out the dependencies and deploy these to an OSGi framework? OSGi has support for JMX and JNDI.
Unless there are huge dependencies on JBoss' internals, I'd suggest the second option, but beware of Class.forName usage and other non-osgi-friendly code.
I logged the bug specifically for the dcm4che (note 1 e) toolkits, not the dcm4chee war. I would suggest logging a new issue for the dcm4chee assembly. However, making the dcm4che toolkit components osgi bundles would likely be a required step in the direction of getting dcm4chee to run in an osgi container.

Seam EJB3 in an EAR is it usable by another App?

Seam 2.1 and JBoss 4.2.2
I have set up the first App to have the EJB in the EAR with a local interface.
the 2nd app can look up JDNI name "ear-name/ejbname/local" but fails with "NoClassDefFound".
Does the EJB .jar need to be outside of the EAR?
Is this a classloader visibility issue or Is this a JBoss version issue? or something else?
Thank you for your thoughts..
I cannot answer if it will work or not. However, I can tell you how we do this.
We have created a #Webservice component that uses this EJB. And then we connect to the Webservice from our other application.
I blogged about this a while back. You can have a read if you are interested.