Data Import IMPDP Failed

So basically i was trying to import a dump file for schema rcemca into schema rcecms. (on a side note: you create schema by creating user. So each user has its own schema). I created the IMPDP_DIR by the following:

create directory IMPDP_DIR as '/home/firman/Downloads'
grant read, write on IMPDP_DIR to rcecms
commit


I then queried the database to makes sure the newly created directory is there
select * from all_directories


It was there.

OWNER       DIRECTORY_NAME
------------------------------ ------------------------------
DIRECTORY_PATH
--------------------------------------------------------------------------------
SYS       EXPDP_DIR
/home/firman/Downloads

SYS       XMLDIR
/u01/app/oracle/product/11.2.0/xe/rdbms/xml

SYS       DATA_PUMP_DIR

/u01/app/oracle/admin/XE/dpdump/

And then I did:
impdp system/password DIRECTORY=IMPDP_DIR DUMPFILE=file.dmp schemas=rcemca remap_schema=rcemca:rcecms


But i got the following error:

ORA-39002: invalid operation
ORA-39070: Unable to open the log file.
ORA-29283: invalid file operation
ORA-06512: at "SYS.UTL_FILE", line 536
ORA-29283: invalid file operation

After some searches i figured out it was because the user oracle, which ultimately runs the necessary steps to import the data, which is different from the user with which i ran the impdp command, has no access to the /home/firman/Downloads directory. A permission problem. This was fixed by changing the permission of /home/firman/Downloads or better still, moving the dump file to the Oracle provided data pump directory, which is DATA_PUMP_DIR (query above).

JNDI Lookup of EJB from stand alone client on JBoss AS 7.1

I followed the examples explained in the following JBoss official links:

https://docs.jboss.org/author/display/AS71/EJB+invocations+from+a+remote+client+using+JNDI

https://docs.jboss.org/author/display/AS71/Remote+EJB+invocations+via+JNDI+-+EJB+client+API+or+remote-naming+project

This is my lookup method:

private static Hello lookupRemoteStatelessCalculator() throws NamingException {
final Hashtable jndiProperties = new Hashtable();
jndiProperties.put("jboss.naming.client.ejb.context", true);
jndiProperties.put(Context.URL_PKG_PREFIXES,
"org.jboss.ejb.client.naming");
jndiProperties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
jndiProperties.put(Context.PROVIDER_URL,"remote://localhost:4447");
// username
jndiProperties.put(Context.SECURITY_PRINCIPAL, "admin");
// password
jndiProperties.put(Context.SECURITY_CREDENTIALS, "password");
final Context context = new InitialContext(jndiProperties);
// The app name is the application name of the deployed EJBs. This is
// typically the ear name
// without the .ear suffix. However, the application name could be
// overridden in the application.xml of the
// EJB deployment on the server.
// Since we haven't deployed the application as a .ear, the app name for
// us will be an empty string
final String appName = "";
// This is the module name of the deployed EJBs on the server. This is
// typically the jar name of the
// EJB deployment, without the .jar suffix, but can be overridden via
// the ejb-jar.xml
// In this example, we have deployed the EJBs in a
// jboss-as-ejb-remote-app.jar, so the module name is
// jboss-as-ejb-remote-app
final String moduleName = "jbosslookup";
// AS7 allows each deployment to have an (optional) distinct name. We
// haven't specified a distinct name for
// our EJB deployment, so this is an empty string
final String distinctName = "";
// The EJB name which by default is the simple class name of the bean
// implementation class
final String beanName = HelloBean.class.getSimpleName();
// the remote view fully qualified class name
final String viewClassName = Hello.class.getName();
// let's do the lookup
System.out.println("ejb:" + appName + "/"
+ moduleName + "/" + distinctName + "/" + beanName + "!"
+ viewClassName);
return (Hello) context.lookup("ejb:" + appName + "/"
+ moduleName + "/" + distinctName + "/" + beanName + "!"
+ viewClassName);

}

