Debug Oxygen Java Plugin

Oxygen general issues.
Max
Posts: 55
Joined: Tue Jun 09, 2009 4:47 pm

Debug Oxygen Java Plugin

Post by Max »

Hi,

How to debug Oxygen Java Plugin in Intellij Idea 7.0 ?
The Plugin is made on the basis of Simple Document Framework, from documentation examples.

Best Regards,
Max
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Debug Oxygen Java Plugin

Post by sorin_ristache »

Hello,

You don't have to start it as java application from IntelliJ. You can use the Log4j logging library which comes with Oxygen: configure a Log4j appender (with a file called log4j.properties that you place in the [Oxygen-install-folder]/lib folder or in a folder that you know is included in the classpath of your IntelliJ Java program) that sends logging output from your Oxygen Author extension classes to your preferred location (configured in log4j.properties): standard output, a file on disk, a TCP socket, etc.

Or you can add your own logging library to the classpath of the Oxygen document type (Simple Document Framework in your case) together with your Author extension classes and use it in your extension classes.

If you want to debug your Author extension in Oxygen run as a Java application launched from IntelliJ I think you can place breakpoints in IntelliJ inside your extension classes and stop the execution on them. The launch command line should be like the Java command at the end of the script [Oxygen-install-folder]/oxygen.bat.


Regards,
Sorin
Max
Posts: 55
Joined: Tue Jun 09, 2009 4:47 pm

Re: Debug Oxygen Java Plugin

Post by Max »

Thanx a lot!
Max
Posts: 55
Joined: Tue Jun 09, 2009 4:47 pm

Re: Debug Oxygen Java Plugin

Post by Max »

Hello Sorin.

To debug a program with the help of sockets one needs to point out parametres line:
-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=3500
We want to debug Author Oxygen XML. Where should we point out these parametres?

Regards,
Max
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Debug Oxygen Java Plugin

Post by sorin_ristache »

If you start Author with the script author.bat you should add the parameters in the Java command of the script:

Code: Select all

%OXYGEN_JAVA% -Xss512k -Xmx256m -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=3500 -XX:SoftRefLRUPolicyMSPerMB=10 -Dcom.oxygenxml.app.descriptor=ro.sync.exml.AuthorFrameDescriptor ...
If you start it from a Java IDE you should add your -X parameters to the Java command that start the debugging process.


Regards,
Sorin
Max
Posts: 55
Joined: Tue Jun 09, 2009 4:47 pm

Re: Debug Oxygen Java Plugin

Post by Max »

Thanks a lot! It works!
Kasturi999
Posts: 15
Joined: Fri Jan 08, 2010 2:50 pm

Re: Debug Oxygen Java Plugin

Post by Kasturi999 »

Hi,

I have the same problem with debugging of oxygen code from eclipse.
Can someone please detail me how to do this?

Thanks
Kasturi
adrian
Posts: 2855
Joined: Tue May 17, 2005 4:01 pm

Re: Debug Oxygen Java Plugin

Post by adrian »

Hello Kasturi,

What exactly are you trying to do?
You want to debug the Oxygen Eclipse plugin?

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Kasturi999
Posts: 15
Joined: Fri Jan 08, 2010 2:50 pm

Re: Debug Oxygen Java Plugin

Post by Kasturi999 »

Hi Adrain,

In Oxygen - author mode, there are some operations customized in java for our company.
I would like to debug those java files while navigating in Oxygen as we can do the same in a tomcat application.

IDE is Eclipse.

thanks
adrian
Posts: 2855
Joined: Tue May 17, 2005 4:01 pm

Re: Debug Oxygen Java Plugin

Post by adrian »

Hello,

For Eclipse you have to configure a 'Debug configuration' with the main class ro.sync.exml.Oxygen and add -Xmx256m(or more if needed) to VM arguments.
From Classpath remove the <Project Name>(default classpath) and add the oxygen.jar from your Oxygen installation directory(not from the SDK). Only the JRE and oxygen.jar should remain in the classpath.
In the Source section add the sources of your java project.

