Migration from oc4j to tomEE - oc4j

We are planning to migrate our Java WebApplications from OC4J to TomEE.
I need to provide an LOE for this migration
What are the key points regarding the migration?
Is there any documentation or books that I can refer to ??

First, congratulations. The lightweight nature of TomEE offers some incredible advantages. Being open source, you're also able to fix bugs on your own, without relying on your vendors slow development cycle. Plus, because it's basically Tomcat, you're tapping into a massive knowledge base and world of experience around the product.
The best advice for a migration like this is to make sure your apps use vanilla Java EE and nothing else. If your code compiles against javaee-api-6.0.jar without any OC4J libraries, chances are you're 90% the way there.
The rest of the problems usually deal with minor points on configuration and injection.
If you do strange things with EJB mappings:
#EJB(name = "NoteTakerServiceBean")
private NoteTakerService umaNoteTakerService;
#EJB(name = "GLINoteTakerServiceBean")
private NoteTakerService gliNoteTakerService;
These "named" injections are not portable.
Configuration properties on MDBs:
#MessageDriven(activationConfig = {
#ActivationConfigProperty(propertyName = "destination",
propertyValue = "com.mycompany.databunker.salesforce.model.SalesForceAgent"),
#ActivationConfigProperty(propertyName = "maxSessions", propertyValue = "1") },
mappedName = "com.mycompany.databunker.salesforce.model.SalesForceAgent")
#TransactionAttribute(TransactionAttributeType.REQUIRED)
public class SalesForceAgentMessageListener implements MessageListener {
....
}
The activationConfig properties are container specific.
To assist you with the migration, TomEE has the best documentation out there. See these two pages to see how to see where I got the configuration details for the above beans.
http://tomee.apache.org/examples-trunk/index.html
http://tomee.apache.org/documentation.html
Finally, another great resource is the Apache TomEE users list. There are many helpful people on there. Good luck, be sure to post there or back on SO if you have further questions!

Related

Choosing a good asynchronous solution for Django projects

I'm currently using Django served on Apache (mod_wsgi) for developing my apps. One of my favorite things is to 'fake' async requests with JavaScript's setInterval() function and AJAX to retrieve new data from database. For example:
// javascript
function someFunction() {
// do some stuff
setInterval(function() { fetchNewStuff() }, 1000); // run fetchNewStuff() every second
}
function fetchNewStuff() {
Dajaxice.main.fetch_new_stuff(fetch_new_stuff_callback, {'id':$(this).attr('user_id')});
}
function fetch_new_stuff_callback(data){
// append new stuff to my table, list or whatever in HTML page
}
As far as I am aware, this is perfectly fine for my needs. However, as my apps are growing bigger and more complex, this will eventually become too much hassle for both, my server and my clients, no matter how much I try to minimize transported data. Also, I cannot settle with the thing that in today's world I'm still 'faking' this :) So, I'd like to find some 'real' solution with push capabilities for my current and future projects.
I did try to google my problem and I have found many interesting stuff (Tornado, Nginx, Node.js, Twisted, etc.) but most of tutorials/articles/blogs are at least 6 months old and I believe that many things changed in that time. So far, I have tried to test Tornado and it was successful test, but I had some problems with setting it up on my production server. I also tried Node.js which is extremely simple since I know JavaScript very good, but then again, I'm not sure if it is a good solution.
My question here is - what would be the best thing (server, platform, framework, whatever) to implement in my current and future apps depending on this conditions:
easy to use (e.g. Node.js could fit in here)
eliminate 3rd party stuff as much as possible (some out-of-the-box solution, e.g. Django+Websockets and that's it [this was really just a silly example])
good documentation in use with Django (it would be perfect to have some real examples with my new technology and Django since I'm pretty much n00b for web servers and related stuff)
has a good perspective and future (I'm really looking to learn something which I will use a lot and which I wouldn't have to re-configure very often)
Thank you for your thoughts and any kind of help about this (links to some good, recently updated readings are more than welcome :)
You should have a look at django-socketio project, a Django app providing the features required to use websockets with Django via Socket.IO.
It uses gevent library along with socket.io.

RESTful Webservices on Google App Engine

First of all I need to say that I'm not so experienced in Google App Engine.
I know that it is possible that we deploy RESTful Web-services (JERSEY) on GAE
And also I know that RESTLET has a version specifically for GAE.
I want to take advice from those who have worked with both approaches that which one is better.
For example is configuring the GAE application for JERSEY too difficult or struggling???
Or for example has using RESTLET any disadvantages? Or is it too thick (RESTLET)?
Thanks
I have tried Restlet and was not satisfied with it: it tries to do to much and is not JAX-RS at it's core (they have it as an add-on). I had problems make it work in various settings (request would not be routed to the method, but when only changing method order it would start working. WTF?!). Also their documentation is scarce and inconsistent.
I took a look at Jersey: there were some problems with running on GAE at that time (resolved via help on support forum). Also I found their docs to not be that good.
Finally, I went with Resteasy/Jackson: docs are superb, works with Maven out of the box, full control over config, security and error handling (exceptions thrown in code returned as JSON error object). Basically no issues. You can look at an example here: LeanEngine REST classes.
Also, if used with JSON/Jackson (make sure to force Jackson 1.9, as built in 1.7 is old) you get a lot of control over how your classes are mapped to JSON: one-to-one, wrapping/embedding, adapter-pattern, etc..
I've been using Restlet on GAE for about 6 months. I chose it in part because they also have editions for Android and GWT, which are also part of my product mix, and I thought it would be simplest to go with the same thing everywhere.
In contrast to Peter K's comment, I found the documentation to be pretty good. In addition to the online documentation at restlet.org, there is a 400-page ebook (Restlet in Action) available from Manning that goes quite in-depth. Possibly the ebook came out subsequent to Peter's evaluation.
That being said, it's a pretty big library with a lot of features, which is a double-edged sword. One the one hand, every time I want to solve a new kind of problem, it seems like Restlet already has something built-in to make it easier. On the other hand, I find it to be challenging to debug through the Restlet source when I'm trying to figure out a problem -- all that flexibility and functionality adds up to a broad and deep class hierarchy, and it's hard sometimes to see how the pieces fit together. If you're building a substantial app, I think it's worth a look, because I don't think you'll run into many limitations with Restlet. However, I haven't used RestEasy, so I can't make an informed comparison to it.
I started one year ago to develop an app with Jersey and Google App Engine. Great experience from my side, but I have never worked with Restlet ..
I try here to summarize the main difficulties I found in GAE integration:
Jersey version: 1.6 works
I suggest you to use Jackson (version 1.7.1) for json representation
web.xml fragment:
<servlet>
<servlet-name>jersey</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>***package-with-your-classes***;org.codehaus.jackson.jaxrs</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
Configurator:
#Provider
public class JAXBContextResolver implements ContextResolver<JAXBContext> {
private AnnoxAnnotationReader annotationReader;
private JAXBContext context;
private Class<?>[] classTypes = new Class[] { .. all your classes .. };
public JAXBContextResolver() {
annotationReader = new AnnoxAnnotationReader();
Map<String, Object> properties = new HashMap<String, Object>();
properties.put(JAXBRIContext.ANNOTATION_READER, annotationReader);
try {
this.context = JAXBContext.newInstance(classTypes, properties);
} catch (JAXBException e) {
..
}
public JAXBContext getContext(Class<?> objectType) {
return context;
}
.. as you can see I use Annox to avoid annotations inside my model classes!
Hope it helps!
Michele Orsi

Which technology (Spring Roo / Django) to build my 'CMS-like' application on GAE?

I would like to create my company based upon a tourism project (WEB 2.0 / CMS like).
Firstly, I want to argue why I think, in my case, that I should develop it (from scratch, but with a good plateform or tool). Indeed, I think that today (but maybe I am wrong...), some tools (or plateform...) are very powerfull and we can be very productive with it.
Moreover, these requesite 'could' jutify to implement my own software :
- my software may interact with other applications (or other tourism database)
- I need to do an 'inline administration' such as MAGNOLIA (not all CMS have it I think)
- I have no monney to buy one good CMS doing the work I need (such as Alfresco, or Magnolia or Liferay...)
- I think that for a long term project, it could be more rentable to develop it in order to have a better control on its evolution.
- I would like to use GAE because it is a cheaper and more flexible solution for the hosting (I do not think that all CMS work on it)
Secondly, now, if you agree with me (but if I am wrong about the liscence, or other solution, tell me please), I really like some help about the technologies...I think that SPRING ROO is a very good tool to develop my CMS. But maybe I should use DJANGO (can you argue about the choice between these 2 solutions to develop my software ?).
My CMS functionalities needed are mainly :
- versionning of the articles (talking about touristic places...) and a repository for them.
- a search (Solr is include in Spring Roo)
- using the AJAX technology (quick refresh)...I would like to use GWT
- permissions (administrator, visitor, contributor, manager...)
- multi-langage and maybe multi-domain websites (or I should have a big portal that give acces to all countries)
- a Backend management for the adverts (I am not sur if delegating this task to dfp (DoubleClick For Publisher) is a good idea ?
- User authentication (LDAP)...I do not know if SPRING ROO manage this ?
- Having simple workflow (such as editing, validating then publishing the article...)
- Think about Mobile App (Android)...so I think that if I choose JAVA, it will be easier to 'translate' on the Android Plateform...
Then, I am sorry if there is a lot of 'topics' in my thread but it is very complicated for me. So I would like to know if, as supposed, I used SPRING ROO + GAE + GWT, so I should use BIGTABLE (the Google NoSQL) ?
At last but not least, I have not found a website that explain how to create my own CMS...what I want to know is how to do the architecture of the software, because there is a lot of technologies interacting (OSGi, Solr, JPA...) and I do not masterize them, so I would know in what order do I need to process...
For the security part, do you think that taking care about the XSS injection is enought ?
To conclude, I know that it is difficult to help me because I ask a lot of things, but here I am now...and in order to explain in what context I am, I would like to take the time to learn 'interesting technologies' because if my project fail, I would reconvert myself in an 'expert' of the tool I have learned (ready to spend until 6 month, 24/24, 7/7 :D to create my CMS-LIKE).
Thank you,
I would suggest to avoid inserting too much information in your question :) Better throw smaller questions so people answer's are more suitable to your problem.
If you plan to deploy on GAE, well my answer is:
GWT for web-dev platform (I don't use neither GXT nor SmartGWT)
Objectify (for persistence on GAE only, kind of vendor lock-in but a good choice)
Use Google App for business and use their OpenID to handle authentication (will reduce a lot your work stack, and especially security concerns).
Optionally, you could use a framework to assist your presentation layer like GWT-platform which is really great. They also offer a nice command pattern implementation. The framework as it's limitations but the guys working for the project are just great.
Try to stay away from Spring-Roo for production app. I tried a few prototypes, buy going further is hard. At least it was in my experience.

Google App Engine + JSON based service + Authentication

I am new to GAE (cloud based development in general actually) and I am looking for some advice.
I am looking to use GAE only as a service (REST + JSON) with my client-side in Sproutcore. I am looking to find a light-weight service-based framework that will provide me with strong security (authentication, protection against XSS etc).
Java or Python is fine, the priority being speed and security.
Does anybody have any ideas on this? Any links to relevant information. I am going through an information overload phase. Any help in this regard would be much appreciated!
Thank you.
How about tipfy, a open source lightweight python-based framework made for GAE?
Its core can be enhanced through usage of extensions.
Combining some of those extensions
would allow you to perform auth
against different systems (Google,
Facebook, Twitter...) or against your
own baked one. An example of this can
be found here, source code is
available here.
A really simple sample of JSON
rendering is available here.
Of course, other python frameworks run on top of AppEngine. You'll find in the AppEngine-Python google group, a thread discussing pros/cons of most of them.
Considering speed, those links may shed some light on the subject
Choosing Java vs Python on Google App Engine
Google AppEngine Language Performance Comparison Followup
proceed with caution if you want to use a framework. since GAE is still evolving, frameworks tend to break. i have tried both tipfy and django on large projects.
http://blog.bygsoft.com/2011/04/27/why-we-should-avoid-tipfy-a-gae-framework/
in many places tipfy tends to just write meaningless (read no value add) python wrappers around what the core gae frameworks provide just causing code bloat.
last i checked, the map reduce package did not work well with tipfy. sorry, i may sound very biased but my experience with tipfy has been average.
So looks like I can't comment on your answer but the link was very helpful! Looks very much like something I am looking for:
Server-side sessions
Custom user authentication
JSON based service with no View layer
Fast and secure
Any other python framework that you might possibly know of along the lines of Tipfy? Just so I have something to compare with?
Does anybody know of any Java libraries along the same lines of Tipfy?
Thanks again for the link!
Edit 1:
Hmm...I have no idea how I ended up with 2 accounts. I'll try to iron it out..
Your links were very helpful..Thanks!
I am inching towards Tipfy at this point, but I think I am going to wait a little longer on this thread to see if I get some more opinions..
Thanks again...

Is anyone using a ColdFusion framework that has specific path requirements without mapping or locating resources in the server root?

Let me first say I am aware of this faq for Mach-II, which discusses using application specific mappings as a third option when:
locating the framework in the server root is not possible and
creating a server wide mapping to the Mach-II framework directory is impossible
Using application specific mappings would also work for other ColdFusion frameworks with similar requirements (ColdSpring). Here is my issue however: my (I should say "their") production servers are all running ColdFusion MX7, and application specific mappings were introduced in ColdFusion 8. I most likely will be unable to do option 1 or 2 because they involve creating server wide changes that could conflict with other applications (I don't have a final word on this but I am preparing for that to be the case).
That said, is there anybody out there who was in similar bind and has done an option 4, in any ColdFusion version, or with any similar framework? The only option 4 I can think of is modifying the entire framework to change this hardcoded path, and even if that worked it would be time consuming and risky. I'm fairly sure that if there was a simple modification or other simple solution it would already be included in the framework (maybe it's included in version 1.8 of Mach-II and I don't know about it yet).
Any thoughts on solving this problem or even unorthodox setups with libraries that have specific path requirements would be appreciated. Any thoughts from Team Mach-II would especially appreciated...we're on the same team here Matt! ;-)
EDIT
Apparently, the ColdBox framework includes a refactor.xml ANT task which includes a target that refactors the ColdBox code to use a different absolute path as a base along with several other useful refactoring targets. So problem solved for ColdBox users.
Looking at the build.xml for Mach-II (1.6 and 1.8) I don't see any target in there that would allow me to refactor the code. I thought about creating a feature request ticket for such a task for Mach-II but frankly I don't think creating such an ANT task is a big priority for the MachII team since the need really only relates to either
a) users of ColdFusion versions below 8
b) someone who wants to use multiple Mach-II versions in the same application, a use I doubt they want to support
The ColdSpring code I have doesn't come with any ANT tasks at all, although I do have unit tests, and I bet if I poked around the SVN I'd find a few build scripts.
Using Ant tasks to refactor and retest the code, or the simpler (and sort of cop out) solution of creating a separate ColdFusion instance for the application are the best answers I've been able to come up with. I don't need this application to exist in the shared scope of other applications, so my first solution is going to be to try and get a dedicated CF instance for this application.
I'm also going to look at the ColdBox refactor.xml ANT task however and see if I can modify it to work generically to recognize and refactor CFC references with modified absolute paths. If I complete this task I'll be sure to post the code somewhere and edit create an answer to link to it. If anybody else wants to take a crack at that or help me out with it feel free.
Until then I'll leave this question open and see if someone comes up with a better solution.
Fusebox is not so strict, I think.
In XML mode (maybe I call this not 100% correcly, just mean using the Application.cfm) it's just proper include in index.cfm, something like:
<cfinclude template="fusebox5/fusebox5.cfm" />
In non-XML mode it will need proper extending in the root Application.cfc:
<cfcomponent extends="path.to.fusebox5.Application" output="false">
All you need is to know the path.
Perhaps you could create a symbolic link and let the operating system resolve the issue for you?
I've been playing with FW/1 lately, and while it may look like you need to add a mapping and extend org.corfield.framework, you can actually move the framework.cfc file into your web root and just extend="framework". It's dead simple, and gets you straight into a great framework with no mess and very little overhead.
It should be as simple as dropping the 'MachII' folder at the root of your domain (i.e. example.com/MachII). No mappings are required to use Mach-II if you just deploy at the root of the domain of your website.
Also:
Please file a ticket for the ANT task you mentioned in your question. Team Mach-II would love to have this issue logged:
Enter a new ticket on the Mach-II Trac
If you want to tackle an ANT task for us, we can get stuff like this incorporated into the builds faster than waiting to for a Team member to work on the ticket. Code submissions from the community are welcome and appreciated.
We don't keep an eye on Stack Overflow very often so we invite you to join our official community group at called "Mach-II for ColdFusion" at Google Groups. The Google Group is the best place to ask questions or comments like this if you want feedback from the Team.