Support Questions
Find answers, ask questions, and share your expertise

ambari-server start failed after add class in ambari-server

Highlighted

ambari-server start failed after add class in ambari-server

Contributor

After I add class in ambari-server rest package, I start ambari-server failed, and the error message is:

Using python /usr/bin/python Starting ambari-server Ambari Server running with administrator privileges. Organizing resource files at /var/lib/ambari-server/resources... Ambari database consistency check started... No errors were found. Ambari database consistency check finished Server PID at: /var/run/ambari-server/ambari-server.pid Server out at: /var/log/ambari-server/ambari-server.out Server log at: /var/log/ambari-server/ambari-server.log Waiting for server start.................... ERROR: Exiting with exit code -1. REASON: Ambari Server java process died with exitcode 255. Check /var/log/ambari-server/ambari-server.out for more information.

ambari-server.log:

12613-selection-004.png

11 REPLIES 11
Highlighted

Re: ambari-server start failed after add class in ambari-server

Super Mentor

@Zhao Chaofeng

Looks like the main part of the error is missing. Can you please share the ambari-server log ... I guess it will be quite short. because this error is occurring during startup.

I am suspecting that there should be some more previous errors/warnings in your log ... prior to the screenshot message.

Also can you please let us know which class have you added to ambari? And How? (Although adding some classes to ambari provided jars does not look like a right approach, But it will be good to know the reason behind it)

.

Highlighted

Re: ambari-server start failed after add class in ambari-server

Contributor

OK. Thank you for you replying.

Attachment is ambari-server.log and ambari-server.out

ambari-server.tar.gz

Highlighted

Re: ambari-server start failed after add class in ambari-server

Contributor

And I create a class in ambari-server/src/main/java/org/apache/ambari/server/api/rest path named HealthCheck1.java. The content of it is same with HealthCheck.java.

12617-selection-006.png

12618-selection-007.png

Highlighted

Re: ambari-server start failed after add class in ambari-server

Super Mentor

@Zhao Chaofeng

Problem seems to be here:

17 Feb 2017 19:11:44,692 ERROR [main] Errors:168 - The following errors and warnings have been detected with resource and/or provider classes:
  SEVERE: Conflicting URI templates. The URI template /check for root resource class org.apache.ambari.server.api.rest.HealthCheck1 and the URI template /check transform to the same regular expression /check(/.*)?

.

Looks like you added a conflicting "/check" resource root .... inside class "org.apache.ambari.server.api.rest.HealthCheck1" Please try changing it to something else.

.

And the conflict it because ambari provides it's own resource with that template:

https://github.com/apache/ambari/blob/trunk/ambari-server/src/main/java/org/apache/ambari/server/api...

@Path("/check")
public class HealthCheck {
  private static final String status = "RUNNING";
  // This method is called if TEXT_PLAIN is request

.

So in your custom class"org.apache.ambari.server.api.rest.HealthCheck1" you should change it to something like "/check1"

.

Highlighted

Re: ambari-server start failed after add class in ambari-server

Contributor

In addtion, I add a class named RangerRestAPI, the content of it as following:

rangerrestapi.tar.gz

ambari-server starts failed, and the log is same.

Highlighted

Re: ambari-server start failed after add class in ambari-server

Super Mentor

@Zhao Chaofeng

Where is the latest log?

Are you getting the same error as below even after changing the @Path("/check")in your class"org.apache.ambari.server.api.rest.HealthCheck1" ? Have you changed to something like "/check1"

SEVERE: Conflicting URI templates. The URI template /check for root 
resource class org.apache.ambari.server.api.rest.HealthCheck1 and the 
URI template /check transform to the same regular expression 
/check(/.*)?

If the error is slightly different this time then please share that log.

Highlighted

Re: ambari-server start failed after add class in ambari-server

Contributor

ambari-server.tar.gz

Hi, above is the latest ambari server log.

Highlighted

Re: ambari-server start failed after add class in ambari-server

Contributor

the path is not registered?

Highlighted

Re: ambari-server start failed after add class in ambari-server

Super Mentor

@Zhao Chaofeng

This time the issue looks different. Looks like your code "RangerRestAPI.java"

code need to be fixed

  SEVERE: Missing dependency for method public java.lang.String org.apache.ambari.server.api.rest.RangerRestAPI.getResponseBody(java.lang.String,java.lang.String,java.lang.String,java.lang.String) at parameter at index 0
  SEVERE: Missing dependency for method public java.lang.String org.apache.ambari.server.api.rest.RangerRestAPI.getResponseBody(java.lang.String,java.lang.String,java.lang.String,java.lang.String) at parameter at index 1
  SEVERE: Missing dependency for method public java.lang.String org.apache.ambari.server.api.rest.RangerRestAPI.getResponseBody(java.lang.String,java.lang.String,java.lang.String,java.lang.String) at parameter at index 2
  SEVERE: Missing dependency for method public java.lang.String org.apache.ambari.server.api.rest.RangerRestAPI.getResponseBody(java.lang.String,java.lang.String,java.lang.String,java.lang.String) at parameter at index 3

So can you please check if you can use @Consumes or @Produces in your "RangerRestAPI.java"

@Path("/operation")
  public String getResponseBody(final String hostInfo, final String servicePath, final String method, final String jsonString) {

.