suzhi
suzhi

Reputation: 161

Play in Production - Secure cannot be resolved to a type

I have developed a little program for myself. After testing and finishing it locally I now wanted to put it on my server.

I get this error:

Compilation error The file /app/controllers/Links.java could not be compiled. Error raised is : Secure cannot be resolved to a type

It is thrown at this line:

@With(Secure.class) 

In the Class Links I have:

   import play.mvc.With; 

   import controllers.*; 

   @With(Secure.class) 

   public class Links extends CRUD { 
   } 

I have installed play 1.2.2 on my server. Play is running probably. I type in the terminal "play start appname" and opened serverIp:9010 to see this error. If I type "play precompile appname" everything seems to work.

In the subfolder /modules of the app I have two text files, one "crud" and one "secure" which point to the modules location on the server. I also have defined the modules in dependencies.yml like this:

require: 
    - play 
    - crud 
    - secure 

In the application.conf I have a Production definition for my server with the proper Server-ID like this:

%server1.application.mode=PROD 

Any idea why this isn't working?

Upvotes: 4

Views: 6395

Answers (5)

consciouswebmaster
consciouswebmaster

Reputation: 1

I had the same problem in my development environment, but not in my production server. I tried to solve by the module documentation, the accepted answer here, and many others with no success.

My solution was to download again play framework (1.2.7) and replacing it in the path where I installed first.

Hope this can guide someone else with the same issue.

Regards.

Upvotes: 0

Mahir Zukic
Mahir Zukic

Reputation: 532

I had to insert this line to application.config

module.secure=${play.path}/modules/secure

Upvotes: 0

0xPixelfrost
0xPixelfrost

Reputation: 10444

Sometimes you have to refesh the classpath settings by using play eclipsify again. (depends on the IDE you are using)

Upvotes: 0

suzhi
suzhi

Reputation: 161

I have solved it. For future reference:

I had an old process of play running. Found it with ps -aux and then kill PID. After that I started the application again with play start.

It's now running fine :)

Thanks for you help!

Upvotes: 4

oxymesis
oxymesis

Reputation: 341

Declaring the secure module in dependencies.yml file is the first step.

Next you have to type the shell command "play dependencies" in order to resolve them.

Just have a glance on the documentation here : http://www.playframework.org/documentation/1.2.2/dependency#Theplaydependenciescommand

Have fun with Play!

Upvotes: 3

Related Questions