Posts Tagged ‘Java’

Migrating EJB 3 applications from OC4J to WebLogic

Ronald van Luttikhuizen February 17th, 2009

In a previous post I talked about migrating JAX-WS Web Service projects from JDeveloper 10g/OC4J to JDeveloper 11g/WebLogic. This is one of the activities in a current migration project of a SOA-environment from an OC4J-based stack (OC4J 10g, JDeveloper 10g, SOA Suite 10g, ADF 10g, WebCenter 10g, EJB 3/TopLink Essentials) to a WebLogic-based stack (WebLogic 10g, SOA Suite 10g, ADF 11g, EJB 3/EclipseLink).

As mentioned in the previous post, a lot of migration steps are performed automatically when importing 10g projects in JDeveloper 11g. This is also the case for EJB 3 applications that use TopLink Essentials as persistence provider. All references to this provider are replaced with EclipseLink references since EclipseLink -based on TopLink 11g- is/will be the de facto Oracle persistence provider. Deployment of these EJB 3 components to our development environment -Integrated WebLogic Server in JDeveloper 11g- works fine and everything runs smoothly.

For test, acceptance and production environments we use separate WebLogic 10.3 installations. These are “clean” environments. Instead of having all kinds of frameworks deployed on your application server -as is the case for Oracle Application Server and the Integrated WebLogic Server in JDeveloper 11g- this environment is actually clean, lean and mean.

Although in my opinion this is what you want out-of-the-box -you don’t have all kinds of preinstalled frameworks that you do not use, less classloading issues, and so on- initial deployment of our EJB 3 components failed when deploying: NoClassDefFoundError: org/eclipse/persistence/jpa/PersistenceProvider. That’s because Oracle WebLogic 10.3 is not shipped with TopLink 11g/EclipseLink.

There are several solutions for this. You can use patches 9J3A and 5KXF to install TopLink 11g/EclipseLink on WebLogic 10.3. They can be downloaded using SmartUpdate; I couldn’t find them on MetaLink (yet). You can also install EclipseLink manually on an Oracle WebLogic domain as described in the EclipseLink’s User Guide. Other ways of solving this -although I don’t recommend these options- is to package the persistence provider with every application. That means including EclipseLink archives into an application’s WAR or EAR. Or you can switch to Kodo -BEA’s former JPA implementation- since this is shipped with Oracle WebLogic 10.3. However in the latter case you’re not using the go-forward/strategic persistence provider, which is EcslipseLink. Note that later versions of Oracle WebLogic will probably ship with EclipseLink.

Experiences with Vista and Oracle software (2)

Ronald van Luttikhuizen May 19th, 2008

A few months ago I wrote this blog about installing (Oracle) software on my new Vista laptop. I already installed these components several times on Windows XP, so I thought it would be a walk in the park. In the end, it took me a couple of days instead of hours … :-(

There are lots of threads on the OTN forums -like this one- dealing with Vista. It turned out I wasn’t the only one struggling with it.

This blog is about installing Oracle SOA Suite 10.1.3.1 and patch 10.1.3.3 on Vista. Common errors thrown at me -some gave me nightmares :-) - were:

  • OWSM configuration assitant fails.
  • Error: Missing ormi[s]://host:port.
  • This OC4J is configured to make JMX connections via RMIS and fall back to RMI if the RMIS port is not configured. The RMIS connection on the OC4J instance null on Application Server null is configured but a connection could not be established. The JMX protocol is specified by the oracle.oc4j.jmx.internal.connection.protocol property in opmn.xml.

I did three “batches” of steps to get it running:

  • Perform the pre-installation steps as documented in the Oracle SOA Suite 10.1.3.1 and 10.1.3.3 installation guides. These contain the usual steps like configuring a loopback adapter, not using whitespace characters in directory names, having the right JDK, etc. These guides are bundled with the SOA Suite installation files when downloaded from OTN. Performing these steps is “business as usual”. However, these steps alone didn’t work.
  • Perform some steps as documented in Metalink note 444112.1.
  • Browse through the OTN forums for the remaining errors and stacktraces.

