dotCMS 2.3.1 - com.dotcms.portlet example not working

198 views
Skip to first unread message

Andrea Tasca

unread,
Jun 11, 2013, 7:27:58 AM6/11/13
to dot...@googlegroups.com
Hi,
I'm trying to run the example com.dotcms.portlet (you can find it in dotCMS/docs/examples/osgi/com.dotcms.portlet)  on a dotCMS 2.3.1 instance but when I deploy the osgi package I get the error:

ERROR: Bundle com.dotmarketing.osgi.portlet [15] Error starting/stopping bundle. (org.osgi.framework.BundleException: Activator start error in bundle com.dotmarketing.osgi.portlet [15].)
java.lang.UnsupportedOperationException: adding retransformable transformers is not supported in this environment
    at sun.instrument.InstrumentationImpl.addTransformer(InstrumentationImpl.java:88)
    at com.dotmarketing.osgi.UrlOsgiClassLoader.<init>(UrlOsgiClassLoader.java:47)
    at com.dotmarketing.osgi.GenericBundleActivator.injectContext(GenericBundleActivator.java:290)
    at com.dotmarketing.osgi.GenericBundleActivator.injectContext(GenericBundleActivator.java:257)
    at com.dotmarketing.osgi.GenericBundleActivator.registerActionMapping(GenericBundleActivator.java:402)
    at com.dotmarketing.osgi.portlet.Activator.start(Activator.java:27)
    at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:645)
    at org.apache.felix.framework.Felix.activateBundle(Felix.java:2146)
    at org.apache.felix.framework.Felix.startBundle(Felix.java:2064)
    at org.apache.felix.framework.Felix.setBundleStartLevel(Felix.java:1483)
    at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:334)
    at java.lang.Thread.run(Thread.java:722)

Is this example working?

Where can I find a working example of admin portlet?

Best regards,

Andrea

Jason Tesser

unread,
Jun 11, 2013, 9:28:25 AM6/11/13
to dot...@googlegroups.com
That plugin does work. This appears to be JVM related. If you are using IBM JDK maybe you need to add "Can-Retransform-Classes: true" which is needed for IBM Java to use instrumentation.  Maybe something with how your JDK is set up or version. 

But it does work 

Andrea Tasca

unread,
Jun 11, 2013, 10:01:41 AM6/11/13
to dot...@googlegroups.com
Hi,
I've the same problem on my machine (Win7 64 bit, Oracle jdk1.7.0_17) using Eclipse, on my production server (CentOS 6.3 64 bit, Oracle jdk1.7.0_17, Tomcat 7) and on my staging server (CentOS 5.9 64 bit, Oracle  jdk1.7.0_06, Tomcat 7)
Are you sure that plugin works?

Jason Tesser

unread,
Jun 11, 2013, 10:02:50 AM6/11/13
to dot...@googlegroups.com
I am :-)  Maybe something is wrong with your manifest or something. Or you are not using the right version. I will check again but it for sure was working

Jason Tesser

unread,
Jun 11, 2013, 10:04:58 AM6/11/13
to dot...@googlegroups.com
I do think you may need to add the property I sent you. 

Thanks,
Jason S. Tesser
Director, Support Services
dotCMS, Inc.
T: 305.858.1422 x7003
http://twitter.com/dotCMS
www.dotcms.com


--
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+un...@googlegroups.com.
To post to this group, send email to dot...@googlegroups.com.
Visit this group at http://groups.google.com/group/dotcms?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Jason Tesser

unread,
Jun 11, 2013, 2:03:41 PM6/11/13
to dot...@googlegroups.com
Also try to run from the command line AND not from Eclipse. If you need to debug setup remote debugging.  This might fix your issue 

Andrea Tasca

unread,
Jun 13, 2013, 6:28:00 AM6/13/13
to dot...@googlegroups.com
Hi Jason,
can you please tell me where exactly do I have to add "Can-Retransform-Classes: true"?

Thank you.



On Tuesday, June 11, 2013 3:28:25 PM UTC+2, LORDs_diakonos wrote:

Jason Tesser