You need to have username and password set up on the server as application user. This username and password credential is used by the client when creating the initial context. This information along with other information is passed as Properties argument into the initial context constructor.

And then, you need to have the jboss-client.jar in the classpath of the client.

But  when i ran the client, i kept getting the following exception:


Exception in thread "main" java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/ejb/NoSuchEJBException

It turned out that i need to replace the dependency:

     javax
     javaee-api
     6.0
     provided

With the following JBoss implementation dependency:

         <dependency>
            <groupId>org.jboss.spec</groupId>
            <artifactId>jboss-javaee-6.0</artifactId>
            <version>3.0.2.Final</version>
            <type>pom</type>
            <scope>provided</scope>
       </dependency>

But it was  not enough. JBoss wants me to specify the Xalan dependency too.

        <dependency>
            <groupId>xalan</groupId>
            <artifactId>xalan</artifactId>
            <version>2.7.1</version>
            <scope>provided</scope>
        </dependency> 

Java EE dependency does not have implementation in maven repo, that`s what caused the exception. You also need implementation specific dependency when doing unit tests. I read that this issue is solved in Java EE 7 but i haven`t tested this yet.

Fix Java 7 installation on Mac

So i installed Sun Oracle JDK 7 on my Mac. I unzipped Eclipse into /Applications. I opened launcher, trying to launch Eclipse from there.

But a dialog box popped up asking me to install Java 6 in order to run Eclipse.

This is in part due to Oracle's missing definitions of the JRE7 VM capabilities.

Copy the Info.plist located at the path named below to e.g. ~/Downloads/:
/Library/Java/JavaVirtualMachines/jdk.1.7.<…>/Contents/
and then replace
<key>JVMCapabilities</key>
<array>
<string>CommandLine</string>
</array>
with the following:
<key>JVMCapabilities</key>
<array>
<string>JNI</string>
<string>BundledApp</string>
<string>WebStart</string>
<string>Applets</string>
<string>CommandLine</string>
</array>

Then restart Mac, and problem solved.

http://stackoverflow.com/questions/19563766/eclipse-kepler-for-os-x-mavericks-request-java-se-6/19594116#19594116

Mac keeps showing popup dialog asking password for Local Items in keychain after upgrading to Mavericks

For those having issue with keychain asking for "Local Items" every time after upgrading to Mavericks, and not being able to unlock the keychain lock (asks again for the same unknown password)

Don't even try to repair (it will not work) or Reset my Default Keychain (it will ask for the password). 

Fixes: Go to ~/Library/Keychain and move all files to the trash. Reboot your mac and keychain should give you a message of error, just click to create new keychain. 

https://discussions.apple.com/message/23496232#23496232

Upgrading Mac RAM

