Tuesday, November 27, 2012

JIRA not working in Internet Explorer - JS errors

After upgrading to the lastest version of JIRA (5.2) some users reported that they get errors in Internet Explorer and JIRA is unusable.
The error they saw:

Full error message:
======== Start error log ==========
 
Webpage error details
 
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E; .NET CLR 1.1.4322)
Timestamp: Tue, 27 Nov 2012 09:53:17 UTC
 
 
Message: 'window.Raphael.svg' is null or not an object
Line: 20
Char: 1
Code: 0
URI: https://jira/s/en_USjgiham-418945332/812/95/1/_/download/superbatch/js/batch.js
 
 
Message: 'JIRA.FormDialog' is null or not an object
Line: 1
Char: 13
Code: 0
URI: https://jira/s/en_USjgiham-418945332/812/95/0fe07bcec0e611fd1ab0042e98d11ba6/_/download/contextbatch/js/atl.general/batch.js
 
 
Message: 'JIRA' is null or not an object
Line: 1
Char: 1
Code: 0
URI: https://jira/s/en_USjgiham-418945332/812/95/1.0/_/download/batch/jira.webresources:group-pickers/jira.webresources:group-pickers.js
 
 
Message: 'JIRA' is null or not an object
Line: 1
Char: 14
Code: 0
URI: https://jira/s/en_USjgiham-418945332/812/95/1.0/_/download/batch/jira.webresources:user-pickers/jira.webresources:user-pickers.js
 
 
Message: 'AJS.MultiSelect' is null or not an object
Line: 35
Char: 1
Code: 0
URI: https://jira/s/en_USjgiham-418945332/812/95/1.0/_/download/batch/jira.webresources:jira-fields/jira.webresources:jira-fields.js
 
 
Message: Object doesn't support this property or method
Line: 1
Char: 1
Code: 0
URI: https://jira/s/en_USjgiham-418945332/812/95/1.0.54/_/download/batch/com.atlassian.jira.jira-quick-edit-plugin:quick-form/com.atlassian.jira.jira-quick-edit-plugin:quick-form.js
 
 
Message: 'JIRA.Forms' is null or not an object
Line: 1
Char: 1
Code: 0
URI: https://jira/s/en_USjgiham-418945332/812/95/1.0.54/_/download/batch/com.atlassian.jira.jira-quick-edit-plugin:quick-create-issue/com.atlassian.jira.jira-quick-edit-plugin:quick-create-issue.js
 
 
Message: 'jira.app' is null or not an object
Line: 85
Char: 5
Code: 0
URI: https://jira/s/en_USjgiham-418945332/812/95/1.1.1/_/download/batch/com.atlassian.administration.atlassian-admin-quicksearch-jira:admin-quicksearch-webresources/com.atlassian.administration.atlassian-admin-quicksearch-jira:admin-quicksearch-webresources.js
 
 
======== End error log =========

Solution:
The easiest solution is adding the website to IE's trusted sites' list.
The particular setting that causes the problem is in Internet Options -> Security -> Custom Level -> ActiveX controls and plug-ins -> Binary and script behaviors is not Enabled.

Friday, November 16, 2012

MySQL 5.5 service won't start: Job failed to start

Trying to connect to my local MySQL 5.5 on an Ubuntu Server 12.10 x64 gave me the following error:

   levente@linuxvm:/$ mysql
   ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

Turned out that the MySQL Service is not running.

   levente@linuxvm:/$ ps -ef | grep mysql
   levente 5347 2842 0 08:47 pts/1 00:00:00 grep --color=auto mysql

Trying to start it failed:

   levente@linuxvm:/var/log$ sudo service mysql start
   start: Job failed to start

Syslog shows like this:

   levente@linuxvm:/$ cat /var/log/syslog
   Nov 16 08:28:49 linuxvm kernel: [ 1307.007001] type=1400 audit(1353072529.161:42): apparmor="STATUS" operation="profile_replace" name="/usr/sbin/mysqld" pid=4600 comm="apparmor_parser"
   Nov 16 08:28:50 linuxvm kernel: [ 1308.658583] init: mysql main process (4604) terminated with status 1
   Nov 16 08:28:50 linuxvm kernel: [ 1308.658625] init: mysql main process ended, respawning
   Nov 16 08:28:51 linuxvm kernel: [ 1309.291148] init: mysql post-start process (4605) terminated with status 1
   Nov 16 08:28:51 linuxvm kernel: [ 1309.306516] type=1400 audit(1353072531.461:43): apparmor="STATUS" operation="profile_replace" name="/usr/sbin/mysqld" pid=4651 comm="apparmor_parser"
   Nov 16 08:28:52 linuxvm kernel: [ 1310.791380] init: mysql main process (4655) terminated with status 1
   Nov 16 08:28:52 linuxvm kernel: [ 1310.791400] init: mysql main process ended, respawning
   Nov 16 08:28:53 linuxvm kernel: [ 1311.380212] init: mysql post-start process (4656) terminated with status 1
   Nov 16 08:28:53 linuxvm kernel: [ 1311.395653] type=1400 audit(1353072533.549:44): apparmor="STATUS" operation="profile_replace" name="/usr/sbin/mysqld" pid=4702 comm="apparmor_parser"
   Nov 16 08:28:55 linuxvm kernel: [ 1312.886555] init: mysql main process (4706) terminated with status 1
   Nov 16 08:28:55 linuxvm kernel: [ 1312.886635] init: mysql respawning too fast, stopped