These last two “batches” consist of the following additional actions:

  • Do not use underscores in your computer name. I had an underscore in it -love them since you can’t safely use whitespaces :-) - and I couldn’t run SOA Suite. See this forum post.
  • IPV6 is not supported with Vista. There are some compatibility issues between Sun’s JDK and the new IPv6 protocol. I explicitly disabled IPv6 by removing “::1 localhost” from my hosts file, disabling Internet Protocol version 6 (TCP/IPv6) for all my network adapters in the Windows network configuration, and added the following registry value (DWORD type) set to 0xFF:
    HKEY_LOCAL_MACHINE, SYSTEM, CurrentControlSet, Services, Tcpip6, Parameters, DisabledComponents. This is documented in the Metalink note. You can also add the Java option “-Djava.net.preferIPv4Stack=true” to use IPv4 instead of IPv6.
  • Install, start, and stop Oracle SOA Suite as administrator (e.g. right-click and choose “Run as administrator”). Somehow this causes the relative paths in the Start Menu shortcuts to not resolve to the correct locations anymore. I changed these locations to absolute file paths. To do this, edit the [SOA Suite home]/bin/runstartupconsole.bat file and change the line containing “set ORACLE_HOME”.
  • Firewalls and virus scanners are great when they are not hogging your system and/or block wanted messages. The latter happened on my laptop. I disabled the pre-installed security software since it blocked certain requests and replies from and to my local Oracle SOA Suite.
  • I did an advanced install and used Oracle 10g XE as dehydration store since the pre-installed Oracle Lite database (Oracle SOA Suite basic install) crashed every now and then.

These errors can be really frustrating. Especially when you successfully install the exact same software on another OS within the hour and all your “Linux” and “XP” colleagues have Hello World running on Oracle SOA Suite :-) Hope this helps.

Experiences with Vista and Oracle software

Ronald van Luttikhuizen January 30th, 2008

This is a quick overview of my attempts to install and run (Oracle) software on Microsoft Vista. A few months ago I got this new Dell laptop pre-installed with Vista Business. Last couple of years I mostly worked with 2000, XP and Unix/Linux so Vista was getting used to in the beginning; especially the enormous amounts of “Are you sure”, “Do you really want this?”, “You’re not allowed to do this”, etc. pop-ups (even more than XP had). Although I must admit that some of the new UI-stuff is real eye-candy.

Some general (and sometimes really frustrating) issues I ran into when trying to get Vista up and running was the new IPv6 network protocol and updated WPA stuff (my existing router and wifi configuration really had a hard time connecting to my laptop or vice versa – I’m not a network guru, maybe that’s the problem after all :-) , the new user account control (UAC) policy in Vista (I couldn’t stop some Windows services in the beginning even when logged on as admin) and the pre-installed firewall, virus scanner, etc. which made my (finally up-and-running) Internet connection and network adapter crash. So after some reboots and resetting my laptop to factory settings I thought I had the new Vista “under control”.

Time to install some real business software.

Up to now I have the following software up and running (didn’t really test all software extensively yet):

  • Sparx Systems Enterprise Architect
  • JDK 5 and 6
  • Eclipse SDK
  • Eclipse WTP
  • Oracle BPA Suite
  • JDeveloper 10g
  • JDeveloper 11g – Technology Preview including SOA Suite and WebCenter
  • Oracle XE 10g
  • Oracle SQL Developer
  • Oracle OC4J 10g

Some tips:

  • Don’t use the standard Vista (un)zipper when unzipping software with long directory- and filenames. For example, I couldn’t run Eclipse WTP since the Vista unzipper didn’t extract all the extension files. This can be tricky since some installers won’t even indicate that all files are not properly unzipped. You can start Eclipse WTP, develop some code, but when trying to add a server, there’s nothing there to add?! Use another tool such as 7-Zip.
  • Run all installations and configurations as administrator; right-click and choose “Run as administrator”.
  • I ran into an error when installing a standalone OC4J. This was caused by compatibility issues between Sun’s JDK and the new IPv6 protocol. Trying to shut down OC4J returns an error indicating “Error: Missing ormi[s]://: “. See this forum post for a solution. I simply added the -Djava.net.preferIPv4Stack=true
    parameter to the OC4J startup command in oc4j.cmd.
  • Read the installation manual. Ok, I know this sounds a bit daft, but there are numerous forum questions in which it turns out people didn’t configure a loopback adapter, didn’t have the right JDK installed, etc. So after all, it’s really worth reading the manual.
  • Make sure the directory structure for your Java and Oracle installations don’t contain whitespaces or symbols such as # or @. I only use letters, digits, dots and underscores. Not all software can handle other characters.

