reference for ejb jboss and eclipse development - netbeans

is there a reference or book, maybe a tutorial that can get me started with ejb using the technologies that I have mentioned above?
thank you

You can take a look at the JBoss Tools if you're interested in developing Java EE applications in Eclipse.
If you already know EJB (and if you don't there is quite good Enterprise JavaBeans 3.1 book) you know you can develop your EJB's as plain POJO's just with annotations. No need for fancy plugins here.
You would, however, need a plugin to easily deploy your application to the server. In this case, take a look at these JBoss Tools and this topic.

Related

Move a seam application to OSGI

i' ve some web applications developed using Seam Framework 2.3 + jBoss AS 7 + Hybernate.
Since i' ve been studying OSGI for a while, i was wondering if is possible to move my applications to the osgi world for modularizing everything; i' ve read a lot of blogs and these interesting discussions as well (how-to-modularize-an-enterprise-application-with-osgi-and-ee6 and how-to-modularize-a-jsf-facelets-spring-application-with-osgi) but honestly i still don't really know where i should start from, since i' ve never used OSGI before.
According to you
Is it possible (and useful) do such things?
According to your experience, what would be a good starting point?
Thanks for help
Approach
Possibly start with a toy application as a spike, a WAB (OSGi WAR) and single service bundle.
Definitely take an iterative approach. As far as I know JBoss supports the mixing of OSGi services and Java EE stuff, via JBoss modules/msc, this will allow you to try OSGi and migrate gradually.
I think you'll find some things are incredibly easy and others very hard, so pick easy battles while you're getting familiar. In the end you may stick with a hybrid approach.
Build
What's your build tool? Mostly like Maven or Ant, in which case have a look at maven-bundle-plugin
or bnd respectively. You'll need to ensure the OSGi metadata is present in each of your bundles (Bundle-SymbolicName, Import-Package, Export-Package, etc). If you're using Maven see this answer.
It can be tricky to divide a monolithic app into modules, but as a general rule when you migrate a reasonable sized module you should have separate bundles for API and implementation (which is good design anyway but has implications for the runtime too).
Interop
You can acquire OSGi services, access bundles etc using the low level framework APIs from an injected BundleContext, which will give you a low-level programmatic hook into OSGi. It should be as simple as:
#Resource
BundleContext context;
Unless your Java EE code is packaged as JBoss modules I don't think it will be easy for you to call the other way (e.g. OSGi service looking up Java EE service) without resorting to something like JNDI.
You should be able to install the webconsole and see what Java EE bits are registered in OSGi, and similarly check JNDI to see what's available OSGi for Java EE.
Migrating Services
While OSGi is a lot of fun, using the raw framework API results in quite a bit of boilerplate code and it's unlikely you'll need the power or want the coupling. You can use a number of dependency injection frameworks on top of OSGi; blueprint (Spring-like), Peaberry (Guice) and Declarative Services for example.
I'm biased but Declarative Services has a strong affinity to the OSGi µservice model and the implementations are lightweight.
CDI
I don't know much about Seam/CDI, but Pax CDI might help (though JBoss might already have covered this).
Web
Are you planning to have a highly modular UI with hot deploy of the various components? If not then probably best just to package the UI as a WAB. A WAB is a skinny WAR (i.e. it imports rather than embeds most dependencies). Even if you're after a highly modular, dynamic frontend, I would definitely do this for the first pass.
JPA
A word of warning - JPA implementations typically don't play well in OSGi environments, you may want to look at Apache Aries or Eclipse Gemini. Another option might be to leave the JPA stuff in Java EE space and access Java EE DAOs/Repositories as OSGi services. Again though you may experience some classloading issues.
Possibly useful examples https://docs.jboss.org/author/display/JBOSGI/Provided+Examples

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

What are the most important differences between full AppServer (like JBossAS) and Seam?

If client of the system is on the web there are no advantages JBossAS+Seam over Tomcat+Seam?
Your questions suggests you're confused about what is what.
Seam is a framework for building web applications in Java.
JBoss AS is a Java EE application server.
Tomcat is a Java servlet container.
You can run Seam on either JBoss or Tomcat.
Since JBoss is a full EE app. server, you get certain features like Enterprise Java Beans out of the box with JBoss.
With Tomcat, you don't, but this isn't usually a big concern since, for example, Spring framework can replace Java EE if you need that functionality.
It does matter what you use, since the majority of your system will be probably coded in the back end (server side Java).
If you want the minimum amount of hassle when using Seam, I'd suggest using JBoss since that company made Seam.

Starting a project in Java EE

I am thinking of using Java EE for my college project. Previously, I have used C# for a desktop application. I am new to Java and Java EE.
My question is this. What do I have to consider before starting a project in Java EE? I am thinking about using NetBeans as my IDE. Is this a good idea? I can choose either MS Sql Server or Oracle as my back end.
What do I have to consider before starting a project in Java EE?
This question is very broad and I don't know if this is exactly the expected answer but my suggestion would be to go for Java EE 6 (more precisely, for the Java EE 6 Web Profile which is a subset of the entire specification but should be more than enough in your case) and to use the following APIs:
JSF 2.0 for the presentation layer.
EJB 3.1 Lite for the services layer.
JPA 2.0 for the persistence of your domain objects.
For the runtime environment (the server to run the code), I suggest using GlassFish 3.0.1 Web Profile.
I am thinking about using NetBeans as my IDE. Is this a good idea?
That would be my recommendation. NetBeans is a very decent IDE, is beginner friendly IDE (but still powerful), it provides very good support for Java EE 6, very good integration with GlassFish, and has are plenty of tutorials and documentation available to get started:
Getting Started with Java EE 6 Applications
Java EE & Java Web Learning Trail
I can choose either MS Sql Server or Oracle as my back end.
Java uses an unified low level API called JDBC (JPA being a higher level API built on top of it) to interact with a database so choosing one or the other doesn't really matter from a Java point of view and it won't make any difference for a college project so pick the one you want to work with (if you already used SQL Server for your C# project, you might want to get some experience with Oracle).
Related questions
What to learn for making Java web applications in Java EE 6?

which server I should go for JBoss or GlassFish

I am project I will be using following tech. JSF 2.0, Hibernate, Spring, jBPM, JAX-WS so I am confused between chosing server and I am locked between JBoss and GlassFish please suggest me why I should use the one. I will be using Netbeans 6.8
From a Development Perspective:
If you are using NetBeans then I think the easiest to integrate with will be GlassFish, simply because they come both from Sun and you will get the best out-of-the-box experience. While not mandatory, the Java EE Tutorial from Sun also emphasizes the use of NetBeans with GlassFish.
Nonetheless if you happen to use JBoss, it won't be difficult to integrate it on NetBeans.
From a Deployment and Long-term Maintenance Perspective:
See my answer to a similar question here.