Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

"Internal server error" when trying to browse Custom Fields

Sagi February 21, 2019

When I try to access Custom Fields, I get an Internal server error (attached screenshot), and custom fields are not displayed.

This started after trying to add a new custom field.

Trying to figure this out for more than a week but with no luck so far.

Tried the resolution suggested on https://community.atlassian.com/t5/Jira-questions/Internal-server-error-when-open-Custom-Fields/qaq-p/936744 but the query failed.

Any ideas would be appreciated. 

 

Capture.JPG

2 answers

1 accepted

1 vote
Answer accepted
Sagi March 14, 2019

Issue resolved!

Duplicate fields were found and deleted directly from the database.

Xray View Test Execution Screen

Xray View Test Execution Screen This is the view operation screen for Test Execution issue type General NULL 0 customfield_11926
Xray View Test Execution Screen This is the view operation screen for Test Execution issue type General NULL 0 customfield_11926

Xray Default Test Execution Screen

Xray Default Test Execution Screen This is the default screen for the create/edit operations on Test Execution issues Test Execution Details NULL 1 customfield_11926
Xray Default Test Execution Screen This is the default screen for the create/edit operations on Test Execution issues Test Execution Details NULL 1 customfield_11926

My assumption is that something added the same field to the screen which is messing it up as there should never be duplicate fields in the same screen. From here we'll want to remove one. I'm opting that we remove the second entry as that looks to be the newer addition. From here you'll need to remove that entry. Instructions below as reference.

  1. Backup Jira's database and get a XML backup of your Jira.
  2. Shutdown Jira.
  3. select * from fieldscreenlayoutitem where id = 13361;
    select * from fieldscreenlayoutitem where id = 13360;
    • First check for singular item
  4. delete from fieldscreenlayoutitem where id = 13361;
    delete from fieldscreenlayoutitem where id = 13360;
  5. select * from fieldscreen fs JOIN fieldscreentab fst ON fst.fieldscreen = fs.id JOIN fieldscreenlayoutitem fsl ON fsl.fieldscreentab = fst.id WHERE fs.name = 'Xray Default Test Execution Screen'
    select * from fieldscreen fs JOIN fieldscreentab fst ON fst.fieldscreen = fs.id JOIN fieldscreenlayoutitem fsl ON fsl.fieldscreentab = fst.id WHERE fs.name = 'Xray View Test Execution Screen';
    • You can check to see that entry is removed and there are no duplicates on the screens.
  6. Start Jira.
  7. Perform a Lock Jira and reindex.

This should help to return the Screen and Custom Field config back to normal operation.

Additionally, I want to note we have a Suggestion to remove the ability for Java API to creation this condition at JRASERVER-64998: Prevent the same custom field from being added to multiple screen tabs in JIRA's Java API.

Shannon S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 15, 2019

That's great, Sagi! I was following along on the thread. 

Happy to hear that you were able to resolve it in the end.

Take care, and have a pleasant rest of your week.

Regards,

Shannon

0 votes
Shannon S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 22, 2019

Sagi,

We'll need to know exactly what error is causing the problem on your instance, but I don't see that you included any logs.

Could you have a look at your Jira server logs and tell us what errors occur when you visit the Custom Fields page?

I'd also like to know what version of Jira you are using. Thank you!

Regards,

Shannon

Sagi February 22, 2019

Hi Shannon, thank you for your reply.

I'm using Jira 7.13.0.

Here is the relevant log from the attlasian-jira.log:

2019-02-22 15:08:42,600 https-jsse-nio-443-exec-7 WARN sagi 908x904x3 uc8v73 192.168.4.5 /plugins/servlet/streams [c.a.streams.internal.StreamsCompletionService] Registering failure for stream provider Confluence due to error other
2019-02-22 15:09:13,528 https-jsse-nio-443-exec-1 ERROR sagi 909x942x2 445r6h 192.168.4.5 /rest/api/2/customFields [c.a.j.rest.exception.ExceptionInterceptor] Returning internal server error in response
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.atlassian.plugins.rest.common.interceptor.impl.DispatchProviderHelper$ResponseOutInvoker$1.invoke(DispatchProviderHelper.java:192)
... 4 filtered
at com.atlassian.jira.rest.exception.ExceptionInterceptor.intercept(ExceptionInterceptor.java:55)
... 1 filtered
at com.atlassian.jira.rest.v2.issue.scope.RequestScopeInterceptor.intercept(RequestScopeInterceptor.java:39)
... 14 filtered
at com.atlassian.plugins.rest.module.RestDelegatingServletFilter$JerseyOsgiServletContainer.doFilter(RestDelegatingServletFilter.java:154)
... 1 filtered
at com.atlassian.plugins.rest.module.RestDelegatingServletFilter.doFilter(RestDelegatingServletFilter.java:68)
... 32 filtered
at com.atlassian.servicedesk.internal.web.ExternalCustomerLockoutFilter.doFilter(ExternalCustomerLockoutFilter.java:56)
... 13 filtered
at com.atlassian.web.servlet.plugin.request.RedirectInterceptingFilter.doFilter(RedirectInterceptingFilter.java:21)
... 53 filtered
at com.atlassian.jira.security.JiraSecurityFilter.lambda$doFilter$0(JiraSecurityFilter.java:66)
... 1 filtered
at com.atlassian.jira.security.JiraSecurityFilter.doFilter(JiraSecurityFilter.java:64)
... 16 filtered
at com.atlassian.plugins.rest.module.servlet.RestSeraphFilter.doFilter(RestSeraphFilter.java:37)
... 19 filtered
at com.atlassian.jira.servermetrics.CorrelationIdPopulatorFilter.doFilter(CorrelationIdPopulatorFilter.java:30)
... 5 filtered
at com.atlassian.servicedesk.internal.web.CustomerContextSettingFilter.lambda$invokeFilterChain$0(CustomerContextSettingFilter.java:181)
at com.atlassian.servicedesk.internal.api.util.context.ReentrantThreadLocalBasedCodeContext.rteInvoke(ReentrantThreadLocalBasedCodeContext.java:137)
at com.atlassian.servicedesk.internal.api.util.context.ReentrantThreadLocalBasedCodeContext.runOutOfContext(ReentrantThreadLocalBasedCodeContext.java:90)
at com.atlassian.servicedesk.internal.utils.context.CustomerContextServiceImpl.runOutOfCustomerContext(CustomerContextServiceImpl.java:47)
at com.atlassian.servicedesk.internal.web.CustomerContextSettingFilter.outOfCustomerContext(CustomerContextSettingFilter.java:174)
at com.atlassian.servicedesk.internal.web.CustomerContextSettingFilter.doFilterImpl(CustomerContextSettingFilter.java:130)
at com.atlassian.servicedesk.internal.web.CustomerContextSettingFilter.doFilter(CustomerContextSettingFilter.java:121)
... 4 filtered
at com.atlassian.jwt.internal.servlet.JwtAuthFilter.doFilter(JwtAuthFilter.java:32)
... 8 filtered
at com.atlassian.web.servlet.plugin.request.RedirectInterceptingFilter.doFilter(RedirectInterceptingFilter.java:21)
... 4 filtered
at com.atlassian.web.servlet.plugin.LocationCleanerFilter.doFilter(LocationCleanerFilter.java:36)
... 26 filtered
at com.atlassian.jira.servermetrics.MetricsCollectorFilter.doFilter(MetricsCollectorFilter.java:25)
... 24 filtered
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalStateException: Duplicate key com.atlassian.jira.issue.fields.screen.FieldScreenLayoutItemImpl@cc51c983
at java.util.stream.Collectors.lambda$throwingMerger$0(Unknown Source)
at java.util.HashMap.merge(Unknown Source)
at java.util.stream.Collectors.lambda$toMap$58(Unknown Source)
at java.util.stream.ReduceOps$3ReducingSink.accept(Unknown Source)
at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(Unknown Source)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source)
at java.util.stream.AbstractPipeline.evaluate(Unknown Source)
at java.util.stream.ReferencePipeline.collect(Unknown Source)
at com.atlassian.jira.issue.fields.screen.FieldScreenTabImpl$LayoutItems.<init>(FieldScreenTabImpl.java:217)
at com.atlassian.jira.issue.fields.screen.FieldScreenTabImpl$LayoutItems.<init>(FieldScreenTabImpl.java:208)
at com.atlassian.jira.issue.fields.screen.FieldScreenTabImpl.getLayoutItems(FieldScreenTabImpl.java:34)
at com.atlassian.jira.issue.fields.screen.FieldScreenTabImpl.getFieldScreenLayoutItem(FieldScreenTabImpl.java:172)
at com.atlassian.jira.issue.fields.screen.DefaultFieldScreenManager.getFieldScreenTabs(DefaultFieldScreenManager.java:43)
... 3 filtered
at java.lang.reflect.Method.invoke(Unknown Source)
at com.atlassian.plugin.util.ContextClassLoaderSettingInvocationHandler.invoke(ContextClassLoaderSettingInvocationHandler.java:26)
at com.sun.proxy.$Proxy145.getFieldScreenTabs(Unknown Source)
... 3 filtered
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:302)
at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:56)
at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:60)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:133)
at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:121)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:70)
at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:53)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.eclipse.gemini.blueprint.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:57)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:133)
at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:121)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208)
at com.sun.proxy.$Proxy2797.getFieldScreenTabs(Unknown Source)
at com.atlassian.jira.rest.v2.issue.customfield.CustomFieldBeanFactory.from(CustomFieldBeanFactory.java:46)
at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
at java.util.Iterator.forEachRemaining(Unknown Source)
at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Unknown Source)
at java.util.stream.AbstractPipeline.copyInto(Unknown Source)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source)
at java.util.stream.AbstractPipeline.evaluate(Unknown Source)
at java.util.stream.ReferencePipeline.collect(Unknown Source)
at com.atlassian.jira.rest.api.pagination.PageBean$Builder.build(PageBean.java:92)
at com.atlassian.jira.rest.v2.issue.customfield.CustomFieldResource.getCustomFields(CustomFieldResource.java:90)
... 255 more

Shannon S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 22, 2019

Thank you!

In that case, the correct article is indeed CreateIssueMeta returns Duplicate Key error.

Can you show me the query that you ran and the results? 

I would also recommend running the Database Integrity Checker and completing any fixes the page recommends.

Regards,

Shannon

Sagi February 22, 2019

This is the query I ran:

select f.name, i.fieldidentifier, count(*)
from fieldscreen f, fieldscreenlayoutitem i, fieldscreentab t
where f.id = t.fieldscreen
and i.fieldscreentab = t.id
group by f.name, i.fieldidentifier having count(*) > 1;

And the result:

Msg 208, Level 16, State 1, Line 1
Invalid object name 'fieldscreen'.

Also, ran the Integrity Checker, no errors were found.

Shannon S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 27, 2019

Sagi,

That's very odd, but thank you for showing it to me.

Can you just confirm what database version you're using here?

Regards,

Shannon

Sagi February 27, 2019

SQL Server 13.0.4224.16

Shannon S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 1, 2019

Sagi,

Thank you for confirming. So I think from the release number that's MS SQL Version 2016. Can you confirm?

If it can't find the table 'fieldscreen' that's a problem. Can you try to see if the table exists?

exec sp_columns fieldscreen

Please provide the results of that query.

Another thing I thought about is that sometimes the user you create with MS SQL isn't what's required to work with Jira, so it would cause permissions issues when accessing the database.

Can you take a look at Connecting Jira applications to MS SQL 2016 to make sure your database user was set up as expected?

Specifically:

Create a database user which Jira will connect as (e.g. jiradbuser). This user should not be the database owner, but should be in the db_owner role.

Thank you and let me know if you have any questions.

Regards,
Shannon

Sagi March 2, 2019

Yes, it's 2016.

The result for the query:

image.png

Everything beside the issue discussed is working, so I don't think it's a DB user issue, haven't touched it in years.

Shannon S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 4, 2019

Sagi,

The fact that this query came back makes me think that the issue might have been that the proper database wasn't selected.

In the same console open that you used to run the validation query, can you try to run the fix query again? 

Regards,

Shannon

Sagi March 4, 2019

I ran both queries on the same query window (deleted and pasted the last query), so the proper database is selected.

Shannon S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 4, 2019

Sagi,

I'm asking if you can run it again, immediately after the successful validation query. Could you confirm that you've run it again just now?

Shannon

Sagi March 4, 2019

Yes, that’s what I did.

Shannon S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 5, 2019

Sagi,

Thank you for confirming. We're going to need to look deeper at this than we'd be able to on Community, since I'm going to require your logs and support zip.

I've created a support ticket for you. Please take a look at your email now for that ticket number.

Once the issue is resolved, please feel free to come back here and let us know what the resolution was so it can help users in the future.

Regards,

Shannon

Deleted user December 17, 2020

Hi Sapniol,

Here I'm facing the same issue.

 

please suggest me.

 

Thanks 

Pramod 

Deleted user December 17, 2020

I have ran the below query I didn't found any duplicate field in a screen:

select f.name, i.fieldidentifier, count(*)
from fieldscreen f, fieldscreenlayoutitem i, fieldscreentab t
where f.id = t.fieldscreen
and i.fieldscreentab = t.id
group by f.name, i.fieldidentifier having count(*) > 1;

 

Suggest an answer

Log in or Sign up to answer