NullPointerException when viewing User Profile in Jira Server or Data Center
プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Fisheye および Crucible は除く
プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Fisheye および Crucible は除く
症状
- When viewing a user profile, a NullPointerException is generated.
- When attempting to view an avatar, the same exception is generated.
atlassian-jira.log
に次のエラーが返される。
2012-09-19 16:18:12,258 http-8080-5 ERROR captain.planet 978x1081x1 1unn6n4 10.166.1.14 /secure/ViewProfile.jspa [com.atlassian.velocity.DefaultVelocityManager] MethodInvocationException occurred getting message body from Velocity: java.lang.NullPointerException
java.lang.NullPointerException
at com.opensymphony.module.propertyset.ofbiz.OFBizPropertySet.getKeys(OFBizPropertySet.java:145)
at com.opensymphony.module.propertyset.AbstractPropertySet.getKeys(AbstractPropertySet.java:231)
at com.atlassian.jira.propertyset.JiraCachingPropertySet.getKeys(JiraCachingPropertySet.java:377)
at com.atlassian.jira.user.profile.DetailsUserProfileFragment.getUserProperties(DetailsUserProfileFragment.java:203)
at com.atlassian.jira.user.profile.DetailsUserProfileFragment.createVelocityParams(DetailsUserProfileFragment.java:135)
at com.atlassian.jira.user.profile.AbstractUserProfileFragment.getFragmentHtml(AbstractUserProfileFragment.java:65)
at sun.reflect.GeneratedMethodAccessor856.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:381)
at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:370)
at com.atlassian.velocity.htmlsafe.introspection.AnnotationBoxingMethod.invoke(AnnotationBoxingMethod.java:26)
at com.atlassian.velocity.htmlsafe.introspection.UnboxingMethod.invoke(UnboxingMethod.java:30)
at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:270)
at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:262)
at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:342)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:87)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)
at org.apache.velocity.Template.merge(Template.java:328)
at org.apache.velocity.Template.merge(Template.java:235)
...
原因
An error has caused an update of the user properties to be half-complete, leaving a null in the place of where an object should be.
ソリューション
データベースの変更を行う場合は 必ず事前にバックアップを取得してください。可能な場合はテスト サーバーで変更を試すことをおすすめします。
- Using the Database Integrity Checker, verify if this fixes the problem. If not, continue with the following steps.
- Jira を停止します。
Identify the
NULL
values within thepropertyentry
table with the following SQL:SELECT * FROM propertyentry p JOIN external_entities e ON p.entity_id = e.id WHERE p.id IS NULL OR entity_name IS NULL OR entity_id IS NULL OR property_key IS NULL OR propertytype IS NULL;
In this example, the below was returned:
22359 ExternalEntity 10 jira.user.suppressedTips.focusShifter NULL 10 captain.planet com.atlassian.jira.user.OfbizExternalEntityStore
In order to correct this fix, manipulation of the database will be required. If incorrect updates are made, it can cause data integrity issues, so do so at your own risk. If you're uncertain what to do, please contact Atlassian Support at support.atlassian.com.
After identifying the record within the database, it will need to be updated with an appropriate value. To identify what the value could be, it is necessary to compare it to other records that are working. In this example, this
propertyentry.property_key
has theNULL
. To identify other values in the database, the following SQL can be used. If need be, replacejira.user.suppressedTips.focusShifter
with the value that has theNULL
.SELECT * FROM propertyentry p JOIN external_entities e ON p.entity_id = e.id WHERE property_key = 'jira.user.suppressedTips.focusShifter';
Which in this example has returned the below results:
22359 ExternalEntity 10 jira.user.suppressedTips.focusShifter NULL 10 captain.planet com.atlassian.jira.user.OfbizExternalEntityStore 22559 ExternalEntity 910 jira.user.suppressedTips.focusShifter NULL 910 wonder.woman com.atlassian.jira.user.OfbizExternalEntityStore
As can be seen from these results,
propertyentry.propertytype
of 1 for user wonder.woman is a valid value (provided that user is not experiencing any errors!) and the database can be updated to reflect the value, as below:UPDATE propertyentry SET propertytype = 1 where id = {ID from the problematic record};
- Jira を起動します。
- Test if the user works by replicating the behaviour. If the problem is still present, please restore your backup immediately and raise a Support Request on support.atlassian.com
代替手段
It's also possible to remove the avatar entries directly from the database using the following SQL, however this may not necessarily be the cause. Replace captain.planet
with the user name that requires correcting.
DELETE pn, pe, a
FROM external_entities e
JOIN propertyentry pe
ON e.id = pe.entity_id
JOIN propertynumber pn
ON pe.id = pn.id
JOIN avatar a
ON a.id = pn.propertyvalue
WHERE name = 'captain.planet';
The above is MySQL syntax and may need changing for Oracle or MS SQL. If multiple users require updating, the operator used in the WHERE clause could be replaced with an IN.