cancel
Showing results for 
Search instead for 
Did you mean: 

javascript debugger

billmce
Champ in-the-making
Champ in-the-making
Can someone confirm that the javascript debugger (http://localhost:8080/alfresco/service/api/javascript/debugger) is not working in Community 3.2.

If there is a work-a-round I'd appreciate it … very frustrating trying to develop some scripts in the dark.

Thanks in advance.
13 REPLIES 13

mikeh
Star Contributor
Star Contributor
Works fine - trust me, it's one of the first things we'd notice if it broke!

When you say it's not working, what do you mean? If it's not picking up breakpoints or loading scripts, then try resetting webscripts to clear the cache. The debugger can't attach to scripts after they've been compiled.

Thanks,
Mike

billmce
Champ in-the-making
Champ in-the-making
I'm glad it's working – but this is what we get when trying to start the debugger (on two separate installs of 3.2R).

Alfresco     Web Script Status 500 - Internal Error

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:   03090089 Wrapped Exception (with status template): null
   
Exception:   org.alfresco.web.scripts.WebScriptException - 03090089 Wrapped Exception (with status template): null
   
   org.alfresco.web.scripts.AbstractWebScript.createStatusException(AbstractWebScript.java:613)
   
Server:   Alfresco Community v3.2.0 (r2 2440) schema 3,300
Time:   Apr 9, 2010 11:59:28 AM
   
Diagnostics:   Inspect Web Script (org/alfresco/jsdebugger.post)

If I click on the 'Inspect Web Script' link I get:
Web Script: org/alfresco/jsdebugger.post
Generated from /alfresco/service/script/org/alfresco/jsdebugger.post on Apr 9, 2010 12:02:26 PM

Script Properties
Id:   org/alfresco/jsdebugger.post
Short Name:   Javascript Debugger Maintenance
Description:   Javascript Debugger Maintenance
Authentication:   admin
Transaction:   required
Method:   POST
URL Template:   /api/javascript/debugger?active={active?}
Format Style:   any
Default Format:   html
Negotiated Formats:   [undefined]
Implementation:   class org.alfresco.web.scripts.bean.JavascriptDebuggerPost
Extensions:   [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/templates/webscripts

[No implementation files]

Store: classpath:alfresco/webscripts

File: org/alfresco/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/alfresco/jsdebugger.post.html.ftl

<#import "/org/alfresco/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="${url.context}/images/logo/AlfrescoLogo32.png" 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>

mikeh
Star Contributor
Star Contributor
Anything in the log file? You're not trying to launch the debugger on a headless server by any chance? The debugger uses Java Swing for the GUI.

Thanks,
Mike

billmce
Champ in-the-making
Champ in-the-making
Anything in the log file? You're not trying to launch the debugger on a headless server by any chance? The debugger uses Java Swing for the GUI.

Thanks,
Mike

A lot of binary … in 'less' is shows as ^@ repeated then

16:31:01,960 ERROR [org.alfresco.web.scripts.AbstractRunti
me] Exception from executeScript - redirecting to status template error: 0309010
9 Wrapped Exception (with status template): null
org.alfresco.web.scripts.WebScriptException: 03090109 Wrapped Exception (with status template): null
        at org.alfresco.web.scripts.AbstractWebScript.createStatusException(AbstractWebScript.java:613)
        at org.alfresco.web.scripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:165)
        at org.alfresco.repo.web.scripts.RepositoryContainer$2.execute(RepositoryContainer.java:372)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:327)
        at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:422)
        at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:439)
        at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:303)
        at org.alfresco.web.scripts.AbstractRuntime.executeScript(AbstractRuntime.java:306)
        at org.alfresco.web.scripts.AbstractRuntime.executeScript(AbstractRuntime.java:183)
..snip…

As far as headless goes … we're testing with virtual machines. Linux, Opensuse.  I've worked with it two ways.
a) I've VNC'ed into it.
b) In the VM server console I've started an X session

mikeh
Star Contributor
Star Contributor
Nope, works fine here - again, check you're not on a headless server O/S

Thanks,
Mike

jhsu9
Champ in-the-making
Champ in-the-making
Hi,