I have Virtualbox running CentOS on my Mac, on which i have Oracle XE running (since there`s no Oracle XE for Mac). In addition to that, I have Eclipse, SQL Developer, Chrome, Firefox (both with gwt plugin) running. With only 4GB of RAM, this set up brought my Mac its knees.

I clearly needed to upgrade my RAM.

I notice that Mac has 4 memory slots. 2 are already occupied by default by 2 memory modules, each 2 GB. I bought another 2 modules, each 4 GB, tried to insert them to the vacant slots... and it works! Now i have 12 GB RAM.

RAM manufacturers may vary, but keep frequency (mine is 1333 MHz) the same.


Installing Oracle Express 11g on CentOS

I tried to install Oracle Express 11g on CentOS following steps in this blog:

http://www.davidghedini.com/pg/entry/install_oracle_11g_xe_on

I installed successfully but i was unable to connect to the database. It kept giving me error:

ORA-01031: insufficient privileges

I found the answer in this forum: http://www.orafaq.com/forum/t/169798/0/

Summary:

yum install libaio bc flex net-tools
add your hostname to /etc/hosts
unzip oracle.zip
cd Disk1
rpm -ivh oracle.rpm
/etc/init.d/oracle-xe configure
usermod -a -G dba username (replace username with any username to access db)

all above must be run as root.

And then add envvar ORACLE_HOME and ORACLE_SID to user's ~/.bash_profile (case sensitive!)

export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
export ORACLE_SID=XE

Also add oracle bin to the PATH:

PATH=$PATH:/u01/app/oracle/product/11.2.0/xe/bin

Restart, and now i can log in into sqlplus this way:

sqlplus / as sysdba

I tried to connect to db as user system with the password supplied during oracle-xe configure after installation, i get nasty error saying password invalid. I have to log in as sysdba and set the password of the user system (used in APEX):

alter user system identified by password

And now, setting ssh so i can access my centos from mac.
First check if sshd is already started and listening to port 22:

sudo netstat -tulpn | grep :22

If sshd is already started, then you should see sshd listed there, listening on port 22. If nothing shows up, then start sshd as root:

chkconfig sshd on
service sshd start

Add the following to /etc/sysconfig/iptables if not already present

-A input -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT

And restart iptables

service iptables restart

To connect with SSH from mac host to centos guest virtualbox, activate adapter 2 in virtualbox -> settings -> network.

http://aruljohn.com/info/virtualbox-access-guest-from-host-nat/

Choose host only adapter for adapter 2. In the name drop down list, if none is already present, create one from virtualbox preference.

When this is done, run ifconfig as root from inside centos to find out the ip address to connect to. In my case, the ip address is 192.168.56.102.

Now i can ssh to my centos from my mac.

Open port for Application Manager/Apex and ORCL db. These ports are defined in oracle-xe configure after installation. Add entries in iptables (in my case, apex at 10001 and ORCL db at 1521):

-A input -m state --state NEW -m tcp -p tcp --dport 10001 -j ACCEPT
-A input -m state --state NEW -m tcp -p tcp --dport 1521 -j ACCEPT

Restart iptables:

service iptables restart.

Now i can access oracle db (thru SQL developer) and apex (http://192.168.56.102:10001/apex/f?p=4950) from my mac.

On a related thread, another story...
My mac has a meager RAM of only 4GB. I allocated 1 GB to the centos on virtualbox and when i fire up eclipse, firefox, and sql dev on mac host and oracle db on centos gues, my mac goes down to its knees.

I tried to prune the memory allocated to centos to half its installation size. centos still runs well, but ORCL would not start complaining:

ORA-01034: ORACLE not available ORA-27101: shared memory realm does not exist.

I tried to fiddle with SGA resizing (init.ora) but none works. I decided to do a fresh reinstall of centos and ORCL.

This time, i created centos virtual machine with RAM 512.

I booted it with centos live CD iso. When i get to the desktop, i clicked "install to hard disk" icon. But nothing happened. I learned later that centos would not install thru GUI at 512 MB RAM. So i had to sudo and run the executable symlinked by the install to hard disk icon.

I got a centos installation without GUI. Oracle installation succeeded, but sqlplus would not start with error message of inssuficient permission. I would be happy to have CLI centos and lean ORCL on it, but i simply did not have time to fiddle to get it to work. So i decided to reinstall centos with 768 MB. GUI installation worked, and i get to the above steps.

I will try to find out what cause ORCL to refuse to start when in centos no GUI mode. When i have time. Which is very likely never going to happen. .-))

How to install a jar manually in local maven repository


Problem Statement: Your pom.xml dependencies is not able to download a certain jar from the repository.
Solution:
You can manually download the jar and add it to your local maven repository.
Assuming this dependency (mentioned in pom.xml) fails (because the jar fails to download):

org.hibernate
hibernate-entitymanager
3.3.2.GA

Then download hibernate-entitymanager-3.3.2.GA manually, and run the command:
mvn install:install-file -DgroupId=org.hibernate -DartifactId=hibernate-entitymanager -Dversion=3.3.2.GA -Dpackaging=jar -Dfile=./hibernate-entitymanager-3.3.2.GA.jar
Thats it, you are all set.
From:
http://qnatech.wordpress.com/2011/07/26/how-to-install-a-jar-manually-in-local-maven-repository/