The problem is that I had some incorrect values in /etc/mysql/my.cnf. In my case it was an incorrect bind address that I just uncommented.

  #
  # Instead of skip-networking the default is now to listen only on
  # localhost which is more compatible and is not less secure.
  # bind-address = 172.17.1.1
  #
  levente@linuxvm:/$ sudo start mysql
  mysql start/running, process 5432

Yay!

Monday, November 12, 2012

Unexpected: Failed to get legacy traces

SharePoint Server 2010 Enterprise.

Checking the SharePoint Logs, found the following errors repeating each minute:


OWSTIMER.EXE (0x17A8) 0x3264 SharePoint Foundation Monitoring nasq Medium Entering monitored scope (Timer Job job-diagnostics-io-intensive-query-provider)
OWSTIMER.EXE (0x17A8) 0x3264 Extended Diagnostic Providers SqlTrace Provider 2001 Unexpected Failed to get legacy traces
OWSTIMER.EXE (0x17A8) 0x3264 SharePoint Foundation Timer 6398 Critical The Execute method of job definition Microsoft.SharePoint.Diagnostics.SPIOIntensiveQueryDiagnosticProvider (ID c2f9c9c0-5d41-43a4-98bf-c59b007c3065) threw an exception. More information is included below. You do not have permission to run 'SP_TRACE_CREATE'.
OWSTIMER.EXE (0x17A8) 0x3264 SharePoint Foundation Timer 72ae Unexpected Exception stack trace: at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Bo...
OWSTIMER.EXE (0x17A8) 0x3264 SharePoint Foundation Timer 72ae Unexpected ...olean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at Microsoft.SharePoint.Diagnostics.SqlTraceHelper.CreateTrace() at Microsoft.SharePoint.Diagnostics.SqlTraceStreamer.Init(SqlTraceParameters parameters) at Microsoft.SharePoint.Diagnostics.SPSqlTraceDiagnosticProvider.InitializeBackgroundThreads() at Microsoft.SharePoint.Diagnostics.SPSqlTraceDiagnosticProvider.Sync() at Microsoft.SharePoint.Diagnostics.SPDiagnosticsProvider.Execute(Guid targetInstanceId) at Microsoft.SharePoint.Administration.SPTimerJobInvokeInternal.Invoke(SPJobDefinition jd, Guid targetInstanceId, Boolean isTi...
OWSTIMER.EXE (0x17A8) 0x3264 SharePoint Foundation Timer 72ae Unexpected ...merService, Int32& result)
OWSTIMER.EXE (0x17A8) 0x3264 SharePoint Foundation Monitoring b4ly Medium Leaving Monitored Scope (Timer Job job-diagnostics-io-intensive-query-provider). Execution Time=9.3616

Solution:

Grant the user running the SharePoint 2010 Timer (SPTimerV4) service, which is usually the Farm account, serveradmin or sysadmin rights on the SQL Server. Then, restart the Timer service.

Explanation:

blogs.msdn.com/b/kaevans/archive/2012/02/09/sharepoint-error-6398-you-do-not-have-permission-to-run-sp-trace-create.aspx - great article!

Thursday, November 8, 2012

Some Advanced InfoPath Rules

In this tutorial I will create a "smart" InfoPath form that will change its contents based on some scenarios.

Scenario: 

> employees subscribe each month for some company benefit in the upcoming month.
> subscriptions are open from 24th till the end of the month otherwise closed.
> once an employee has subscribed it cannot subscribe again in that month (show instead a thank you page).

Solution:

This can be achieved by creating a Site Workflow that registers the data into a SharePoint List. The Workflow form is customized with InfoPath. In this post I will insist on the form.

Prerequisites:

1. Have a SharePoint List to store subscriptions. Fields:

  • Person (Person type)
  • MonthTag (String type. It will contain "2012-11" like strings to identify the month when the subscription was made. This will allow easy grouping and filtering for later processing.)
  • SuperscriptionID (String type. Combination of Person Username and MonthTag to determine if a person already subscribed for that month. Its value is calculated by the workflow and filled in at creation. E.g.: "2012-11.Levente.Rog")
  • Any other fields that need input from the user.

2. A Site Workflow that creates the subscription (adds an entry in the above mentioned list). End users will Start the workflow itself (by giving them a link). This Workflow will have the following steps:

  • Generate the Month Tag (2012-11 like strings)
  • Generate SuperscriptionID (2012-11.Levente.Rog -like strings)
  • Create an Item in the Subscriptions List with the previously mentioned values. Using the Workflow Context:Initiator variable we know who is the logged in user so the end user does not have to fill out his own name in the form (that would be lame isn't?)
  • Send a confirmation email
Upon request I can create a tutorial explaining in greater detail covering these workflow steps.


Form Customization


The form of the Workflow is the one that I will customize now.
This is how I managed to solve this scenario:


What I did is I created separate sections for three scenarios (disregard the 201-12. section for now, I will explain that later).

1. First scenario is when registrations are open. Two conditions have to fulfill for this section to show up:

  • Date of month >= 24
  • User has not subscribed yet in the upcoming month


To achieve this, I created the following InfoPath Formatting rules with the action to Hide the section.

  • The expression: number(substring(xdDate:Today(), 9, 2)) < 24



  • Any occurence of Subscription ID is equal to concat(substring(addDays(today(), 30), 1, 7), ".", translate(userName(), "ABCDEFGHIJKLMNOPQRSTUVWYXZ", "abcdefghijklmnopqrstuvwyxz"))

    What I did with that function is:
    Generate the "Month Tag" that is a unique string each month. Since we subscribe for benefits for the next month we calculate one month (addDays 30) forward and crop the first 7 characters from the ISO Date to get a 2012-11-like key. We concatenate that with the lowercase username. This way we'll get something like:
    2012-11.levente.rog . We also record that same string in the SharePoint list as well. This way we know if that user already subscribed for that month.
    - Any occurrence of Subscription ID - we get that by creating a second connection to the same SharePoint List (Data Ribbon -> To SharePoint List). If any of those empty comes out true, the section will be hidden.





2. If the user has already subscribed show a thank you message.
One rule I have here, basically the negated version of rule #2 seen previously:

  • All occurences of Subscription ID are not equal to concat(substring(addDays(today(), 30), 1, 7), ".", translate(userName(), "ABCDEFGHIJKLMNOPQRSTUVWYXZ", "abcdefghijklmnopqrstuvwyxz"))









3. Show a registrations are closed message if date is <= 24th.
This is also a variation, negating the #1 rule used in the first scenario.

  • The expression: number(substring(xdDate:Today(), 9, 2)) >= 24









4. That dummy "2012-12" section is just a calculated value containing the Subscription ID generation formula. For some reason, when I haven't actually used this formula, it was not evaluated in the rule. This section is always hidden from the end user (by creating a dummy rule: myfield does not equal "asdf" => Hide).
  • Calculated Value XPath expression: concat(substring(xdDate:AddDays(xdDate:Today(), 30), 1, 7), ".", translate(xdUser:get-UserName(), "ABCDEFGHIJKLMNOPQRSTUVWYXZ", "abcdefghijklmnopqrstuvwyxz"))





















That's it. Save and Publish.

The workflow is redirected to itself by changing the &Source= parameter in the URL the link to the workflow itself. For example:
http://sptest/Subscriptions/_layouts/IniWrkflIP.aspx?TemplateID={fd570692-3e3e-4c6d-a613-d11932bfc5e2}&Source=http://sptest/Subscriptions/_layouts/IniWrkflIP.aspx?TemplateID={fd570692-3e3e-4c6d-a613-d11932bfc5e2}

After completing the workflow, it will be redirected to itself again, showing the same form. But since the user now is subscribed, the "Thank you" section will show up this time.

Tuesday, November 6, 2012

SharePoint Workflow Cannot Access External List

SharePoint Server 2010.


I set up a Site Workflow that reads some properties of an employee from an external SQL Database.
> created a dbreader user in SQL Server
> added the SQL credentials to Secure Store
> created External Content Type in Designer
> created External List based on the previously created ECT
> user is able to see data in the External List
> created Workflow that reads data from the External List.
> running the Workflow will return empty data for any query from the External List
> following error in the logs

w3wp.exe (0x029C)                         0x3D4C  Secure Store Service            Secure Store                    efr5  High      ValidateCredentialClaims - Access Denied: Claims stored in the credentials did not match with the group claim for a group app.
w3wp.exe (0x029C) 0x3D4C Secure Store Service Secure Store 7493 Critical The Microsoft Secure Store Service application Secure Store Service failed to retrieve credentials. The error returned was 'Access is denied.'. For more information, see the Microsoft SharePoint Products and Technologies Software Development Kit (SDK).
w3wp.exe (0x029C) 0x3D4C Secure Store Service Secure Store efp6 Monitorable GetRestrictedCredentials failed with the following exception: System.ServiceModel.FaultException`1[Microsoft.Office.SecureStoreService.Server.SecureStoreServiceFault]: Access is denied. (Fault Detail is equal to Microsoft.Office.SecureStoreService.Server.SecureStoreServiceFault). &nbsp
w3wp.exe (0x43B8) 0x4320 SharePoint Foundation Workflow Infrastructure el2x Medium The workflow could not find the specified item in the external data source. Make sure the user has permissions to access the external data source and read items.

Solution:

The System Account had no permission over the Secure Store Object to read the credentials to the SQL Server. The System Account is the account which is running the Application Pool .

Central Administration -> Manage Service Applications -> Secure Store Service : Manage -> Edit the application ID -> Next -> Next -> Add the AppPool user to the Members list.


A really nice, detailed guide on Business Connectivity Services can be found here.