Ok, in the next couple of days/weeks I’m going to (or at least try to :-) install SOA Suite 10g (lot of forum posts on installing this on Vista), Oracle Database 10g Enterprise Edition and playing around with Coherence.

J-Fall 2007 and session titles.

Lonneke Dikmans October 15th, 2007

On October 11th, J-Fall took place. Twice a year the dutch Java User Group (NL-JUG) organizes a conference. Sessions often have ‘real life’, or ‘in practice’ in the title. Often this is just a trick to attract people. The presentation that Martijn van Berkum (GX) gave about the Java content repository 2.0 was a pleasant exception. His session was titled: “Java Content Repository (JCR) 2.0 (aka JSR-283)”. He explained the specification very clearly, both the 1.0 and 2.0 version. Because GX uses it in their product WebManager he could share some real life experience with the audience. This, unfortunately, was not the case with “Real world usage of JBI”. Jos Dirksen knows a lot about JBI and Enterprise Integeration Patterns, but his presentation only had some code samples. That is not what I expect when the title says ‘Real world usage”. Project experience, examples of clients who used JBI and a specific product, is what I expect and want from a session like that.
The discussion “the Enterprise Architect confronts the Application Architect” also did not offer what the title promised, but this time I did not care. It was very nice to have a different format (discussion in this case). The subjects they talked about were very interesting and real. A session that delivered exactly what the title promised, was Duncan Mill’s presentation. The session was titled: “Controllers – The Next Generation”. He gave an overview (and did that very well, because he is an excellent speaker) of the different webframeworks and how these frameworks deal with the Controller in the Model-View-Controller pattern. If you are curious about PageFlow in ADF and how this compares with Spring Webflow and Seam, you can download the presentation in November from the NL-JUG site. Don’t forget to try the PageFlow stuff with JDeveloper 11 (technical preview). That is what I am going to do, too!

Oracle Spring Development Kit

Lonneke Dikmans May 12th, 2007

Today I downloaded the Oracle Spring Development Kit, or OSDK from OTN. The OSDK helps developers get started with Spring and JDeveloper. It provides three things: the Spring extension for JDeveloper to facilitate Spring development. Oracle Developer Depot to make it easier to install and last but not least tutorials and howtos. The samples contain the jar files you need from the spring framework. They used version 2.0.4 for this. OSDK does not ship with the Spring framework. So to get started, you can either download the Spring extension from the Update center, or install the one that comes with the OSDK. I decided to use the one that comes with the OSDK. To do this, simply put the jar in the [jdev_home]\jdev\extensions directory. Now let’s take a look at the extension.xml in the META-INF folder of the jar file. It has a classpath entry that looks like this (I shortened the reference to the extension home to make the line more readable):

library name="Spring 2.0"
${ext}/spring-framework-2.0.1/dist/spring.jar
${ext}/spring-framework-2.0.1/spring-aspects.jar
...

JDeveloper will create a library named “spring 2.0″ and show it in the list. If you want to use that, you should create a directory in the extensions folder and put the modules in like the classpath tells you to. Alternatively, you can ignore the xml file and create a user library.

I decided to put the jars in the extensions directory:

  • Download Spring
  • Create a folder named oracle.jdeveloper.spring2.06.11.23.01 in the extensions directory
  • Extract the spring framework you just downloaded to the folder you just created

I downloaded spring-framework-2.0.5. This gets ugly: I don’t want to point to a version of spring (in this case 2.0.1), and put jar files from another version (in this case 2.0.5) in the library. Besides, I might have a project using Spring 2.0.1 and another project using Spring 2.0.5 or some future higher version.