unread,
Jun 13, 2013, 6:38:50 AM6/13/13
to dot...@googlegroups.com
For us this is only a problem running in Eclipse. If you run from the command line by generating the JAR it should run fine.  If u need to debu maybe set up remote debug 

Andrea Tasca

unread,
Jun 13, 2013, 7:09:43 AM6/13/13
to dot...@googlegroups.com
But I have the same problem on my production server (CentOS 6.3 64 bit, Oracle jdk1.7.0_17, Tomcat 7) and on my staging server (CentOS 5.9 64 bit, Oracle  jdk1.7.0_06, Tomcat 7)
where dotCMS is running from command line. I find it strange that I'm the only one with this problem as I have it on 3 different enviroments with different JVMs.



On Thursday, June 13, 2013 12:38:50 PM UTC+2, LORDs_diakonos wrote:
For us this is only a problem running in Eclipse. If you run from the command line by generating the JAR it should run fine.  If u need to debu maybe set up remote debug 

On Thursday, June 13, 2013, Andrea Tasca wrote:
Hi Jason,
can you please tell me where exactly do I have to add "Can-Retransform-Classes: true"?

Thank you.


On Tuesday, June 11, 2013 3:28:25 PM UTC+2, LORDs_diakonos wrote:
That plugin does work. This appears to be JVM related. If you are using IBM JDK maybe you need to add "Can-Retransform-Classes: true" which is needed for IBM Java to use instrumentation.  Maybe something with how your JDK is set up or version. 

But it does work 

On Tue, Jun 11, 2013 at 7:27 AM, Andrea Tasca <andrea...@gmail.com> wrote:
java.lang.UnsupportedOperationException: adding retransformable transformers is not supported in this environment
    at sun.instrument.InstrumentationImpl.addTransformer(InstrumentationImpl.java:88)


--
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+unsubscribe@googlegroups.com.

Jason Tesser

unread,
Jun 13, 2013, 7:15:15 AM6/13/13
to dot...@googlegroups.com
thing is I see you running in Tomcat 7 and that is weird. We do not ship with this so I assume you did custom things here so maybe that explains it.  Maybe you also are building the plugin different not sure. But we trying Cent and your version of the JDK without issue. 


To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+un...@googlegroups.com.

Andrea Tasca

unread,
Jun 13, 2013, 7:30:32 AM6/13/13
to dot...@googlegroups.com
Sorry I was wrong, dotCMS is running as it is from your installation package without customization, this means Tomcat 6.
Maybe there's something wrong on build process, I'll check this.

Jason Tesser

unread,
Jun 13, 2013, 7:32:59 AM6/13/13
to dot...@googlegroups.com
we tested all over with Java 6 and 7. Even on cent running your version and it always worked. Only when running from Eclipse did we have an issue. 

I assume something is tweaked in your environments. But maybe something with the plugin building also 

Andrea Tasca

unread,
Jun 14, 2013, 1:37:29 PM6/14/13
to dot...@googlegroups.com
Hi
I've tried to compile the plugin com.dotcms.portlet from the command line, using ant,
and run dotCMS, version 2.3.1 downloaded from http://dotcms.com/downloads/index.dot,
from command line on the following platforms:

Mac OSX 10.7.3 64 bit
Oracle JVM Hot Spot 64 bit 1.7.0_10-b18

Windows 8 64 bit
Oracle JVM Hot Spot 64 bit 1.7.0_17-b02

Windows 7 64 bit
Oracle JVM Hot Spot 64 bit 1.7.0_17-b02

CentOS 5.9 64 bit
Oracle JVM Hot Spot 64 bit 1.7.0_07-b10

CentOS 6.3 64 bit
Oracle JVM Hot Spot 64 bit 1.7.0_17-b02

On each platform I've got the same error, I really can't understand what is wrong.
I need to develop a plugin to integrate into dotCMS administration, I've tried to create a my own osgi
plugin from scratch following the example structure but I've got the same problem.
Other kind of osgi plugins are working correctly.

Is there a different way to develop administration plugins?
Do I have to run a different JVM?


This is the Exception generated when plugin is deployed or started from administration (CMS Admin->Dynamic Plugins)

