Execute JAR file placed inside Alfresco repository

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2011 05:24 PM
Say I have a JAR file in Company Home/myfolder/myJarFiles/someJar.jar and now I want to execute that JAR form inside Alfresco. Is that possible by the way?
What I'm trying to do, is create an URL out of that JAR file with this (when I enter given URL in browser, it starts downloading a file, so the URL is probably correct):
Is is possible that Alfresco doesn't let me load my own classes dynamically? Is there a cure? Or perhaps it is something totally diiferent…?
Thanks.
What I'm trying to do, is create an URL out of that JAR file with this (when I enter given URL in browser, it starts downloading a file, so the URL is probably correct):
String url = "http://www.mywebsite.com:8080/alfresco" + Utils.generateURL(FacesContext.getCurrentInstance(), new Node(fileInfo.getNodeRef()), URLMode.HTTP_DOWNLOAD);
then use class loader to load jar and create an instance of class:Class klass = Class.forName("my.package.MyClass", true, classLoader);Object myObject = klass.newInstance();
However, I keep getting a ClassNotFoundException in java.security.AccessController.doPrivileged method.Is is possible that Alfresco doesn't let me load my own classes dynamically? Is there a cure? Or perhaps it is something totally diiferent…?
Thanks.
Labels:
- Labels:
-
Archive
1 REPLY 1

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2011 09:05 PM
I got the solution. You need to append ?ticket={YOUR_TICKET} to URL string:
String url = "http://www.mywebsite.com:8080/alfresco" + Utils.generateURL(FacesContext.getCurrentInstance(), new Node(fileInfo.getNodeRef()), URLMode.HTTP_DOWNLOAD) + "?ticket=" + ticket;
and then it successfully loads JAR file.