So I decided to take the other route: download the extension from the JDeveloper update center. This is much easier: it simply installed the Spring 2.0.1 files in the extensions directory.
Of course, if you want to use a newer version of Spring in your application, you can create a user library and put that in the project libraries.

Now you are ready to start using the features of the Spring extension. Remember to use the XSD style definition in your applicationContext.xml. For a list of cool features take a look at OTN.

Another part of the OSDK is ODD. This is a nice feature that allows you to easily install samples from OTN to your local OC4J instance. It uses Spring as a container. Installation is simple

  • Start OC4J
  • Install the odd ear with the application server control console
  • Open a browser window to http://[host][port]/odd

Log in to your OTN account and just start installing the samples that you like. It is as easy as that!

Alternatively, you can deploy the samples that are packaged in the OSDK yourself with Ant or JDeveloper. All in all a nice starter kit to start using Spring in your day to day work.

Read more...
Comments Off

JavaOne 2007- scripting day

Lonneke Dikmans May 11th, 2007

Yesterday I focussed on SOA, today I decided to make it a scripting day. Like last year, scripting is a hot topic at the conference. There are several reasons for using a scripting language: it is dynamic, it is easy to write and very very cool. So I decided to have a go at the Lab “Dive Into script programming on the Java platform”.
There were seven exercises, that you were supposed to finish in 2 hours. For something so easy and cool, that seemed like plenty of time.
The machines were preset up with netbeans and all the necessary modules installed.
The exercise started with some java script calling java classes from within the engine that comes with the JDK 6. You can open a command prompt and call jrunscript and start typing.
For example the following will display the date:

js>date()

You can also create Java classes, for example to create a file, type the following code:

js>var file = new File("test.txt")

You can now manipulate the file, call methods, use introspection etc. Strangely enough, you do need to import java.lang and all the others, but not the java.io package. So if you want to create a JFrame you use the following code:

js>importPackage(Packages.javax.swing)
js> var frame = new JFrame("testFrame")

The next exercise showed how to use javascript in your Java code. Basically what you need to do is create a ScriptEngineManager for the scripting language you want to use. Then you create an engine and evaluate the script.
Suppose we have the following Javascript:

function hello(){
println("hello world")
}

Then you call this from your Java class by creating the following code:


ScriptEngineManager mngr = new ScriptEngineManager();
ScriptEngine engine = mngr.getEngineByExtension("js");


engine.eval(new FileReader("hello.js"));
if(engine instanceof Invocable){
Invocable inv = (Invocable)engine;
inv.invokeFunction("hello", (Object)null);
}

It took me a while to get the hang of it. I don’t know Javascript and I only use NetBeans at JavaOne labs. The lab was two hours and I spent most of it trying to figure out the javascript syntax and the netbeans IDE. I never got passed exercise 2. This shows your productivity drops considerably if you need to use a tool that you are not used to. I liked the setup of the lab though, it had some simple copy paste exercises, but also exercises where you had to think about what you learned so far.

I decided to retry the same thing with JDeveloper11g Technical Preview.
I created a new Workspace and a project and imported the code from the lab into the project. JDeveloper offers code completion for javascript and even shows Icons for FireFox and/or Internet Explorer, whatever is applicable. Sure enough, after a couple of minutes, I had everything up and running.

After the lab, I went to the panel about SCA, where David Chappell represented Oracle. It was an interesting discussion. The audience could ask some questions and came up with some real world examples where SCA would have been of help. The conclusion of the moderator (also named David Chappell), was that if a vendor claims it supports SCA, you should ask “What do you mean”. This because it has several aspects: a programming model, and a way of creating composite services. Then there is also SDO that can be used in conjunction with SCA. The other conclusion of the session, mainly from Sun, was that not every part of SCA was going to be picked up by the development community.

After that is was time for some more scripting. The session “Creating Manageable Systems with JMX, Spring AOP and Groovy” was interesting: I did not know that Spring 2.0 supports scripting languages. I am not sure I agree with the presenter that it added value to use Groovy in this case, but the aspects to intercept events in the application and monitor it with JMX certainly made sense.

Apart from the new IDE experience, I had a culinary experience today as well: I skipped the after dark bash, and went to the 21st Amendment with some friends; we had a very curious pizza: topping with bbq sauce. To my surprise it tasted very well!

