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*
Answer by SamOdonnell (16) | Feb 20, 2014 at 06:11 AM
Hi,
The <webapplication> tag defaults to the "apps" directory:
"<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:
Sam
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 "/".
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>
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
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
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
I could but I am trying to use pre-build BlueMix buildpack. See Sam's response above about proper package structure. Thanks
)) Not solved yet, server.xml just was ignored in such structure.. Sorry
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.
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.warTo:
path: .It will push the entire directory including the server.xml
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)
)))))
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