javax.servlet.ServletException: Activator start error in bundle com.dotmarketing.osgi.portlet [11]. Unable to start bundle
        at com.dotmarketing.portlets.osgi.AJAX.OSGIAJAX.start(OSGIAJAX.java:70)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at com.dotmarketing.portlets.osgi.AJAX.OSGIBaseAJAX.service(OSGIBaseAJAX.java:42)
        at com.dotmarketing.portlets.osgi.AJAX.OSGIAJAX.service(OSGIAJAX.java:20)
        at com.dotmarketing.servlets.ajax.AjaxAction.doPut(AjaxAction.java:48)
        at com.dotmarketing.servlets.ajax.AjaxDirectorServlet.service(AjaxDirectorServlet.java:48)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:404)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at com.dotmarketing.filters.CMSFilter.doFilter(CMSFilter.java:122)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at com.dotmarketing.filters.AutoLoginFilter.doFilter(AutoLoginFilter.java:61)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at com.dotmarketing.cms.urlmap.filters.URLMapFilter.doFilter(URLMapFilter.java:87)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at com.dotmarketing.filters.TimeMachineFilter.doFilter(TimeMachineFilter.java:143)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at com.dotmarketing.filters.CharsetEncodingFilter.doFilter(CharsetEncodingFilter.java:140)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:465)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:555)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
        at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)
        at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291)
        at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:769)
        at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:698)
        at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:891)
        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
        at java.lang.Thread.run(Thread.java:722)
Caused by: org.osgi.framework.BundleException: Activator start error in bundle com.dotmarketing.osgi.portlet [11].
        at org.apache.felix.framework.Felix.activateBundle(Felix.java:2196)
        at org.apache.felix.framework.Felix.startBundle(Felix.java:2064)
        at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:955)
        at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:942)
        at com.dotmarketing.portlets.osgi.AJAX.OSGIAJAX.start(OSGIAJAX.java:64)
        ... 44 more
Caused by: java.lang.UnsupportedOperationException: adding retransformable transformers is not supported in this environment
        at sun.instrument.InstrumentationImpl.addTransformer(InstrumentationImpl.java:88)

        at com.dotmarketing.osgi.UrlOsgiClassLoader.<init>(UrlOsgiClassLoader.java:47)
        at com.dotmarketing.osgi.GenericBundleActivator.injectContext(GenericBundleActivator.java:290)
        at com.dotmarketing.osgi.GenericBundleActivator.injectContext(GenericBundleActivator.java:257)
        at com.dotmarketing.osgi.GenericBundleActivator.registerActionMapping(GenericBundleActivator.java:402)
        at com.dotmarketing.osgi.portlet.Activator.start(Activator.java:27)
        at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:645)
        at org.apache.felix.framework.Felix.activateBundle(Felix.java:2146)
        ... 48 more

Jason Tesser

unread,
Jun 14, 2013, 1:44:13 PM6/14/13
to dot...@googlegroups.com
you can do it in a regular static plugin.  If you are an Enterprise client and have Support the support desk should be able to help.  I know the plugin works and have setup multiple environments with it working.  I am not sure why it doesn't work for you.  I have seen your issue but only in Eclipse and not when running from the command line and I have for sure run on the environments you are running on. 


Andrea Tasca

unread,
Jun 15, 2013, 7:32:56 AM6/15/13
to dot...@googlegroups.com
Hi,
at the end I've found the solution, definitely IT IS A DOTCMS BUG, how can it work for you?
Look at dotCMS/WEB-INF/lib/jamm-0.2.5.jar manifest (MANIFEST.MF), it is wrong!
This is the manifest of jamm-0.2.5.jar shipped with dotCMS 2.3.1

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.2
Created-By: 1.6.0_38-b05 (Sun Microsystems Inc.)
Premain-Class: org.github.jamm.MemoryMeter
Can-Redefine-Classes: true
Can-Retransform-Classe: true


See http://docs.oracle.com/javase/6/docs/api/java/lang/instrument/package-summary.html

look at MANIFEST.MF Line 6:
Can-Retransform-Classe: true  ======> Stupid error

