Digital Developer Conference: a FREE half-day online conference focused on AI & Cloud – North America: Nov 2 – India: Nov 9 – Europe: Nov 14 – Asia Nov 23 Register now

Close outline
  • United States
IBM?
  • Site map
IBM?
  • Marketplace

  • Close
    Search
  • Sign in
    • Sign in
    • Register
  • IBM Navigation
IBM Developer Answers
  • Spaces
    • Blockchain
    • IBM Cloud platform
    • Internet of Things
    • Predictive Analytics
    • Watson
    • See all spaces
  • Tags
  • Users
  • Badges
  • FAQ
  • Help
Close

Name

Community

  • Learn
  • Develop
  • Connect

Discover IBM

  • ConnectMarketplace
  • Products
  • Services
  • Industries
  • Careers
  • Partners
  • Support
10.190.13.195

Refine your search by using the following advanced search options.

Criteria Usage
Questions with keyword1 or keyword2 keyword1 keyword2
Questions with a mandatory word, e.g. keyword2 keyword1 +keyword2
Questions excluding a word, e.g. keyword2 keyword1 -keyword2
Questions with keyword(s) and a specific tag keyword1 [tag1]
Questions with keyword(s) and either of two or more specific tags keyword1 [tag1] [tag2]
To search for all posts by a user or all posts with a specific tag, start typing and choose from the suggestion list. Do not use a plus or minus sign with a tag, e.g., +[tag1].
  • Ask a question

Wink, server.xml and 404 error for root

120000JNKJ gravatar image
Question by VsV  (3) | Feb 20, 2014 at 05:00 AM wasdevlibertyibmcloudjax-rscontext-rootwink

I am trying to push a WAR application(IBM Liberty by default) with Apache Wink jars but I got an exception:

        *Exception thrown by application class  
'org.apache.wink.common.internal.registry.metadata.ProviderMetadataCollector.parseAccessibleObject:122' 
java.lang.NoSuchMethodError: org/apache/wink/common/internal/utils/GenericsUtils.getClassType(Ljava/lang/reflect/Type;Ljava/lang/Class;)Ljava/lang/Class;*

I fixed this problem locally by adding

             classloader delegation="parentLast"

to server.xml.

But when I pushed it to BlueMix I got

    *The application or context root for this request has not been found: /*

My scenario:

1) From windows machine run:

 cf push

2) My manifest.yml:

--- applications: - name: testwink memory: 512M instances: 1 host: testwink domain: ng.w3.bluemix.net path: ./testwink.zip

env: IBM_JVM_LICENSE: L-XXXX IBM_LIBERTY_LICENSE: L-XXXX

3) In the pushing directory I have:

manifest.yml testwink.zip

testwink.zip : TestApp.war
server.xml

4) My server.xml :

server description="new server" featureManager feature>jsp-2.2/feature feature>localConnector-1.0/feature feature>jaxrs-1.1/feature /featureManager

logging traceSpecification="com.ibm.ws.session.*=debug" consoleLogLevel="INFO" /

httpEndpoint id="defaultHttpEndpoint" httpPort="${port}" host="*"/

webApplication id="testwink" location="TestApp.war" name="testwink" context- root="/" classloader delegation="parentLast"/ /webApplication /server

  • removing context-root="/" did not not help

    Question: How to specify server.xml correctly to BlueMix to avoid Wink and context root errors?

     *Note: under Tomcat or Jetty I could deploy and run the app successfully without any problems(and without server.xml). Apache HttpClient also works fine even under Liberty*
    

  • People who like this

      0
    Comment
    10 |3000 characters needed characters left characters exceeded
    • Viewable by all users
    • Viewable by moderators
    • Viewable by moderators and the original poster

    5 answers

    • Sort: 
    270005NS0Q gravatar image
    Accepted answer

    Answer by SamOdonnell (16) | Feb 20, 2014 at 06:11 AM

    Hi,

    The <webapplication> tag defaults to the "apps" directory:

    http://pic.dhe.ibm.com/infocenter/wasinfo/v8r5/index.jsp?topic=%2Fcom.ibm.websphere.wlp.nd.doc%2Fautodita%2Frwlp_metatype_4ic.html

    "<webapplication id="testwink" location="TestApp.war" name="testwink" context-="" root="/">", would currently be looking for "TestApp.war" in the apps directory, however, the package you are pushing appears to contain only the .war and a server.xml, which would place both of the artifacts in the server directory.

    I believe packaging up your application into the following structure will correct the issue:

    • apps/TestApp.war
    • server.xml

    Sam

    Comment

    People who like this

      0   Show 2   Share
    10 |3000 characters needed characters left characters exceeded
    • Viewable by all users
    • Viewable by moderators
    • Viewable by moderators and the original poster
    270005NS0Q gravatar image SamOdonnell (16)   Feb 20, 2014 at 06:40 AM 0
    Share

    I am glad this has worked.

    On another note if you just wanted to push the application without any extra configuration, you could point the "path" option in the manifest directly to the .war

    path: ./TestApp.war

    This will default the context root to "/".

    270005NS0Q gravatar image SamOdonnell (16)   Feb 20, 2014 at 07:12 AM 0
    Share

    I would not expect to see the manifest.yml file inside of the package, this should live in the directory where you do the push.

    Push directory:

    myPackage.zip
    manifest.yml
    

    myPackage Structure:

    apps/my.war
    server.xml
    

    manifest.yml:


    applications: - name: testwink memory: 512M instances: 1 host: testwink domain: ng.w3.bluemix.net path: ./myPackage.zip

    env: IBM_JVM_LICENSE: L-XXX IBM_LIBERTY_LICENSE: L-XXX

    server.xml:

    <application id="testwink" location="my.war" name="testwink" context-root="/">
    <classloader delegation="parentLast"/>
    </application>
    

    270005NWM2 gravatar image

    Answer by David Whitehouse (286) | Feb 20, 2014 at 05:31 AM

    Hi,

    There are example server.xml files at https://www.ng.bluemix.net/docs/Liberty/LibertyApp.html

    and more detail in the Liberty Buildpack documentation at https://github.com/cloudfoundry/ibm-websphere-liberty-buildpack/blob/master/docs/server-xml-options.md

    Comment

    People who like this

      0   Show 1   Share
    10 |3000 characters needed characters left characters exceeded
    • Viewable by all users
    • Viewable by moderators
    • Viewable by moderators and the original poster
    120000JNKJ gravatar image VsV (3)   Feb 20, 2014 at 05:56 AM 0
    Share

    Thank you! I saw this information but...

    06000206PB gravatar image

    Answer by Brian DePradine (274) | Feb 20, 2014 at 05:34 AM

    What URL did you use to invoke the application? You may find the information here helpful, https://www.ng.bluemix.net/docs/Liberty/LibertyApp.html

    Brian

    Comment

    People who like this

      0   Show 1   Share
    10 |3000 characters needed characters left characters exceeded
    • Viewable by all users
    • Viewable by moderators
    • Viewable by moderators and the original poster
    120000JNKJ gravatar image VsV (3)   Feb 20, 2014 at 05:57 AM 0
    Share

    I used http://testwink.ng.w3.bluemix.net

    06000206PB gravatar image

    Answer by Brian DePradine (274) | Feb 20, 2014 at 06:15 AM

    Your post states that you have zipped up the war file along with the server config. In order to generate a packaged server you must build it using the following command:

    ./bin/server package myServer --include=usr

    Brian

    Comment

    People who like this

      0   Show 2   Share
    10 |3000 characters needed characters left characters exceeded
    • Viewable by all users
    • Viewable by moderators
    • Viewable by moderators and the original poster
    120000JNKJ gravatar image VsV (3)   Feb 20, 2014 at 06:38 AM 0
    Share

    I could but I am trying to use pre-build BlueMix buildpack. See Sam's response above about proper package structure. Thanks

    120000JNKJ gravatar image VsV (3)   Feb 20, 2014 at 06:50 AM 0
    Share

    )) Not solved yet, server.xml just was ignored in such structure.. Sorry

    120000JNKJ gravatar image

    Answer by VsV (3) | Feb 20, 2014 at 07:15 AM

    I push simple project into GitHub

     https://github.com/gmlvsv/BlueMixTest
    

    It contains "Hello World" servlet with server.xml file. To deploy run

        cf push
    

    from your command line.

    After that you cuold check

        /app/.liberty/usr/servers/defaultServer/server.xml
    

    on BlueMix server and it's not updated - just default BlueMix server.xml.

    I think it should be updated from the package one.

    Comment

    People who like this

      0   Show 2   Share
    10 |3000 characters needed characters left characters exceeded
    • Viewable by all users
    • Viewable by moderators
    • Viewable by moderators and the original poster
    270005NS0Q gravatar image SamOdonnell (16)   Feb 20, 2014 at 07:32 AM 0
    Share

    Hi,

    Your manifest is pointing directly to the war so your server.xml is not being included in the push:

    https://github.com/gmlvsv/BlueMixTest/blob/master/BlueMixLibertyTest/manifest.yml
    

    if you change your path from:

     path: ./apps/LibertyRepoWar.war
    
    To:
     path: .
    
    It will push the entire directory including the server.xml

    120000JNKJ gravatar image VsV (3)   Feb 20, 2014 at 08:02 AM 0
    Share

    If I set

      path: .
    

    nothing will be deployed.

    I left

      path: ./myPackage.zip
    

    as you advised before and everything started works correctly : context root and Wink exceptions fixed.

    Thank you very much for help!

    It was not very obvious (for me) from the docs what we have to put WAR into /apps dir and in server.xml set just location="my.war" (without /apps)

    )))))

    Follow this question

    1 person is following this question.

    Answers

    Answers & comments

    Related questions

    Can the Liberty jaxrs-1.1 feature allow me to use the Apache Wink Spring integration? 1 Answer

    2 problems on Liberty JAX-RS 2.0 REST service App. 2 Answers

    jax-rs and "java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory" 1 Answer

    415 Unsupported Media Type in Liberty JAX-RS app on file upload - works fine outside of BlueMix 5 Answers

    Does WAS Liberty Profile support @Singleton resource annotations? 3 Answers

    • Contact
    • Privacy
    • IBM Developer Terms of use
    • Accessibility
    • Report Abuse
    • Cookie Preferences

    Powered by AnswerHub

    Authentication check. Please ignore.
    • Anonymous
    • Sign in
    • Create
    • Ask a question
    • Spaces
    • API Connect
    • Analytic Hybrid Cloud Core
    • Application Performance Management
    • Appsecdev
    • BPM
    • Blockchain
    • Business Transaction Intelligence
    • CAPI
    • CAPI SNAP
    • CICS
    • Cloud Analytics
    • Cloud Automation
    • Cloud Object Storage
    • Cloud marketplace
    • Collaboration
    • Content Services (ECM)
    • Continuous Testing
    • Courses
    • Customer Experience Analytics
    • DB2 LUW
    • Data and AI
    • DataPower
    • Decision Optimization
    • DevOps Build
    • DevOps Services
    • Developers IBM MX
    • Digital Commerce
    • Digital Experience
    • Finance
    • Global Entrepreneur Program
    • Hadoop
    • Hybrid Cloud Core
    • Hyper Protect
    • IBM Cloud platform
    • IBM Design
    • IBM Forms Experience Builder
    • IBM Maximo Developer
    • IBM StoredIQ
    • IBM StoredIQ-Cartridges
    • IIDR
    • ITOA
    • InformationServer
    • Integration Bus
    • Internet of Things
    • Kenexa
    • Linux on Power
    • LinuxONE
    • MDM
    • Mainframe
    • Messaging
    • Node.js
    • ODM
    • Open
    • PartnerWorld Developer Support
    • PowerAI
    • PowerVC
    • Predictive Analytics
    • Product Insights
    • PureData for Analytics
    • Push
    • QRadar App Development
    • Run Book Automation
    • Search Insights
    • Security Core
    • Storage
    • Storage Core
    • Streamsdev
    • Supply Chain Business Network
    • Supply Chain Insights
    • Swift
    • UBX Capture
    • Universal Behavior Exchange
    • UrbanCode
    • WASdev
    • WSRR
    • Watson
    • Watson Campaign Automation
    • Watson Content Hub
    • Watson Marketing Insights
    • dW Answers Help
    • dW Premium
    • developerWorks Sandbox
    • developerWorks Team
    • Watson Health
    • More
    • Tags
    • Questions
    • Users
    • Badges