Monday, August 1, 2011

Build path entry is missing: GROOVY_SUPPORT

in Eclipse, after installing the Groovy Plugin, I add library "Groovy Runtime Libraries" to my project:



If I define (Window/Preferences/Java/BuildPath/Classpath variables)

GROOVY_SUPPORT=C:/Oracle4/Middleware/oepe_11gR1PS3/plugins/org.codehaus.groovy_1.8.0.xx-20110627-1300-e36/lib/groovy-all-1.8.0.jar


all is fine, and my first test of embedding Groovy into Java works:

package com.pierre.osb;

import groovy.lang.Binding;
import groovy.lang.GroovyShell; 

public class GroovyCalloutTest {
 public static void main(String[] args) {
  GroovyCalloutTest test = new GroovyCalloutTest();
  test.run();
 }

 private void run() {
  // call groovy expressions from Java code
  Binding binding = new Binding();
  binding.setVariable("foo", new Integer(2));
  GroovyShell shell = new GroovyShell(binding);

  Object value = shell.evaluate("println 'Hello World!'; x = 123; return foo * 10");
  System.out.println("value=" + value);
  
 }
}



Groovy WSDL Parser

class PVWSDLParser {
 public static void main(String[] args) {
  PVWSDLParser parser = new PVWSDLParser();
  parser.parse("/path/to/your.wsdl");
 }
 
 public void parse(String filename) {
  
  def nsxsd = new groovy.xml.Namespace("http://www.w3.org/2001/XMLSchema", 'xsd')
  def nswsdl = new groovy.xml.Namespace("http://schemas.xmlsoap.org/wsdl/", 'wsdl')
  
  def wsdlDocument = new XmlParser().parse(new File(filename));
  def targetNamespace = wsdlDocument.'@targetNamespace';
  
  def imports = wsdlDocument[nswsdl.types][nsxsd.schema][nsxsd.import];
  imports.each { theimport ->
   System.out.println(theimport.'@schemaLocation');  
   System.out.println(theimport.'@namespace');
  } 
 }
}



A LOT easier than in Java!

ORA-44410: XE edition single instance violation error

I am trying to run Oracle XE on Oracle Virtual Box

/oracle/db/xe/app/oracle/product/10.2.0/server/bin/sqlplus

"Error 6 initializing SQL*Plus
Message file sp1<lang>.msb not found
SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory
"


cd
vi .bash_profile

export ORACLE_BASE=/oracle/db/xe/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/server/
export ORACLE_SID=XE

PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin



source .bash_profile

sqlplus / as sysdba

"connected to an idle instance"

select * from dual
"ORA-01034: ORACLE not available"

startup

"ORA-44410: XE edition single instance violation error"

shutdown abort
"ORACLE instance shut down"

startup
"ORA-44410: XE edition single instance violation error"

GRRRRRR!


lsnrctl status

"Instance "PLSExtProc", status UNKNOWN"


The solution is provided by Paulo (thank you soooo much) in his comment:


I've run into the exactly same problem and made exactly the same mistake:

export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/server/

Remove the trailing backslash from the path. Also add TNS_ADMIN. Here is my complete .bash_profile:

$ cat .bash_profile
export ORACLE_BASE=/usr/lib/oracle/xe/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/server
export ORACLE_SID=XE
export TNS_ADMIN=$ORACLE_HOME/network/admin
export PATH=$PATH:$ORACLE_HOME/bin