I am also a newbie to using Alfresco, and have not been able to enable the debugger in either Alfresco or share (http://127.0.0.1:8080/alfresco/service/api/javascript/debugger or http://127.0.0.1:8080/share/page/api/javascript/debugger).  I am using Windows 7 32-bit, Enterprise Version 3.3.2 on my local workstation/laptop.

Any help would be appreciated, it is difficult to be not be able to debug JS when writing new webscripts.

I get the following error:
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:   10120001 Wrapped Exception (with status template): null
   
Exception:   org.springframework.extensions.webscripts.WebScriptException - 10120001 Wrapped Exception (with status template): null
   
   org.springframework.extensions.webscripts.AbstractWebScript.createStatusException(AbstractWebScript.java:742)
   
Server:   Enterprise v3.3.2 (165) schema 4,015
Time:   Nov 12, 2010 4:17:43 PM
   
Diagnostics:   Inspect Web Script (org/springframework/extensions/webscripts/jsdebugger.post)

And when I click on the diagnostics link I get the following:
Web Script: org/springframework/extensions/webscripts/jsdebugger.post
Generated from /alfresco/service/script/org/springframework/extensions/webscripts/jsdebugger.post on Nov 12, 2010 4:28:45 PM

Script Properties
Id:   org/springframework/extensions/webscripts/jsdebugger.post
Short Name:   Javascript Debugger Maintenance
Description:   Javascript Debugger Maintenance
Authentication:   admin
Transaction:   required
Method:   POST
URL Template:   /api/javascript/debugger?active={active?}
Format Style:   any
Default Format:   html
Negotiated Formats:   [undefined]
Implementation:   class org.springframework.extensions.webscripts.bean.JavascriptDebuggerPost
Extensions:   [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/templates/webscripts

[No implementation files]

Store: classpath:alfresco/enterprise/webscripts

[No implementation files]

Store: classpath:webscripts

File: 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>

kevinr
Star Contributor
Star Contributor
Can you post the complete null ptr exception?

jhsu9
Champ in-the-making
Champ in-the-making
Hi Kevin,

Sorry I assumed the forum would email me if someone replied.  I have an answer to this problem based on help from Alfresco Network Support.  The debugger doesn't work when Alfresco is run as a service.  I made all Alfresco services (alfrescoMySQL, alfrescoOpenOffice, alfrescoTomcat) Manual Start up type, and have 4 files saved in the Alfresco folder that support alfresco start/stop, only thing need to change is the JAVA_HOME in setPaths file.

1.  alf_start.bat:
@echo off
rem —————————————————————————
rem Start script for the Alfresco Server
rem —————————————————————————

call "%~dp0alfresco.bat" start %1

2.  alf_stop.bat:
@echo off
rem —————————————————————————
rem Stop script for the Alfresco Server
rem —————————————————————————

call "%~dp0alfresco.bat" stop %1

3. alfresco.bat
@echo off
rem —————————————————————————
rem Start script for the Alfresco Server
rem —————————————————————————

rem set Alfresco home (includes trailing \  e.g. c:\alfresco\)
set ALF_HOME=%~dps0
set CATALINA_HOME=%ALF_HOME%tomcat

rem Set any default JVM options
set JAVA_OPTS=-Xms512m -Xmx512m -Xss512k -XX:MaxPermSize=256m -XX:NewSize=256m -server -Dalfresco.home=%ALF_HOME% -Dcom.sun.management.jmxremote

rem — If SetPaths.bat already exists - assume set by hand and use as is
set PATH=%ALF_HOME%bin;%PATH%
if not exist "SetPaths.bat" goto getpaths
call SetPaths.bat
goto start

:getpaths
call RegPaths.exe
call SetPaths.bat
del SetPaths.bat

:start
rem — Test for Java settings
set BASEDIR=%CATALINA_HOME%
rem — Reset errorlevel hack
verify >nul
call "%CATALINA_HOME%\bin\setclasspath.bat"
if errorlevel 1 goto error
set PATH=%JAVA_HOME%\bin;%PATH%
rem —————————————
rem Start Components
rem —————————————

if not ""%1"" == ""start"" goto stop

if not exist "%ALF_HOME%mysql\my.ini" goto tomcat
rem —————————————
rem Start MySQL
rem —————————————
echo Starting MySQL…
start "MySQL" "%ALF_HOME%mysql\bin\mysqld" –defaults-file="%ALF_HOME%mysql\my.ini" –basedir="%ALF_HOME%mysql" –datadir="%ALF_HOME%mysql\data" –console

rem Uncomment below to pause for some seconds before starting Tomcat
rem Change 5 to the number of seconds delay required
rem ping 1.0.0.0 -n 5 -w 1000 >NUL

:tomcat
rem —————————————
rem Start Tomcat
rem —————————————

echo Starting Tomcat…
call "%CATALINA_HOME%\bin\startup.bat"

rem ———————————
rem Start Virtualization if available
rem ———————————
rem if exist "~dp0virtual_start.bat" call "~dp0virtual_start.bat"

goto end

:stop

rem —————————————
rem Stop Components
rem —————————————

if not ""%1"" == ""stop"" goto nostop

echo Shutting down Tomcat…
call "%CATALINA_HOME%\bin\shutdown.bat"

if not exist "%ALF_HOME%mysql\my.ini" goto nextstop
if ""%2"" == ""nouser"" goto tomcatwait
set /P pause="Please wait until Tomcat has shut down, then press ENTER to continue…"
goto stopmysql
:tomcatwait
rem Change 10 to the number of seconds delay required
ping 1.0.0.0 -n 10 -w 1000 >NUL

:stopmysql
echo Stopping MySQL…
call "%ALF_HOME%mysql\bin\mysqladmin" -u root shutdown

:nextstop
rem if exist "virtual_start.bat" call virtual_stop.bat

goto end

:error
echo Error encountered.
if ""%2"" == ""nouser"" goto end
set /P pause="Press ENTER to continue…"

:end

4. SetPaths.bat
@ECHO OFF
REM Set Paths Utility - created by installer
SET JAVA_HOME=F:\Apps\Java\jdk1_6


Thanks,
Judy

ghernando
Champ in-the-making
Champ in-the-making
Great!  Thanks Judy.  It worked for me.
I've had this same question posted here for more than a month with no response.

http://forums.alfresco.com/en/viewtopic.php?f=10&t=35431