Read more...
Comments Off

JavaOne 2007- statistics

Lonneke Dikmans May 7th, 2007

I am very excited to be at JavaOne. I love San Francisco, and I enjoy talking to people from different countries and companies about Java, and new cool stuff. It is always very difficult to choose your sessions: last year I ended up being totally sick of AJAX and web 2.0 because I went to too many of those sessions. This year, I picked a lot of SOA and integration topics, I hope I am not falling into the same trap. To get an impression of the overall conference I did a little research using the Schedule Builder.

General Numbers
In total there are 388 sessions. There are different types of sessions:

  • technical sessions: 251. The core of the conference.
  • business sessions: 5. This number suggests that is not really a big thing for Sun
  • communityOne sessions: 0. This is a new type, related to the open source Java initiative. I signed up for it, but it is totally unclear to me what to expect. I will let you know what happened.
  • Birds of feather (BOF): 117. These are mainly in the evening. Some of them are very interesting like the one from my former colleague Gero Vermaas, he is doing a presentation titled “How to Integrate Your Order Management Solution in a Service-Oriented Architecture”. I registered for the session. I hope I can make it: last year I was too tired to visit any of the BOFs…
  • Hands on Labs: 15. I always like those: it gives me chance to have a look at netbeans (something I have never used in a project) and a feel for a specific topic or technology.

Of course the conference is dominated by Sun: they decide on the tracks (Consumer technologies, Desktop, Java EE, Java ME, Java SE, Java technology business day, Java technology in tv, open source, the next generation web and tools & languages) and they make a selection from the abstracts that are submitted. It is interesting to see what topics Sun thinks are hot.

Integration

Of the 388 sessions in total, there are 35 in the Services and integration track. There are a lot more sessions about SOA than about EDA. An equal number of session mention BPEL as there are sessions mentioning JBI:

  • SOA: 35
  • EDA: 3
  • JBI: 9
  • BPEL:10
  • XML: 42
  • SOAP:14
  • Web services: 47
  • JMS: 6
  • ESB: 7
  • WS-*: 4

Java SE & Java EE
Another topic is Java SE. There are 67 sessions in this track. This is the biggest track of all. Of course I will be attending the worlds most famous and best quiz: the Java Puzzlers with Joshua Bloch. I am not sure what the trend or hot topic is in this track, maybe scripting? I will have to visit some of the sessions to find out ;-)
Java EE has 56 tracks. That is less that in the Standard edition track. This is surprises me, but maybe a lot of the Java EE tracks ended up in the integration track?

Open Source

There are 35 in the open source track, quite a few (4) about OpenJDK, 20 sessions mention Spring. This contradicts the prediction of some people that Spring has become obsolete since EJB 3.0 and JEE 5: I am happy to see that they are wrong!

Web 2.0 & Scripting

Seeing the numbers so far: I can’t help wondering what the new trend in Java is according to this conference. It is not integration, Open Source or enterprise edition then it must be Scripting and web 2.0…..
There are 42 session in the “Next Generation Web” track:

  • Scripting: 18
  • JRuby: 8
  • JavaScript: 34
  • Ajax: 57 (!)
  • JSF: 4
  • Web 2.0: 30


Other tracks

Java ME is pretty big too: 59. Last but not least there are 47 sessions in the tools and languages track.

Companies

The last thing that I was curious about were the companies that are participating. I searched for the following:

  • Sun: 200
  • Oracle: 13
  • IBM: 14
  • Bea: 7
  • JBoss/Red Hat: 15
  • Interface21: 6
  • Eclipse Foundation: 5
  • Nokia: 11
  • Google: 16
  • Yahoo: 1
  • ThoughtWorks: 3

Obviously there are more companies, but these are the one I was interested in…. I am not sure what it tells us, except that JavaOne is very much a Sun conference. That is the advantage of conferences like the ServerSide or JavaPolis, these reflect the trends and thoughts in the Java development community more than the strategie of one company.

Conclusion
Looking at the numbers, I would say that web 2.0 and Ajax are still a major topic/trend. We will have to wait and see, if the visitors of the conference agree…

Read more...
Comments Off