cancel
Showing results for 
Search instead for 
Did you mean: 

javascript debugger error

sharifu
Confirmed Champ
Confirmed Champ
When i visit the following link and try o enable the debugger i get an error

http://localhost:8080/alfresco/service/api/javascript/debugger

The Web Script /alfresco/service/api/javascript/debugger has responded with a status of 500 - Internal Error.500 Description: An error inside the HTTP server which prevented it from fulfilling the request.Message:08110007 Wrapped Exception (with status template): No X11 DISPLAY variable was set, but this program performed an operation which requires it.Exception:java.awt.HeadlessException - No X11 DISPLAY variable was set, but this program performed an operation which requires it.java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:159)java.awt.Window.<init>(Window.java:432)java.awt.Frame.<init>(Frame.java:403)javax.swing.JFrame.<init>(JFrame.java:202)org.mozilla.javascript.tools.debugger.SwingGui.<init>(SwingGui.java:152)org.springframework.extensions.webscripts.ScriptDebugger$AlfrescoGui.<init>(ScriptDebugger.java:165)org.springframework.extensions.webscripts.ScriptDebugger.activate(ScriptDebugger.java:86)org.springframework.extensions.webscripts.ScriptDebugger.show(ScriptDebugger.java:104)org.springframework.extensions.webscripts.bean.JavascriptDebuggerPost.executeImpl(JavascriptDebuggerPost.java:61)org.springframework.extensions.webscripts.DeclarativeWebScript.executeImpl(DeclarativeWebScript.java:235)org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:64)org.alfresco.repo.web.scripts.RepositoryContainer$2.execute(RepositoryContainer.java:400)org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:388)org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:462)org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:500)org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:316)org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:372)org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:209)org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:118)javax.servlet.http.HttpServlet.service(HttpServlet.java:717)org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:58)org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:470)org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)java.lang.Thread.run(Thread.java:662)Exception:org.springframework.extensions.webscripts.WebScriptException - 08110007 Wrapped Exception (with status template): No X11 DISPLAY variable was set, but this program performed an operation which requires it.org.springframework.extensions.webscripts.AbstractWebScript.createStatusException(AbstractWebScript.java:970)Server:Community v4.0.0 (4003) schema 5,025Time:11-Sep-2012 11:08:36Diagnostics:Inspect Web Script (org/springframework/extensions/webscripts/jsdebugger.post)‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

When I click on diagnostic link i get the following

Web Script: org/springframework/extensions/webscripts/jsdebugger.postGenerated from /alfresco/service/script/org/springframework/extensions/webscripts/jsdebugger.post on 11-Sep-2012 11:11:14Script PropertiesId:org/springframework/extensions/webscripts/jsdebugger.postShort Name:Javascript Debugger MaintenanceDescription:Javascript Debugger MaintenanceAuthentication:adminTransaction:requiredMethod:POSTURL Template:/api/javascript/debugger?active={active?}Format Style:anyDefault Format:htmlNegotiated Formats:[undefined]Implementation:class org.springframework.extensions.webscripts.bean.JavascriptDebuggerPostExtensions:[undefined]Store: workspace://SpacesStore/app:company_home/app:dictionary/cm:extensionwebscripts[No implementation files]Store: workspace://SpacesStore/app:company_home/app:dictionary/cm:webscripts[No implementation files]Store: classpath:alfresco/extension/templates/webscripts[No implementation files]Store: classpath:alfresco/templates/webscripts[No implementation files]Store: classpath:webscriptsFile: org/springframework/extensions/webscripts/jsdebugger.post.desc.xml <webscript>  <shortname>Javascript Debugger Maintenance</shortname>  <description>Javascript Debugger Maintenance</description>  <url>/api/javascript/debugger?active={active?}</url>  <authentication>admin</authentication></webscript> File: org/springframework/extensions/webscripts/jsdebugger.post.html.ftl <#import "/org/springframework/extensions/webscripts/webscripts.lib.html.ftl" as wsLib/><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml">   <@wsLib.head>Alfresco Javascript Debugger</@wsLib.head>   <body>     <div>      <form action="${url.serviceContext}${url.match}" method="post">         <div>            <input type="hidden" name="visible" value="<#if visible>false<#else>true</#if>" />            <table>               <tr>                  <td><img src="${resourceurl('/images/logo/AlfrescoLogo32.png', true)}" alt="Alfresco" /></td>                  <td><span class="title">Alfresco Javascript Debugger</span></td>               </tr>               <tr><td colspan="2">Alfresco ${server.edition?html} v${server.version?html}</td></tr>               <tr><td colspan="2">Currently <#if visible>enabled<#else>disabled</#if>.                                   <input type="submit" name="submit" value="<#if visible>Disable<#else>Enable</#if>" /></td></tr>            </table>         </div>      </form>      </div>   </body></html> ‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
8 REPLIES 8

afaust
Legendary Innovator
Legendary Innovator
Hello,

the debugger needs a graphical user interface on the server it runs on. For most real servers (running linux / unix without X11 or even an attached terminal), it can not be used. In certain situations on local *nix development boxes, the environment might not be properly configured before starting the Alfresco / Share server.

Please have a look at the first answer to the following question, which is pretty decent: http://stackoverflow.com/questions/662421/no-x11-display-variable-what-does-it-mean

Regards
Axel

sharifu
Confirmed Champ
Confirmed Champ
Didn't work for me

afaust
Legendary Innovator
Legendary Innovator
Then you might provide some basic information on your setup - otherwise nobody from the community may provide more input / tips than is already available on sites like stackoverflow.

sharifu
Confirmed Champ
Confirmed Champ
Alfresco 4.0d installed on "Linux 2.6.18-194.el5 #1 SMP Fri Apr 2 14:58:14 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux"

I tried enabling the debugger where I have ssh into the server using ssh -X … using firefox but does not wok.

the server does not have a graphics display

afaust
Legendary Innovator
Legendary Innovator
Okay,

based on this I'd assume this wouldn't work. The only way I see you might get this to work is by starting the Alfresco server in / from your X-forwarding SSH session, otherwise it will always be attached to the non-existent X11 display.

Regards
Axel

sharifu
Confirmed Champ
Confirmed Champ
Once i logged in to alfresco server using ssh -X ..     I restarted alfresco.  What else should i do?

afaust
Legendary Innovator
Legendary Innovator
It depends on how you start your server. If you use the regular start scripts (/etc/init.d/tomcat6 e.g.), then your server will be started in the background / another session. You might need to run the startup.sh directly for this to work.

Unfortunately, this is where my limited knowledge of X11 comes to its final end.

Since servers regularily don't have a graphic console, I don't like having to depend on the Rhino debugger. Earlier this year I have investigated an alternative for JavaScript debugging, which looks promising. It uses Eclipse and no longer requires a graphical interface on the server. Unfortunately, there a still some changes that need to be made to Alfresco for this to work effectively. See Debugging Alfresco #1 – Eclipse JavaScript Debugger and Alfresco Repository and Script imports with a cleaner API for details.

Regards
Axel

shazada
Star Contributor
Star Contributor
Hi I had the same with a default Alfresco installation.

You need to change the <alfresco>/tomcat/scripts/ctl.sh

Change-Djava.awt.headless=true to false to the JAVA_OPTS

Mine looks like this:
export JAVA_OPTS="-XX:MaxPermSize=512m -Xms128m -Xmx1024m -XX:-DisableExplicitGC -Djava.awt.headless=false -Dalfresco.home=/opt/alfresco-4.0.2 -Dcom.sun.management.jmxremote -Dsun.security.ssl.allowUnsafeRenegotiation=true"‍