To fix the problem download Jamm from https://github.com/jbellis/jamm and build it (ant jar) using the following build.xml

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project
  basedir = "."
  default = "build"
  name = "jamm"
  xmlns:ivy = "antlib:org.apache.ivy.ant">
  <property name = "debuglevel" value = "source,lines,vars"/>
  <property name = "version" value = "0.2.5"/>
  <property name = "basedir" value = "."/>
  <property name = "build.src" value = "${basedir}/src"/>
  <property name = "build.dir" value = "${basedir}/build"/>
  <property name = "build.lib" value = "${basedir}/build/lib"/>
  <property name = "build.classes" value = "${build.dir}/classes"/>
  <property name = "jar.name" value = "jamm-${version}.jar"/>
  <property name = "test.src" value = "${basedir}/test"/>
  <property name = "test.classes" value = "${build.dir}/test/classes"/>
  <property name = "test.out" value = "${build.dir}/test/output"/>
  <property name = "test.name" value = "*Test"/>
  <property name = "ivy.version" value = "2.1.0"/>
  <property name = "ivy.url" value = "http://repo2.maven.org/maven2/org/apache/ivy/ivy"/>
  <condition property = "ivy.jar.exists">
    <available file = "${build.dir}/ivy-${ivy.version}.jar"/>
  </condition>
  <target name = "ivy-download" unless = "ivy.jar.exists">
    <echo>Downloading Ivy...</echo>
    <mkdir dir = "${build.dir}"/>
    <get
      src = "${ivy.url}/${ivy.version}/ivy-${ivy.version}.jar"
      dest = "${build.dir}/ivy-${ivy.version}.jar"
      usetimestamp = "true"/>
  </target>
  <target
    name = "ivy-init"
    depends = "ivy-download"
    unless = "ivy.initialized">
    <mkdir dir = "${build.lib}"/>
    <taskdef
      resource = "org/apache/ivy/ant/antlib.xml"
      uri = "antlib:org.apache.ivy.ant"
      classpathref = "autoivy.classpath"/>
    <property name = "ivy.initialized" value = "true"/>
  </target>
  <target name = "ivy-retrieve-build" depends = "ivy-init">
    <ivy:retrieve
      type = "jar,source"
      sync = "true"
      pattern = "${build.lib}/[type]s/[artifact]-[revision].[ext]"/>
  </target>
  <path id = "autoivy.classpath">
    <fileset dir = "${build.lib}">
      <include name = "**/*.jar"/>
    </fileset>
    <pathelement location = "${build.dir}/ivy-${ivy.version}.jar"/>
  </path>
  <target name = "init" depends = "ivy-retrieve-build">
    <mkdir dir = "${build.classes}"/>
    <mkdir dir = "${test.classes}"/>
  </target>
  <target name = "clean">
    <delete dir = "${build.classes}"/>
    <delete dir = "${test.classes}"/>
    <delete dir = "${test.out}"/>
  </target>
  <target depends = "init" name = "build">
    <echo message = "${ant.project.name}: ${ant.file}"/>
    <javac
      debug = "true"
      debuglevel = "${debuglevel}"
      destdir = "${build.classes}">
      <src path = "${build.src}"/>
    </javac>
  </target>
  <target name = "jar" depends = "build">
    <jar jarfile = "${build.dir}/${jar.name}" basedir = "${build.classes}">
      <manifest>
        <!--see http://download.oracle.com/javase/6/docs/api/java/lang/instrument/package-summary.html -->
        <attribute name = "Premain-Class" value = "org.github.jamm.MemoryMeter"/>
        <attribute name = "Can-Redefine-Classes" value = "true"/>
        <attribute name = "Can-Retransform-Classes" value = "true"/>

      </manifest>
    </jar>
  </target>
  <target
    name = "build-test"
    depends = "jar"
    description = "Compile test classes">
    <javac
      debug = "true"
      debuglevel = "${debuglevel}"
      destdir = "${test.classes}">
      <classpath>
        <path refid = "autoivy.classpath"/>
        <pathelement location = "${build.classes}"/>
      </classpath>
      <src path = "${test.src}"/>
    </javac>
  </target>
  <target name = "test" depends = "build-test">
    <echo message = "running tests"/>
    <mkdir dir = "${test.out}"/>
    <junit fork = "on" failureproperty = "testfailed">
      <formatter type = "xml" usefile = "true"/>
      <formatter type = "brief" usefile = "false"/>
      <classpath>
        <path refid = "autoivy.classpath"/>
        <pathelement location = "${build.classes}"/>
        <pathelement location = "${test.classes}"/>
      </classpath>
      <jvmarg value = "-ea"/>
      <jvmarg value = "-javaagent:${build.dir}/${jar.name}"/>
      <batchtest todir = "${test.out}">
        <fileset dir = "${test.classes}" includes = "**/${test.name}.class"/>
      </batchtest>
    </junit>
    <fail if = "testfailed" message = "Some test(s) failed."/>
  </target>
</project>


Replace dotCMS/WEB-INF/lib/jamm-0.2.5.jar  with the new jamm-0.2.5.jar and this fixes the problem, in Eclipse too!!!

I hope the next release of dotCMS will fix it!

Jason Tesser

unread,
Jun 15, 2013, 7:44:32 AM6/15/13
to dot...@googlegroups.com
I understand but for us in many environments the Manifest was being picked up properly as the manifest can come from many of the jars.  Its not the only one.  We obviously didn't build that jar ourselves. 

I am glad to fixed it for you though. 

On Sat, Jun 15, 2013 at 7:32 AM, Andrea Tasca <andrea...@gmail.com> wrote:
Can-Retransform-Classe


Jason Tesser

unread,
Jun 15, 2013, 7:45:49 AM6/15/13
to dot...@googlegroups.com
Also Andrea remember in the beginning I was telling you that I suspected something was wrong with Can-Retransform-Classes for you. 

Again no worries glad it is working for you now. 

Nathan Keiter

unread,
Nov 16, 2013, 4:23:01 PM11/16/13
to dot...@googlegroups.com
Andrea, is this a general fix for the problem or specific to your project?

I am getting the same error on 2.5.1 when compiling with ant.

Neither the supplied demo nor my custom plugin work.

Log output:

ERROR: Bundle com.dotmarketing.osgi.portlet [14] Error starting/stopping bundle. (org.osgi.framework.BundleException: Activator start error in bundle com.dotmarketing.osgi.portlet [14].)

java.lang.UnsupportedOperationException: adding retransformable transformers is not supported in this environment
at sun.instrument.InstrumentationImpl.addTransformer(InstrumentationImpl.java:88)
at com.dotmarketing.osgi.UrlOsgiClassLoader.<init>(UrlOsgiClassLoader.java:47)
at com.dotmarketing.osgi.GenericBundleActivator.injectContext(GenericBundleActivator.java:290)
at com.dotmarketing.osgi.GenericBundleActivator.injectContext(GenericBundleActivator.java:257)
at com.dotmarketing.osgi.GenericBundleActivator.registerActionMapping(GenericBundleActivator.java:402)
at com.dotmarketing.osgi.portlet.Activator.start(Activator.java:27)
at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:645)
at org.apache.felix.framework.Felix.activateBundle(Felix.java:2146)
at org.apache.felix.framework.Felix.startBundle(Felix.java:2064)
at org.apache.felix.framework.Felix.setBundleStartLevel(Felix.java:1483)
at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:334)
at java.lang.Thread.run(Thread.java:724)

Thanks,

Nathan


Andrea Tasca

unread,
Nov 17, 2013, 5:24:09 AM11/17/13
to dot...@googlegroups.com
Hi Nathan,
this fix works on dotCMS 2.3.x, I think it should work on 2.5.x too but I've never tried it.

Nathan Keiter

unread,
Nov 17, 2013, 11:08:11 PM11/17/13
to dot...@googlegroups.com
Thanks Andrea! That fixed the error.

This thread was also helpful: http://forumarchive.dotcms.com/problem-installing-ver-1-9-5-td5526754.html

The Jamm manifest cannot be read properly unless you start dotCMS from it's home folder. (So make sure to do that after you re-jar Jamm.)

Thanks again,

Nathan

Nathan Keiter

unread,
Nov 18, 2013, 10:52:05 AM11/18/13
to dot...@googlegroups.com
I added a pull request to fix this bug. -> https://github.com/dotCMS/dotCMS/pull/4466

Reply all
Reply to author
Forward
0 new messages