In Oxygen make sure in the Document Type of your extension the classpath points to the classes/bin directory of your java project.

Let us know if you encounter any difficulties with this configuration.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Kasturi999
Posts: 15
Joined: Fri Jan 08, 2010 2:50 pm

Re: Debug Oxygen Java Plugin

Post by Kasturi999 »

Hi,

I 've added the "Insert Image Operation" to the menu bar in my Oxygen editor. I am trying to debug the java code for this operation when accessed from Oxygen. I've placed a breakpoint in InsertImageOperation.java at doOperation().

I tried the way you described in the previous post. But the thread gets terminated saying
<terminated>ro.sync.exml.Oxygen at localhost:3547

Thanks
Kasturi999
Posts: 15
Joined: Fri Jan 08, 2010 2:50 pm

Re: Debug Oxygen Java Plugin

Post by Kasturi999 »

Sorry - I got it working now.

It was terminating previously because I 've opened another instance of Oxygen from outside eclipse. Now I've started Oxygen editor from eclipse and it starting working.

Thanks a lot for your help
xsaero00
Posts: 58
Joined: Sat Aug 01, 2009 12:57 am

Re: Debug Oxygen Java Plugin

Post by xsaero00 »

Sorry to resurrect the old thread but I am having bit of problems with setting debugging. I don't have Editor, I just have Author. So I used author.jar instead of oxygen.jar. But when I started it, it asked me for a license. The author license I have did not work so I had to get a trial license for Editor. When I finally started it is said XML Editor in the window title. How do I start Author from Eclipse debugging. Is there a different main class I should use?
adrian
Posts: 2855
Joined: Tue May 17, 2005 4:01 pm

Re: Debug Oxygen Java Plugin

Post by adrian »

Hello,

If you have Oxygen XML Author, you need to also add to the VM Arguments of the debug configuration this parameter:

Code: Select all

-Dcom.oxygenxml.app.descriptor=ro.sync.exml.AuthorFrameDescriptor
Additionally, on Windows platforms for both Editor and Author it might be a good idea to also add:

Code: Select all

-Dsun.java2d.noddraw=true
Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
xsaero00
Posts: 58
Joined: Sat Aug 01, 2009 12:57 am

Re: Debug Oxygen Java Plugin

Post by xsaero00 »

Thank you. That did the trick.
TimWallace
Posts: 10
Joined: Thu Nov 17, 2011 10:49 pm

Re: Debug Oxygen Java Plugin

Post by TimWallace »

I followed all of the above steps and I still get an error indicating that org.apache.log4j.Logger is being searched for. Here is a capture of the error:


java.lang.NoClassDefFoundError: org/apache/log4j/Logger
at ro.sync.util.ib.d(Unknown Source)
at ro.sync.util.ib.b(Unknown Source)
at ro.sync.ui.application.b.i.<clinit>(Unknown Source)
at ro.sync.ui.application.u.<clinit>(Unknown Source)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at ro.sync.exml.Oxygen.main(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Logger
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at ro.sync.util.bc.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 11 more
java.lang.NoClassDefFoundError: org/apache/log4j/Logger
at ro.sync.util.ib.d(Unknown Source)
at ro.sync.util.ib.b(Unknown Source)
at ro.sync.ui.application.b.i.<clinit>(Unknown Source)
at ro.sync.ui.application.u.<clinit>(Unknown Source)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at ro.sync.exml.Oxygen.main(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Logger
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at ro.sync.util.bc.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 11 more
TimWallace
Posts: 10
Joined: Thu Nov 17, 2011 10:49 pm

Re: Debug Oxygen Java Plugin

Post by TimWallace »

I got it working. I had to add back in another JAR beyond what was listed.
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: Debug Oxygen Java Plugin

Post by Radu »

Hi Tim,

That's strange.
The oxygen.jar should have been enough, it is the only JAR used in the oxygen.bat to start Oxygen. Oxygen has its own internal class loader which loads all libraries from the OXYGEN_INSTALL_DIR/lib folder and the log4j.jar should have been found there.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply