Unable to load extension class ?

JSR 223

Here is an extract describing this topic :

Servlet specification (Servlet 2.4, JSR-154, is the latest version) defines the set of core abstractions that are used by Java developer writing Web Applications. These abstractions include those of Web Application context, session, request, response, etc. When Java developers write Web Applications, they write classes that interact with these objects in well defined security, resource and class loader contexts. The proposed specification will describe which of these Java objects will be exposed to pages written in other scripting languages. The specification will be grounded on at least one concrete scripting language example, PHP, but the concepts will remain independent of the scripting language and, if at all possible, the EG will also explore the bindings to at least another scripting language. The EG will also explore the case where the Java objects may not be associated with a specific Web application but may just be instantiated in a Java Virtual Machine.

The specification may include a Java API that can be used, possibly through JNI, by an scripting language engine to access the desired Java objects.

This specification will describe how it is possible to bundle scripting pages into a WAR file, either stand-alone, or as part of an EAR. The specification will describe the different implications for security, resource, and class loader contexts both in the case of stand-alone WARs and as part of an EAR. The EG will also consider whether it is appropriate to deliver scripting and Java code outside of a WAR.

The specification may describe how scripting pages can be denoted as such in a WAR in a manner that is easily identified using only the machinery in any standard Servlet container. For instance, it may be appropriate to define a standard Servlet per scripting language; this would allow a WAR to indicate in its web.xml descriptor which files are in a given scripting language. The EG may decide that a container that follows this JSR can use a different mechanism, like a default extension value, to determine that a page is an scripting language known to the container.


Picture 1Starting in groovy version 2.1.4 and later, we have this additional scripting language extension feature offered for the java and groovy community. This feature is only available for users with installed java JVM versions 1.6+ so if, like me, you’re still running jdk 1.5, we’re out of luck.


Jun 12, 2013 4:26:55 PM org.codehaus.groovy.runtime.m12n.SimpleExtensionModule getMetaMethods 
WARNING: Module [groovy-jsr223] - Unable to load extension class [class org.codehaus.groovy.jsr223.ScriptExtensions] due to [javax/script/ScriptEngine]. 
Maybe this module is not supported by your JVM version. 

Jun 12, 2013 4:26:55 PM org.codehaus.groovy.runtime.m12n.SimpleExtensionModule getMetaMethods WARNING: Module [groovy-jsr223] - Unable to load extension class [class org.codehaus.groovy.jsr223.ScriptStaticExtensions] due to [javax/script/ScriptEngineManager]. Maybe this module is not supported by your JVM version. 

Groovy Version: 2.1.4 JVM: 1.5.0_30 Vendor: Apple Inc. OS: Mac OS X

This script extension defines new Java 6 specific groovy methods, so look here for more details :http://groovy.codehaus.org/api/org/codehaus/groovy/jsr223/ScriptExtensions.html

P.S.

What i really meant to say is that your installed version of the java jdk is too old to be able to run the extra new logic that comes with later versions of groovy. Update your installed JDK to jdk 1.6 or later to be able to use these new extensions – thx.

Bash shell script to make another git repository project

Overview

You will need to be using an apple mac or ubuntu linux system to gain the most from this script. It should be possible to do this in windows, but as i do not have one, i can’t advise. The commands shown here are trial commands keyed into a terminal session running the bash shell. It assumes you have already followed part one of this guide to make a github repository named ‘sample’ on your github account.

The idea is to use bash commands to control a remote github system holding your repository. Comment lines below are preceded by double // characters, these lines are remarks that must NOT be keyed. Further comments may follow a command and you can tell these by looking for <–

You will also need the ‘git’ tool installed on your local system.

Note that the term ‘repo’ is a short term for repository – a storage area, typically for text, documents and source code.

// ————————————————–
// new script to make another git repository project
// go to github and make a repository called sample // you will need an SSH public/private security id set up in your keychain – google for this uif you do not already have a set of public/private SSH keys.
// http://blog.blindgaenger.net/generate_github_pages_in_a_submodule.html

// Create a new project here….
// change into the directory of your choice on your local system
cd /Volumes/Media1/Software

// here i ask the remote github server for a full copy of my sample repository that i made in part one of this guide.
// the clone command will create a folder directory named ‘sample’, create some local metadata that git needs to function, and also create an alias name called ‘origin’. This alias name is just a short-cut way to avoid writing the full address of our git repository, like git@github.com:jnorthr/sample.git !
git clone git@github.com:jnorthr/sample.git

// change into the cloned folder
cd sample

//git init

// create an empty file for some of our documentation.
touch README

// edit and save some notes about this project – apple macs use the open command to start an editor session, forgot the ubuntu equivalent command
open -e README

// now we tell the local version control system, git in this case, to include the README file as an artifact to be controlled by git
git add README

// and we tell git that we are ready to mark the current environment as ready-to-go
git commit -m "initial commit"

// if you run git clone above, you will not need this command
git remote add origin git@github.com:jnorthr/sample.git

// time to tell git to send a full copy of our environment back to the github server for user github.com:jnorthr and specifically for the storage facility named sample.git :
git push origin master

// we can construct a documentation area within our ‘sample’ repository. By default, this area is named ‘gh-pages’
// Create an own branch for the gh-pages
cd sample


git symbolic-ref HEAD refs/heads/gh-pages
rm .git/index
git clean -fdx

// build a small index page, we can expand this later
echo "Hi Kids" >> index.html

// tell the local version control system to include all files, etc in the current directory named ‘.’
git add .

// and we tell git that we are ready to mark the current documentation as ready-to-go
git commit -a -m "my first gh-page"

// and here we send our whole document environment to the github server
git push origin gh-pages

// The index.html is empty. But it’s necessary to commit something to make the branch live. If not, you’ll have problems on the next step.

Check page online

Alright, after pushing your files you’re ready to check out the generated site online at an address like http://jnorthr.github.com/sample/
where you replace my name with your github account name, and replace the name ‘sample’ with the name of the repo you built in part one of this guide.

. . .

i’m still working on this section of code as it does not work well just now, so would suggest you stop here and just review the code and links below.

// Add documentation as a submodule in master branch

Now we have two branches called master and gh-pages. The next step is to point the reference for the gh-pages branch to a subdir of master. See http://git-scm.com/book/en/Git-Tools-Submodules

Our submodule will then appear to be part of our hosted project at github.

git checkout master
git submodule add -b gh-pages git@github.com:jnorthr/sample.git _site
git status
git commit -m "added gh-pages as submodule"
git push

Git status reports a new .gitmodules file, with metadata about the submodules. And the _site directory we just specified. Now we initialize the sub-module and confirm it’s version:

git submodule init
git submodule
git status
cd _site
echo "Index Page for _site" >> index.html
git add .
git commit -m "site generated"
git push origin gh-pages
cd ..

// so back at root of project, commit again
git commit -a -m "build site"
git push origin master

// Now both branches should be pushed to github and master _site points to the up to date gh-pages as we would normally do.

Sequence of Steps to Build a New Github Repository

Overview

Logged on to Github

..

Here is your view of github. You will see this display when you have successfully logged into github. It’s an overview of your code repositories. There is a green button at lower right marked ‘New Repository‘. Click that to start the process to make a new storage repository for the new project.

..

Picture 2

..

This panel will appear. The repository name should be short and sweet – not too long. Try ‘sample’ as a name. A description is also useful and will become part of the documentation, so choose wisely. Click the green button marked ‘Create Repository‘. See next image. Picture 3

..

The basic project has been built on the github server. We can also ask for the automatic generation of a small amount of documenation. Look for the ‘Settings‘ choice at the top right of the menu bar. If we click that, it opens the following page. Picture 4

..

..

..

Ok, we can choose some settings here. The ‘Automatic Page Generator‘ button at the lower right of this panel allows us to have some documentation made for us. Picture 5

..

..

..

..

A skeleton page of text is generated. Here we can make changes and improve the text and information for our project. Click the green button marked ‘Continue to Layouts

..

..

..

Picture 6

This panel offers us a preview of what our generated documentation might look like. We also have the opportunity to change the color theme in which our documents are displayed. Click each of the little thumbnail images at the top of this panel to see the effect on the document page, or see that small grey right-arrow button to the right of those thumbnails ? Click that to reveal even more themes. When you’ve made your selection of a theme, you can publish the documentation by clicking the green checkmark at top right of this panel.

..

Picture 7

Picture 8

..

After clicking the publish button, this panel reappears to show us the content of our respository with the newly made assets of our documentation. Note the blue box that shows the website address of this new documentation as ‘Your project page has been created at…’ with an address after that. If you copy that address into your favorite browser and send it you will be greeted with a custom panel of documentation for your project.

* * *

In part two of this writeup, we’ll look into some of the ways we can use scripted commands to construct a github repository.

See Groovy Classpath

I used this code fragment to print my groovy classpath from within a groovy script :


def printClassPath(classLoader) {
  println "$classLoader"
  classLoader.getURLs().each {url->
     println "- ${url.toString()}"
  }
  if (classLoader.parent) {
     printClassPath(classLoader.parent)
  }
}
printClassPath this.class.classLoader

and we can see our full classpath sequence to determine missing / wrong jars ! Like this:

groovy.lang.GroovyClassLoader$InnerLoader@76911d
groovy.lang.GroovyClassLoader@b155b7
org.codehaus.groovy.tools.RootLoader@c51355
- file:/Volumes/Media1/Software/menus/./
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/ant-1.8.4.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/ant-antlr-1.8.4.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/ant-junit-1.8.4.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/ant-launcher-1.8.4.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/commons-logging-1.1.1.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/gpars-1.0.0.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/groovy-2.1.4.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/groovy-ant-2.1.4.jar
- file:/Volumes/Media1/Software/g.4/lib/antlr-2.7.7.jar - file:/Volumes/Media1/Software/groovy-2.1.4/lib/asm-4.0.jar - file:/Volumes/Media1/Software/groovy-2.1.4/lib/asm-analysis-4.0.jar - file:/Volumes/Media1/Software/groovy-2.1.4/lib/asm-commons-4.0.jar - file:/Volumes/Media1/Software/groovy-2.1.4/lib/asm-tree-4.0.jar - file:/Volumes/Media1/Software/groovy-2.1.4/lib/asm-util-4.0.jar - file:/Volumes/Media1/Software/groovy-2.1.4/lib/bsf-2.4.0.jar - file:/Volumes/Media1/Software/groovy-2.1.4/lib/commons-cli-1.2.jar - file:/Volumes/Media1/Software/groovy-2.1roovy-2.1.4/lib/groovy-bsf-2.1.4.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/groovy-console-2.1.4.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/groovy-docgenerator-2.1.4.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/groovy-groovydoc-2.1.4.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/groovy-groovysh-2.1.4.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/groovy-jmx-2.1.4.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/groovy-json-2.1.4.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/groovy-jsr223-2.1.4.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/groovy-servlet-2.1.4.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/groovy-sql-2.1.4.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/groovy-swing-2.1.4.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/groovy-templates-2.1.4.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/groovy-test-2.1.4.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/groovy-testng-2.1.4.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/groovy-xml-2.1.4.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/hamcrest-core-1.3.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/ivy-2.2.0.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/jansi-1.6.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/jcommander-1.27.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/jline-1.0.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/jsp-api-2.0.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/jsr166y-1.7.0.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/junit-4.11.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/qdox-1.12.1.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/servlet-api-2.4.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/testng-6.8.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/xmlpull-1.1.3.1.jar
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/xstream-1.4.2.jar
sun.misc.Launcher$AppClassLoader@a9c85c
- file:/Volumes/Media1/Software/groovy-2.1.4/lib/groovy-2.1.4.jar
sun.misc.Launcher$ExtClassLoader@cc7ad6
- file:/System/Library/Java/Extensions/AppleScriptEngine.jar
- file:/System/Library/Java/Extensions/CoreAudio.jar
- file:/System/Library/Java/Extensions/dns_sd.jar
- file:/System/Library/Java/Extensions/j3daudio.jar
- file:/System/Library/Java/Extensions/j3dcore.jar
- file:/System/Library/Java/Extensions/j3dutils.jar
- file:/System/Library/Java/Extensions/jai_codec.jar
- file:/System/Library/Java/Extensions/jai_core.jar
- file:/System/Library/Java/Extensions/libAppleScriptEngine.jnilib
- file:/System/Library/Java/Extensions/libJ3D.jnilib
- file:/System/Library/Java/Extensions/libJ3DAudio.jnilib
- file:/System/Library/Java/Extensions/libJ3DUtils.jnilib
- file:/System/Library/Java/Extensions/libmlib_jai.jnilib
- file:/System/Library/Java/Extensions/libQTJNative.jnilib
- file:/System/Library/Java/Extensions/libShark.jnilib
- file:/System/Library/Java/Extensions/mlibwrapper_jai.jar
- file:/System/Library/Java/Extensions/MRJToolkit.jar
- file:/System/Library/Java/Extensions/QTJava.zip
- file:/System/Library/Java/Extensions/vecmath.jar
- file:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/ext/apple_provider.jar
- file:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/ext/dnsns.jar
- file:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/ext/localedata.jar
- file:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/ext/sunjce_provider.jar
- file:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/ext/sunpkcs11.jar