21 November 2011

Hudson - Continuous Integration



People (developers) pricier
Computers Cheaper
Why not use more computers than people?

Hudson in many companies used (not in Google?)

community release every week

detects changes
builds
record results
send notifications

cron - before hudson (+some customization using perl)
can send emails only not anymore

hudson - aggregate results, from different platform, different JVMs and so on (great feature)

hudson has plugins -[]-> findBug plugin

keep track of changes

capable of hosting more than one project using in one hudson

JNLP Launch for slaves who can not see master

hudson can install JDK for you! Different versions!

hudson kills processes used for making the builds and won't let them live longer than needed.

hudson on EC2 (Cloud) (best on Amazon)

3 / 4 working full-time on hudson core

3 November 2011

VM arguments

Have you ever wondered where that value came from in a Java program? One place to look for is the VM arguments. They are set in the system and not when you are writing your code.

A code like this will give you some good understanding of VM arguments.

import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;

RuntimeMXBean RuntimemxBean = ManagementFactory.getRuntimeMXBean();
List arguments = RuntimemxBean.getInputArguments();
Iterator iterator = arguments.iterator();
System.out.println("VM arguments");
int i=0;
for(;iterator.hasNext();)
{
System.out.println(iterator.next().toString());
}
System.out.println("Number of VM arguments :"+i);

1 November 2011

Ultimate guide to online social privacy

With emerge of G+, social life on the web has come to a new era. An era, that you can not ignore it. There are lots of advantages in it. A simple sample is a search result, Google will return results that your circles suggest you, and if you are working on testNG as a newbie, you always would appreciate its creators (C├ędric Beust @ http://beust.com/weblog/ & https://plus.google.com/u/0/108840253750748459271/posts) +1 on testNG links. On the other hand, there is always concerns privacy issues. I am going to suggest some steps in order to protect your online social privacy as much as possible. These steps make your life more private to third parties and not the social network (e.g. Google+, twitter or Facebook) you are using. Let me make it more clear by making an example, let's say you comment on an image in Facebook, after a while you decide that you don't want everyone know that you care about that specific photo and delete that comment. However, as all we know this would be a logical delete in Facebook data center, they are just marking your comment as deleted and won't ever showing that to you or anyone else, but they keep that in their data center to make sure they know as much about you as possible. If you try this on Google+, it would be even more transparent, comment on a photo, then delete it, after deletion you would still get notifications on that photo.

These are my ultimate rule to online privacy:

Twitter:
  • Do not retweet, twitter treat retweet differntly than regular tweets generated by you. Try copying pasting it and give author credit by using @ sing and his/her id
  • After a while, use tweeterwhipe on your account, http://twitwipe.com/login.php this is the best I have found, you will give it access to your tweets, based on your number of tweets, it will delete all tweets, it might take a while if you have lots of tweets
  • I really like twitter for being so open, you can delete all your tweets (you can not do that in your Facebook, even manually)

Facebook:
  • Use like as less as possible specially on webpages outside Facebook. If you have to use Like and nothing else on the world make you happier than hitting Like button, do it. What I suggest is to have a Trace folder/tag in your favorite bookmark and bookmark that page.
  • Do visit your wall often (e.g. once a week), your wall shows all your interactions on Facebook, like any comments you've made recently. Go over old comments of yours and do delete them, do delete tags of yourself in photos as well (or you can set photos of you to be only available to yourself and no one else, your choice. I selected the later one, I do like to have access to all my photos on Facebook)
  • Do visit the Trace folder/tag in your bookmark and unLike the pages, photos, groups that you've liked.

Google+:
  • Google+ is somehow the same as Facebook, it is more transparent in terms of privacy (at least in my view) but still there is not API announced for it yet. So you can not expect to have whipe all your activities on G+ using some tools like twitwipe. You have to do that manually.
  • There is not wall in G+, you have to visit your notifications page (https://plus.google.com/u/0/notifications/all) and post page (e.g. https://plus.google.com/101413016003587078317/posts this is my G+) to be able to see all your transactions with G+. You can delete your posts, your comments, your +1s.

Remember, it is nice to comment on friend's engagement photo, congradulate him/her on his/her best day of his/her life. But there is no point to leaving it there, if he replied back to you and thanked you on that. It means that he received your message. Keeping your comment there is like saving your voice-mails for eternity. I am sure there wouldn't be any use for you, is it? So it is up to you to delete that.

Access EJB via HTTP in JBoss AS

If you are trying to acccess EJB through HTTP, you need to use org.jboss.naming.HttpNamingContextFactory for your context factory. However, there is only one small twitch in using that. You need to specify credentials accessing that invoker. This is what you need to add:

env.put(Context.SECURITY_PRINCIPAL, "admin");
env.put(Context.SECURITY_CREDENTIALS, "admin");


This is complete code:

Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,"org.jboss.naming.HttpNamingContextFactory");
env.put(Context.PROVIDER_URL, "http://localhost:8080/invoker/JNDIFactory");
env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
env.put(Context.SECURITY_PRINCIPAL, "admin");
env.put(Context.SECURITY_CREDENTIALS, "admin");
Context ctx = new InitialContext(env);
ejbTestRemote obj = (ejbTestRemote) ctx.lookup("ejbTest/remote");


This is how it looks like if you are using NamingContextFactory:

Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,"org.jboss.naming.NamingContextFactory");
env.put(Context.PROVIDER_URL, "localhost:1099");
env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming.client");
Context ctx = new InitialContext(env);
ejbTestRemote obj = (ejbTestRemote) ctx.lookup("ejbTest/remote");

31 October 2011

ENC in JNDI JBoss

The application component environment is referred to as the ENC, the enterprise naming context. It is the responsibility of the application component container to make an ENC available to the container components in the form of JNDI Context.

// Obtain the application component's ENC
Context iniCtx = new InitialContext();
Context compEnv = (Context) iniCtx.lookup("java:comp/env");

19 October 2011

Lytro, living pictures from a light field camera

Lytro, will be a revolution in photography, no doubt about that. There were so many revolutions in this industry, from film photography with negatives to digital photography to the small cameras you can have it wherever you are carrying your phone with you. I don't want to write a review about Lytro or persuade anyone to buy it. I am going to list my concerns about it. To my opinion, Lytro is nice for taking pictures and viewing them online, or in its small LCD it has. You can't find any discussion about if you can import the image to a jpg file or not. If not, you are stuck with the lpf file and you have to only view your images in that. You can not have images on your cell phone, photo frame or any other device. I believe there will be a conversion tool available (if not already in the software included). Other concerns of mine are the quality of the images imported from the lpf file.

My other concern is how much noise is going to be there? Is it even comparable to the most amateurish DSLRs in terms of quality in pictures taken? It is half price of some DSLRs. With a DSLR you can adjust everything, ISO, exposure, .... With Lytro you don't even have a flash. Is it good enough for you? If you don't mind the price and are too eager to be among the first people to try it, head to lytro.com and buy it. If you are looking for some point and shoot, you can find cameras for under 100$s. For 1000$s you can buy a really nice DSLR right now, top of the line. You can take HDR images with DSLRs, ... but you can only have a picture taken with Lytro that you can focus later. How many pictures you want to have that functionality? Imagine 350 images (i.e. it's lowest capacity version of Lytro) you have taken from a wedding, how long will it take to figure out the best focus points using its software? isn't it easier to take two or three pictures using a nice DSLR and do no after-taking-focusing anymore?

7 September 2011

Javascript in Goole (IO 2011)



Functional Language

No type testing (in JavaScript)

Reads top to bottom (no multi threading)

Everything an Object (Java Duh!)

Desugaring

6 September 2011

Python & Google



Python an Object Oriented Language
-Script
-Code Compile (first time)
Python is battery included (don't have to download anything else)
Python main designer work at Google App Engine Team
Everything other than PC has python in it (PS3, Nintendo DS, Mac, Linux)

Two versions of Python
Python 2 (current)
Python 3 (coming soon)

24 August 2011

HAR files and how to package them (in JBoss AS)

HAR file is short for Hibernate Archive File (in JBoss world). These types of files are being used to configure JBoss AS to utilize hibernate and access hibernate and be able to provide access to hibernate via itself to the client code. Configuration files can be archived in a .har file and deployed on the JBoss server. Minimum HAR file consists of the entity class heirarchy and its hibernate mapping files (hbm.xml) and an XML file resides under META-INF folder. The xml file which is needed to be ended with -hibernate.xml is for registering SessionFactory and how it handles sessions.



Let's say you are trying to automate your build process, and you are using Ant. How many HAR files you want to generate and in what structure ?



The best is always the easiest, you only need a single .har file which has all the necessary classes and hbm.xml files.



hibernate.har

|META-INF

-|hibernate-xml-hibernate.xml

|org

-|domain

--|package

---|Entity.class

---|Entity.hbm.xml

---|AnotherEntity.class

---|AnotherEntity.hbm.xml





You can not have more than one har file with the same SessionFactory name in them. That will result in an exception. Also it won't be a wise choice to have more than one SessionFactory.



hibernateAnotherEntity.har

|META-INF

-|hibernate-xml-hibernate.xml

|org

-|domain

--|package

---|AnotherEntity.class

---|AnotherEntity.hbm.xml



hibernateEntity.har

|META-INF

-|hibernate-xml-hibernate.xml

|org

-|domain

--|package

---|Entity.class

---|Entity.hbm.xml



You might want to create one har file with only the xml file under META-INF and have every class and its hbm.xml in another har file, this won't work either. Since the SessionFactory have not been bound to the classes. The bounding is done by being in the same file (or folder).



hibernate-xml.har

|META-INF

-|hibernate-xml-hibernate.xml





hibernate-hbm.har

|org

-|domain

--|package

---|Entity.class

---|Entity.hbm.xml

27 July 2011

String ... VS String []

Both are the same, but the later one calling the method you need to create String [] first and then call while the first one you can call it without creating String [].

More @ stackoverflow

11 July 2011

Google I/O 2011: How to Get Your Startup Idea Funded by Venture Capitalists





Some of the most interesting people in business, founder of Excite, have you ever used it ? Founder of FriendFeed and former employee of google and Seth, creator of scavenger. Watch it if you have time.

Google Hosting and its problems

It is easy to use Google Sites, Google apps and Google blogs (next generation name for blogger). But it is not that easy to remember if you have registered your blog with one of these services long time ago or is it someone else ? I am saying that for those who encountered this problem in hosting their sites/blogs with the custom domain name with google blogging.
It says
Another blog or Google Site is already using this address.
Good luck finding that blog or one page that you created long time ago and deactivate it. I couldn't find that, I wasn't even sure if it was me that created it, so I ended up deactivating my whole google apps for my domain, and I am still waiting for it to deactivate to see if it solves the problem. I know google for privacy issues won't let anyone know who is the one hosting your domain name on their sites. It is not fair to the real owner of the sites since even without confirmation that it is their own, you can ask google to host it on its google sites or blogger service. There should be some sort of approval for domains to add to your blog or sites. It might be as easy as first change the CNAME to ghs.google.com. and then use them with google sites, blogger service. That way one who has no control over a domain can't add that to his/her account and blocking you from using it in future.

There should be some simple way to resolve this issue, and should have been at least addressed in one of blogger's posts.

4 July 2011

Hibernate / Jasper Report Integration

I am looking into Hibernate / Jasper report integration. It seems that Jasper Report has not initially been compatible with Hibernate but only from it later versions. This make life harder when it comes to the nature of Jasper Report, whom as a novice I believe treats everything as a row and should be inputed with rows of data to be able to generate the report.

In different sources, I have come across solution on how to integrate Hibernate with Jasper reports. These are what I have found.

In 1 author has mentioned that:

However, when the Hibernate query returns tuples of objects (each tuple as an array, each array as an element in the returned List), things get a little tricky. Jasper needs a way to reference each object in the array by a field name. This class is a good solution, but at this time you are required to pass an array of field names matching the results of the query.
And he/she is suggesting that it is a helper class needed to interpret those results and transfer them into usable data for Jasper.
John is also suggesting the same solution for using Hibernate with Jasper; You can find more tips on optimization of Hibernate / Jasper integration in his post as well.
This is also a really good start for Jasper, a really nice Hello world tutorial for Jasper Reports.

Resources:

  1. http://community.jboss.org/wiki/UsingJasperReportsWithHibernate
  2. http://www.javalobby.org/articles/hibernatequery103/
  3. http://www.sanjbee.com/content/wp-content/uploads/2008/07/jasper.pdf

@EJB Annotation in EJB Client

Problem:

App server is JBoss, I created the Jar file for the bean class and interface in the right directory. Now I created a simple client using EJB annotations, but I am getting a NullPointerException.

Solution:

EJB annotation is an incejction, it is supposed to be deployed on the app server and then executed in an Application Client Container (ACC) so that injection can occur. Starting the ACC requires an application server specific command.


The following wiki explains the usage of the ACC in JBoss (how to package, deploy and launch an ACC): How to use an application client in JBoss-5.

If you don't want to use an Application Client Container and instead just run the application client class through a java command, injection won't be possible and you'll have to perform a JNDI lookup.

And in both cases, you'll have to provide and use a remote business interface for your bean.

22 June 2011

JNDI in POJO

If you have used JNDI lookup in your services, JSPs or servlets, it was as easy as looking it up using some code like this:

InitialContext ctx;
ctx = new InitialContext();
MyBean hello = (MyBean) ctx.lookup("MyBean");


However, if you want to use this code in a POJO style, you won't be successful, looking up that JNDI. In the first cases, you were running your code within a container, thus you don't need any specific configuration and the container will take care of it. However, in a POJO style (i.e. using main() method), you need to have some specification detailed out. One need to set up server properties to get the InitialContext.

For JBoss, you need to have the following set and be passed to your InitialContext:

Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
env.put(Context.PROVIDER_URL, "localhost:1099");
env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming.client");
Context ctx = new InitialContext(env);


You also can create a jndi.properties files with the following parameters, and place them in your class-path.

java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.provider.url=jnp://localhost:1099
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

Resources:

http://community.jboss.org/wiki/AccessEJBsRemotely

2 June 2011

UserTransaction vs. TransactionManager

The UserTransaction interface allows applications to control transaction boundaries.

The TransactionManager interface allows the application server to control transaction boundaries on behalf of the application being managed.

18 May 2011

XADatasource in JBossAS & Hibernate

If you have ever wondered how you can use an XA Datasource in your JBoss AS, this is the answer. First you need to define the XA Datasource in your JBossAS, it is as easy as creating an XML file like this:





XAOracleDS
true
false
oracle.jdbc.xa.client.OracleXADataSource

jdbc:oracle:thin:@monkeymachine:1521:jboss

jboss
password

org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter






jboss:service=TransactionManager





Then you need to copy this file to your default (or another profile in your JBossAS) deploy folder, tada! you have registered a JNDI registry for the XA Data-source of yours. Now the question is how to use it with Hibernate. Hibernate configuration files are usually something like:







oracle.jdbc.driver.OracleDriver
rms_owner
jdbc:oracle:thin:@localhost:1521:HBTTST
rms_owner
org.hibernate.dialect.Oracle10gDialect




in this hibernate file as you can see, all the variables required to connect to database are specified. However, now that you have created the Datasource you just need to point hibernate configuration file to the new Datasource file, something like:








org.hibernate.dialect.Oracle10gDialect

java:XAOracleDS


now you should be able to use Hibernate and it should be able to connect to your database flawlessly.

Please note that the connection datasource name in hibernate file is java:XAOracleDS and not XAOracleDS.

Google I/O 2011 - Talks

Google I/O 2011: The Secrets of Google Pac-Man: A Game Show

26 April 2011

Hibernate First Steps

For adding a new object (to database) the code below suffice (you still need to define xml files / JPA annotation still for hibernate configuration):



Configuration conf = new Configuration().configure(file);
SessionFactory sessionFactory = conf.buildSessionFactory();
session =sessionFactory.openSession();
//Create new instance of Contact and set values in it by reading them from form object


Transaction tx;
tx = session.beginTransaction();

System.out.println("Inserting Record");
contact contact = new contact();
contact.setId(6);
contact.setFirstName("firstt");
contact.setLastName("lfirstt");
session.save(contact);

System.out.println("Done");

tx.commit();




This is not the whole code, you need to take into consideration the flush and close of the session.
For updating or deleting, one should know the uniqeIdentifier, if not you can use SQL query to get that (not described here how).
When you have that identifier, you just need to have the following code:




Long identifier = (long) 2;
contact contact1 = (contact) session.load(contact.class, identifier);
System.out.println(contact1.getEmail());

25 April 2011

Persistence in jBPM

Trying to persist a jBPM into a database ? and you are searching the internet for it ? that's not going to get you the best result. You might get to this page: http://docs.jboss.org/jbpm/v3/userguide/persistence.html where it says you need to use the jPBMContext but what you need to know is that you don't need to do anything. jBPM if set up correctly, it persists automatically into database. You only need to change (or use) jPBMContext where you want to change the default behavior of the system.

20 April 2011

Making external monitor the primary monitor in Linux

Making some monitor, a primary monitor is a matter of having the panels on that monitor. No one wants to work on one monitor that has panels of its machine on the other one. I have tried this on Red Hat Enterprise 6.
Here's a step-by-step way of moving a panel to another screen:
  • Right-click the panel you wish to move and select "Properties".
  • Uncheck the "Expand" option under the "General" tab.
  • Grab one of the edges of the panel by clicking on the left or right end (top or bottom end for vertical panels).
  • Drag the bar to the desired screen and position.
  • Check the "Expand" option in the "Panel Properties" window and click "Close".

28 February 2011

Different ways to write files in Java

If you ever wanted to write a file using Java, you can find different ways to do it. Some of them are as follow:
import java.io.*;
class FileWrite 
{
public static void main(String args[])
{
try{
// Create file 
FileWriter fstream = new FileWriter("out.txt");
BufferedWriter out = new BufferedWriter(fstream);
out.write("Hello Java");
//Close the output stream
out.close();
}catch (Exception e){//Catch exception if any
System.err.println("Error: " + e.getMessage());
}
  }
}
The above is a simple way of creating a file, writing into it and then closing it. There is one other way, which is nicer, as follow:
fileStream = new PrintStream(new FileOutputStream("out.txt",true));
// Redirecting console output to file
System.setOut(fileStream);
// Redirecting runtime exceptions to file
This way, you are setting the system.out to a file. After that, anything you put on the output buffer instead of printing it out on the console, it will be printed in a file system.

22 February 2011

OC4J Standalone ORACLE_HOME

Just find the oc4j.cmd in the bin directory and use the following command to set your ORACLE_HOME
set ORACLE_HOME=C:\Files\Develop\External\oc4j_extended_101340
add this line the to the first line of oc4j.cmd. Using this option, you don't need to set ORACLE_HOME in your environment variables any more.

PL/SQL Developer - Oracle Home

There are two ways to define Oracle home for the PL/SQL developer.
One way is to have it in the environment variables, and point it to the installed directory. This works globally, so any other program/software is going to look for ORACLE_HOME will use this one.
Another way is to use the ORACLE_HOME registry value. You would be able to find it under HKEY_LOCAL_MACHINE -> SOFTWARE -> ORACLE -> ORACLE_HOME ; Considering you have installed Oracle on your PC.
Using this registry needs some tweaks. You need to find the params.ini in your PL/SQL developer installed directory and uncomment the oraclehome and set it to ORACLE_HOME.
In the latter approach, PL/SQL developer first looks at the params.ini file for ORACLE_HOME, so you can have set your ORACLE_HOME variable in your environment variables to some other directories and use another one with your PL/SQL developer.

16 February 2011

OC4J Standalone

If you are running a standalone OC4J, make sure that you have set the ORACLE_HOME and JAVA_HOME properly. If an IT guy in your company has set up your computer, then you need to double check that ORACLE_HOME is not set to the oracle folder installation but the location where you unzipped OC4J.

10 February 2011

How to run Mule on your Eclipse

I have the following setting on my machine:
  • Java 1.6.0_23
  • Eclipse Hellios
  • Mule 2.2.1
You can find almost a good Mule startup guide at here. However, this configuration guide is not really reliable. So follow the following instructions:
Configure your Eclipse with 1.5 version of Java. You need to download Java 1.5 and install it somewhere on your PC, doesn’t matter where.
You only need to configure Eclipse once. With subsequent projects, you can skip these steps.
  1. Start Eclipse.
  2. In the Workspace Launcher, specify the location of the examples directory under your
    Mule home directory (such as C:\mule\examples), and click OK.
  3. Click the Workbench icon on the right to display the workbench.
  4. Choose Window > Preferences.
  5. Expand Java in the navigation tree, click Compiler, and then change the compiler
    compliance level to 1.5.
  6. Please note that you might get a warning message in your eclipse window saying that you need to create a JRE environment in your Eclipse.
Installing Mule IDE (Eclipse Galileo)
  1. Start Eclipse, and set up a workspace for your installation of Mule if you haven't already.
    (Make sure your workspace does not have a space in the directory path)
  2. In the workbench view, choose Help > Install New Software.
  3. Click Add next to the Work with text box, enter
    http://dist.muleforge.org/mule-ide/updates/3.4/, and click Enter.
  4. Click the Mule IDE check box and click Next, and after Eclipse processes for a moment,
    click Next again.
  5. Review the IDE license, select the option to accept the license, and then click Finish.
  6. Click Yes to restart Eclipse.
From this moment, it should be easy. Whatever project you need to create, just create as a Mule project. You need to have a Mule server installed for your Eclipse. Installing is as easy as downloading the mule from its website, unpacking it and then simply pointing to it via the Eclipse environment.
You also have the option to create a Mule configuration file. I suggest you to do that under a Mule project. Creating a project, you can simply be able to use the Mule examples as well. For example, you want to implement a simple web form, just click the Hello example and then you can change the code and have your own logic implemented.
When you use Eclipse, you are saving time. Whenever you change things in your source code and run it on the server, Eclipse will deploy all the jar files and you instantly see the results.
Just keep in mind that you need to run the configuration files and not java files using Eclipse Mule server configuration.

7 February 2011

How to find name of a database in Oracle

You can use any of these commands:
  • SQL> Select name from v$database;
  • SQL> select instance_name from v$instance;
  • SQL> select * from global_name;
  • SQL> SELECT VALUE FROM V$PARAMETER WHERE NAME='db_name';
  • SQL> select to_number(translate(substr(version,1,9),'1.$','1')) from v$instance;
  • SQL> select s.machine from v$session s where s.audsid userenv('sessionid');
  • SQL> select global_name from global_name;

2 February 2011

log4j properties / Java Wrapper Service

Log4J

Debug and Trace in log4j to set here: log4jproperties
It usually can be found in package/conf or some simillar path.
then you set the log4j property as follow:
log4j.logger.net.mycompany=TRACE,mycompany_package_log

Java Wrapper Service

Java wrapper service is a java package that allow you to install and run your java programs as services in windows. When looking at logs generated log4j, you will get some of the followings:
INFO   | jvm 1    | 2011/02/02 10:57:08 | WrapperManager Debug: Send a packet PING : ping
DEBUG  | wrapperp | 2011/02/02 10:57:08 | read a packet PING : ping
DEBUG  | wrapperp | 2011/02/02 10:57:17 | send a packet PING : ping
INFO   | jvm 1    | 2011/02/02 10:57:17 | WrapperManager Debug: Received a packet PING : ping
Apparently this shows that the service is trying to see if there is a live JVM or not, and if not it will uses its own (I guess).

31 January 2011

Mule, the one with the source (MuleSource)

Only one output
One can not configure more than one outbound router for any service defined in mule. The first defined outbound service will be used to dispatch the message.
For example, the following code:

   
   
                   
           

   
   
the chitchatter will never be invoked.
Service name
It seems that the service name in (config.xml or better saying hello-config.xml) does not have anything to do with the flow of the system and is only for the better understanding of user.
Resources:

20 January 2011

PDE-PER001 Internal error

Using oracle form builder, I get this error from time to time when compiling a form. It is said to be because of several forms being open at the same time. So if you get this error, better to close some forms and they try again.
However, I have solved the problem another way. I have one of my forms open in pll format, which was causing the problem. I have closed that form, opened it in fmb or fmx format and then no errors.
Resource:

Create .Jar file using JDeveloper

Unlike eclipse that you can easily export your project into a .Jar file, in JDeveloper, it is not that easy. In Eclipse you just need to use the export option on your project and then let it know where you want your .jar file to be. However, in JDeveloper the story is a little bit different. You need to create a new deployment environment (in project preferences panel) and then from there you should assign where you want your jar file. After doing this step, then you need to right click on your project, then click deploy and you’ll see “to jar file”, tada. Your jar file is ready.
jdeveloper

19 January 2011

FRM-13008 can not Find Java Bean

If you get this error using Oracle Form Builder, you might want to try these ones (one of them, not both necessarily)
  • Set the forms_class_path in the registry and in the environment file and put the files in the right places.
  • If you get that error when invoking the Oracle-Forms Layout-Editor and you are sure the naming of the bean and also the FORMSxx_BUILDER_CLASSPATH variable is set correctly, then you should check with which java-version your bean is compiled. To display it correctly in version 10.x you need JDK 1.4.2_06 or lower. I don't know which version you need for version 11, please comment if you have any information about that.
Resources:

14 January 2011

Oracle Commands (Oracle Application Server)

These are mostly oracle application server commands:
EMCTL
To start and stop the Management Service, the Management Agent, the Grid Control Console, the Application Server Control Console, and the Database Control, you use the Enterprise Manager command-line utility (emctl)
OPMNCTL
opmnctl is the supported tool for starting and stopping all components in an Oracle Application Server instance, with the exception of the Oracle Enterprise Manager 10g Application Server Control Console (Application Server Control Console). opmnctl provides a centralized way to control and monitor Oracle Application Server components from the command line. You can useopmnctl to execute control and monitoring commands across multiple Oracle Application Server instances simultaneously.
opmnctl also enables you to perform operations on a specified Oracle Application Server instance in a cluster or all instances in a cluster using an optional parameter called scope. You can also use the scope option to control an individual Oracle Application Server process.
Experiment
In my observed usage of these commands, they have been used in the following ways:
  • emctl stop
  • emctl start
  • opmnctl status
  • opmnctl start
  • opmnctl startall
  • opmnctl stopall
Resource:

13 January 2011

OID (Oracle Internet Directory)

Using Oracle Internet Directory you will find some profiles that you either need to change or use in order to synchronize from AD (Active Directory). Some of the default profiles are as follow:
  • ActiveImport—The profile for importing changes from Microsoft Active Directory to Oracle Internet Directory by using the DirSync approach
  • ActiveChgImp—The profile for importing changes from Microsoft Active Directory to Oracle Internet Directory by using the USN-Changed approach
  • ActiveExport—The profile for exporting changes from Oracle Internet Directory to Microsoft Active Directory
 
For synchronizing between AD and OID, you need to use Directory Integration and Provisioning Assistant. It can be done in two different way:
  • To invoke the Assistant as a command-line tool enter dipassistant.
  • To invoke the Assistant as a graphical interface tool, enter the following command:
    $ORACLE_HOME/bin/dipassistant -gui

 
Some mapping examples:
If you plan to synchronize only the cn=users container under dc=us,dc=mycompany,dc=com, then the domain mapping rule is: Distinguished Name Rules
cn=users,dc=us,dc=mycompany,dc=com:cn=users,dc=us,dc=mycompany,dc=com

This rule synchronizes every entry under cn=users,dc=us,dc=mycompany,dc=com. However, the type of object synchronized under this container is determined by the attribute-level mapping rules that follow the DN Mapping rules.

If you plan to synchronize the entry cn=groups,dc=us,dc=mycompany,dc=com under  cn=users,dc=us,dc=mycompany,dc=com then the domain mapping rule is as follows:
cn=groups,dc=us,dc=mycompany,dc=com: cn=users,dc=us,dc=mycompany,dc=com
 

Synchronizing Deletions from Microsoft Active Directory

Active Directory deletions can be synchronized with Oracle Internet Directory by querying for them in Active Directory. The way to do this depends on whether you are using the DirSync approach or the USN-Changed approach. (Section 18.3.2.7 of http://download.oracle.com/docs/cd/B14099_19/idmanage.1012/b14085/odip_actdir003.htm)
 
Resources:

7 January 2011

SID in Oracle (& JDBC)

There can be more than one Oracle instance on a single machine. In order to be able to distinguish these instances, Oracle uses a SID (System Identifier) which is a string. The SID can be set through the ORACLE_SID environment variable.
D:\oracle\product\10.1.0>set ORACLE_SID=ORA10
On Windows, each instance requires a Windows service. This service must first be created with oradim: D:\oracle\product\10.1.0\Db_1>oradim -new -sid %ORACLE_SID% -intpwd MYSECRETPASSWORD -startmode M

5 January 2011

ORA-12514 – Solution

I was trying to connect to database using the following URL : jdbc:oracle:thin:@//dbs03.~~~~.ca:1521/database_name_dev while JDBC needs an SID to connect to and not a database name or TSN name. Not sure how should you find it out what an SID is for a given database for now, but after changing it to jdbc:oracle:thin:@//dbs03.~~~~.ca:1521/db03, I could connect to database.

ORA-12514

ORA-12514: TNS:listener does not currently know of service requested in connect descriptor.

I have encountered this problem using OC4J. I was trying to connect to a database using JDBC (via OC4J) while caught this error. I have searched a little bit online about this one and it seems it is a general error of oracle saying that there is something wrong with the listener or your database credentials. The connection was able to be established, but something was wrong in getting the data. It might be your credentials, might be any other thing.
If you want to know a little bit more in detail you might want to check the solutions to it at this page.
Cause:
The listener received a request to establish a connection to a database or other service. The connect descriptor received by the listener specified a service name for a service (usually a database service) that either has not yet dynamically registered with the listener or has not been statically configured for the listener. This may be a temporary condition such as after the listener has started, but before the database instance has registered with the listener.
Action:
  • Wait a moment and try to connect a second time.
  • Check which services are currently known by the listener by executing: lsnrctl services
  • Check that the SERVICE_NAME parameter in the connect descriptor of the net service name used specifies a service known by the listener.
  • If an easy connect naming connect identifier was used, check that the service name specified is a service known by the listener.
  • Check for an event in the listener.log file.