Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run war file on tomcat 8 #313

Open
kushNumberTheory opened this issue Jan 16, 2017 · 4 comments
Open

run war file on tomcat 8 #313

kushNumberTheory opened this issue Jan 16, 2017 · 4 comments

Comments

@kushNumberTheory
Copy link

kushNumberTheory commented Jan 16, 2017

HI i have made rest api in scala using play framework. My Routes files include"

 GET     /                           controllers.Application.index 

 GET     /assets/*file                controllers.Assets.at(path="/public", file)
 
 POST   /createfile                @controllers.scala.CaffeOnSpark.FileCreation

Now I added Play2War in my 2.4.1 Play framework. My Build.sbt include

name := "NT_CAFFE"
version := "1.0"
scalaVersion := "2.11.7"
lazy val `NT_CAFFE` = (project in file(".")).enablePlugins(PlayScala)
libraryDependencies ++= Seq( jdbc , cache , ws   , specs2 % Test )
crossScalaVersions := Seq("2.10.4", "2.11.0", "2.11.1", "2.11.7")

My Plugins.sbt includes

logLevel := Level.Warn
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.4.2")
addSbtPlugin("com.github.play2war" % "play2-war-plugin" % "1.4.0")

In play framework , we dont need web.xml. Routes does all the work.
i am able to build war file.. but it includes only lib folder..i mean no classes are there. I copy pasted it in the webapps folder of tomcat and deployed it. But it gives me Action Not found error. Please can you help me with this. What am i missing ?

@dlecan
Copy link
Member

dlecan commented Jan 16, 2017

it includes only lib folder..i mean no classes are there

What do you expect ?

I copy pasted it in the webapps folder of tomcat and
deployed it. But it gives me Action Not found error.

Which URL ? Don't forget root context path in the URL if you didn't install your WAR as root context.

@kushNumberTheory
Copy link
Author

@dlecan When we create jar files.. it includes classes so that we can use jar files on any other system. But in here i didnt got any class. I checked that now its working for GET requests
I tried all POST and GET requests
i am able to use GET requests using
http://localhost:8080/nt_caffe-1.0/
But for POST requests it'snot working
http://localhost:8080/nt_caffe-1.0/createfile

@dlecan
Copy link
Member

dlecan commented Jan 16, 2017

But in here i didnt got any class.

All classes are packaged as jar files, even your Scala files (look at something like nt_caffe-1.0.jar)

i am able to use GET requests using

Great !

But for POST requests it'snot working

If you need help, you have to give us more information: error code, exception ...

@kushNumberTheory
Copy link
Author

In my POST request, i have to send JSON text to tomcat server.Where should i write this JSON text in tomcat server. I mean just like postman we can send data in body while making request. How can i do that in play framework and deploy it to tomcat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants