Monday, 13 March 2017

Unable to access jenkins URL becuase of java.lang.NoSuchMethodError: org.jvnet.tiger_types.Types.bind

========================================================================
Applies to:
Weblogic: 12.2.1.2
JNEKINS : 2.32.3 (LTS release)
========================================================================
Problem Summary:
Have deployed jenkins (2.32.3 LTS release) application war file on weblogic 12.2.1.2 server for build and deploy automation.
Applicaton status is active and jenkins is fully up and running.

-------- Log snippet ----------------
Mar 13, 2017 4:10:01 PM hudson.WebAppMain$3 run
INFO: Jenkins is fully up and running
-------------------------------------

Though jenkins is fully up and running , we are unable to access jenkins url http://localhost:7001/jenkins

Error:
--------------------- Browser Error -----------------------------
Error 500--Internal Server Error
From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
10.5.1 500 Internal Server Error

The server encountered an unexpected condition which prevented it from fulfilling the request.
--------------------------------------------------------

--------------------- Weblogic Server logs -----------------
<Mar 13, 2017, 4:10:52,250 PM IST> <Error> <HTTP> <BEA-101020> <[ServletContext@1185538388[app:jenkins module:jenkins.war path:null spec-version:3.1]] Servlet failed with an Exception
java.lang.NoSuchMethodError: org.jvnet.tiger_types.Types.bind(Ljava/lang/reflect/Type;Ljava/lang/reflect/GenericDeclaration;Ljava/lang/reflect/ParameterizedType;)Ljava/lang/reflect/Type;
at org.kohsuke.stapler.ClassDescriptor.findMethods(ClassDescriptor.java:155)
at org.kohsuke.stapler.ClassDescriptor.findMethods(ClassDescriptor.java:142)
at org.kohsuke.stapler.ClassDescriptor.<init>(ClassDescriptor.java:84)
at org.kohsuke.stapler.lang.KlassNavigator$1.getFunctions(KlassNavigator.java:216)
at org.kohsuke.stapler.lang.KlassNavigator$1.getFunctions(KlassNavigator.java:141)
Truncated. see log file for complete stacktrace
>
<Mar 13, 2017, 4:10:52,254 PM IST> <Error> <HTTP> <BEA-101107> <[ServletContext@1185538388[app:jenkins module:jenkins.war path:null spec-version:3.1]] Problem occurred while serving the error page.
javax.servlet.ServletException: java.lang.NoSuchMethodError: org.jvnet.tiger_types.Types.bind(Ljava/lang/reflect/Type;Ljava/lang/reflect/GenericDeclaration;Ljava/lang/reflect/ParameterizedType;)Ljava/lang/reflect/Type;
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:391)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:247)
at weblogic.servlet.internal.RequestDispatcherImpl.invokeServlet(RequestDispatcherImpl.java:625)
at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:282)
at weblogic.servlet.internal.ForwardAction.run(ForwardAction.java:22)
Truncated. see log file for complete stacktrace
Caused By: java.lang.NoSuchMethodError: org.jvnet.tiger_types.Types.bind(Ljava/lang/reflect/Type;Ljava/lang/reflect/GenericDeclaration;Ljava/lang/reflect/ParameterizedType;)Ljava/lang/reflect/Type;
at org.kohsuke.stapler.ClassDescriptor.findMethods(ClassDescriptor.java:155)
at org.kohsuke.stapler.ClassDescriptor.findMethods(ClassDescriptor.java:142)
at org.kohsuke.stapler.ClassDescriptor.<init>(ClassDescriptor.java:84)
at org.kohsuke.stapler.lang.KlassNavigator$1.getFunctions(KlassNavigator.java:216)
at org.kohsuke.stapler.lang.KlassNavigator$1.getFunctions(KlassNavigator.java:141)
Truncated. see log file for complete stacktrace
>
------------------------------------------------------------
========================================================================
Root Cause:
Weblogic won't load the JARs in the jenkins WAR before the Weblogic installed JARs which is resulting an error javax.servlet.ServletException: java.lang.NoSuchMethodError: org.jvnet.tiger_types.Types.bind

tiger-types-2.2.jar exists in jenkins.war under WEB-INF/lib

========================================================================
Resolution:
1. Open weblogic deployment descriptor (weblogic.xml) file located under WEB-INF of jenkins.war
2. Add <wls:package-name>org.jvnet.*</wls:package-name> under prefer application packages in weblogic.xml which ensures package 'org.jvnet.*' contained in the Jenkins war is used ahead of the system class loader version. It contains a method required by Jenkins.
------------ weblogic.xml ------------

<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wls="http://www.bea.com/ns/weblogic/90" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic-web-app.xsd">
     <wls:weblogic-version>12.2.1.2</wls:weblogic-version>
     <wls:context-root>jenkins</wls:context-root>
     <wls:container-descriptor>
          <wls:prefer-web-inf-classes>false</wls:prefer-web-inf-classes>
      <wls:prefer-application-packages>
              <wls:package-name>com.google.common.*</wls:package-name>
 <wls:package-name>org.jvnet.*</wls:package-name>
         </wls:prefer-application-packages>
     </wls:container-descriptor>
</wls:weblogic-web-app>
----------------------------------
3. Save. That's it.
4. Now redeploy jenkins.war with a new change. Make sure jenkins application state is active( fully up and running)
5. Try to access jenkins URL.

2 comments:

  1. Thank you, works great! You saved me some time.

    Steve

    ReplyDelete
  2. Hey man. you saved my life :) thanks

    ReplyDelete