Form Casting in Play Framework 2.0.4 with securesocial - java

Is there a way to cast play.api.data.Form to play.api.data.Form in Play Framework?
I'm using secure social for play 2.0.4 and I'm having these errors when I compile custom templates.
[error] /home/mario/tegik-play/app/controllers/SecureTemplate.scala:19: type mismatch;
[error] found : play.api.data.Form[(String, String)]
[error] required: play.data.Form[(java.lang.String, java.lang.String)]
[error] views.html.custom.login(form, msg)
[error] ^
[error] /home/mario/tegik-play/app/controllers/SecureTemplate.scala:24: type mismatch;
[error] found : play.api.data.Form[securesocial.controllers.Registration.RegistrationInfo]
[error] required: play.data.Form[securesocial.controllers.Registration.RegistrationInfo]
[error] views.html.custom.Registration.signUp(form, token)
[error] ^
[error] /home/mario/tegik-play/app/controllers/SecureTemplate.scala:28: type mismatch;
[error] found : play.api.data.Form[String]
[error] required: play.data.Form[java.lang.String]
[error] views.html.custom.Registration.startSignUp(form)
[error] ^
[error] /home/mario/tegik-play/app/controllers/SecureTemplate.scala:32: type mismatch;
[error] found : play.api.data.Form[String]
[error] required: play.data.Form[java.lang.String]
[error] views.html.custom.Registration.startResetPassword(form)
[error] ^
[error] /home/mario/tegik-play/app/controllers/SecureTemplate.scala:36: type mismatch;
[error] found : play.api.data.Form[(String, String)]
[error] required: play.data.Form[(java.lang.String, java.lang.String)]
[error] views.html.custom.Registration.resetPasswordPage(form, token)
[error] ^
[error] /home/mario/tegik-play/app/controllers/SecureTemplate.scala:40: type mismatch;
[error] found : play.api.data.Form[securesocial.controllers.PasswordChange.ChangeInfo]
[error] required: play.data.Form[securesocial.controllers.PasswordChange.ChangeInfo]
[error] views.html.custom.passwordChange(form)
[error] ^
[error] 6 errors found
Hope anyone can help me.
Greetings!

play.api.data.Form is the Scala API, while play.data.Form is the Java one.
Make sure you're specifying the right package (the first one I guess) in your views.

Related

The type org.eclipse.swt.widgets.Control cannot be resolved. It is indirectly referenced from required .class files

I am compling dbeaver-7.2.2 on mips64el platform using the command "mvn package -DskipTests=true". it fails and displays error as follws:
[ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:1.7.0:compile (default-compile) on project org.jkiss.dbeaver.ui: Compilation failure: Compilation failure:
[ERROR] /root/dbeaver-7.2.2/plugins/org.jkiss.dbeaver.ui/src/org/jkiss/dbeaver/ui/properties/PropertyTreeViewer.java:
[ERROR] /*
[ERROR] ^
[ERROR] The type org.eclipse.swt.widgets.Control cannot be resolved. It is indirectly referenced from required .class files
[ERROR] /root/dbeaver-7.2.2/plugins/org.jkiss.dbeaver.ui/src/org/jkiss/dbeaver/ui/properties/PropertyTreeViewer.java:[1101]
[ERROR] private class SortListener implements Listener {
[ERROR] ^^^^^^^^
[ERROR] Listener cannot be resolved to a type
[ERROR] /root/dbeaver-7.2.2/plugins/org.jkiss.dbeaver.ui/src/org/jkiss/dbeaver/ui/properties/PropertyTreeViewer.java:[1173]
[ERROR] class PaintListener implements Listener {
[ERROR] ^^^^^^^^
[ERROR] Listener cannot be resolved to a type
[ERROR] 3 problems (3 errors)
[ERROR] -> [Help 1]
ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :org.jkiss.dbeaver.ui
the class PaintListener belogs to org.eclipse.swt.gtk.linux.mips64el which has been compiled successfully.i have set org.eclipse.swt.gtk.linux.mips64el classpath ,but it stills fail.
dbeaver-7.2.2 source code:https://github.com/dbeaver/dbeaver/releases/tag/7.2.2
[ERROR] The type org.eclipse.swt.widgets.Control cannot be resolved. It is indirectly referenced from required .class files
the class PaintListener belogs to org.eclipse.swt.gtk.linux.mips64el which has been compiled successfully.i have set org.eclipse.swt.gtk.linux.mips64el classpath ,but it stills fail.

Error while running maven command in gcp console unable to install common package error

unable to install apache maven packages in gcp console please let me know if any one resolves the issue. I'm trying to create dataflow pipeline following the below link
enter link description here
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 51.368 s
[INFO] Finished at: 2020-08-30T15:27:29Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.6.2:compile (default-compile) on project common: Compilation failure: Compilation failure:
[ERROR] /home/prasanna_kumar/DataflowTemplates/v2/common/src/main/java/com/google/cloud/teleport/v2/utils/CacheUtils.java:[78,12] cannot find symbol
[ERROR] symbol: class DataStreamClient
[ERROR] location: class com.google.cloud.teleport.v2.utils.CacheUtils.DataStreamPkCache
[ERROR] /home/prasanna_kumar/DataflowTemplates/v2/common/src/main/java/com/google/cloud/teleport/v2/utils/CacheUtils.java:[80,30] cannot find symbol
[ERROR] symbol: class DataStreamClient
[ERROR] location: class com.google.cloud.teleport.v2.utils.CacheUtils.DataStreamPkCache
[ERROR] /home/prasanna_kumar/DataflowTemplates/v2/common/src/main/java/com/google/cloud/teleport/v2/cdc/mappers/MergeInfoMapper.java:[29,42] cannot find symbol
[ERROR] symbol: class DataStreamClient
[ERROR] location: package com.google.cloud.teleport.v2.utils
[ERROR] /home/prasanna_kumar/DataflowTemplates/v2/common/src/main/java/com/google/cloud/teleport/v2/cdc/mappers/MergeInfoMapper.java:[59,11] cannot find symbol
[ERROR] symbol: class DataStreamClient
[ERROR] location: class com.google.cloud.teleport.v2.cdc.mappers.MergeInfoMapper
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <args> -rf :common
By now this is well known to developers bug, confirmed on my side, getting the same kafka-to-bigquery template compilation error around DataStreamClient class. Seems the new PR for CacheUtils.java is going to appear soon, more info here.

jboss & maven: maven build fails due to libraries not opening

I am building the jboss EA 6.3 quickstart project "greeter".
I run maven clean install jboss-as:deploy in the project dir as instructed whilist a jboss server is running.
I get the following errors:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.
1:compile (default-compile) on project jboss-greeter: Compilation failure: Compi
lation failure:
[ERROR] error reading C:\Users\boris\.m2\repository\org\jboss\spec\javax\faces\j
boss-jsf-api_2.1_spec\2.1.28.Final-redhat-1\jboss-jsf-api_2.1_spec-2.1.28.Final-
redhat-1.jar; error in opening zip file
[ERROR] error reading C:\Users\boris\.m2\repository\org\hibernate\javax\persiste
nce\hibernate-jpa-2.0-api\1.0.1.Final-redhat-2\hibernate-jpa-2.0-api-1.0.1.Final
-redhat-2.jar; error in opening zip file
[ERROR] error reading C:\Users\boris\.m2\repository\org\jboss\spec\javax\transac
tion\jboss-transaction-api_1.1_spec\1.0.1.Final-redhat-2\jboss-transaction-api_1
.1_spec-1.0.1.Final-redhat-2.jar; error in opening zip file
[ERROR] error reading C:\Users\boris\.m2\repository\org\jboss\spec\javax\ejb\jbo
ss-ejb-api_3.1_spec\1.0.2.Final-redhat-2\jboss-ejb-api_3.1_spec-1.0.2.Final-redh
at-2.jar; error in opening zip file
[ERROR] error reading C:\Users\boris\.m2\repository\org\jboss\spec\javax\faces\j
boss-jsf-api_2.1_spec\2.1.28.Final-redhat-1\jboss-jsf-api_2.1_spec-2.1.28.Final-
redhat-1.jar; error in opening zip file
[ERROR] error reading C:\Users\boris\.m2\repository\org\hibernate\javax\persiste
nce\hibernate-jpa-2.0-api\1.0.1.Final-redhat-2\hibernate-jpa-2.0-api-1.0.1.Final
-redhat-2.jar; error in opening zip file
[ERROR] error reading C:\Users\boris\.m2\repository\org\jboss\spec\javax\transac
tion\jboss-transaction-api_1.1_spec\1.0.1.Final-redhat-2\jboss-transaction-api_1
.1_spec-1.0.1.Final-redhat-2.jar; error in opening zip file
[ERROR] error reading C:\Users\boris\.m2\repository\org\jboss\spec\javax\ejb\jbo
ss-ejb-api_3.1_spec\1.0.2.Final-redhat-2\jboss-ejb-api_3.1_spec-1.0.2.Final-redh
at-2.jar; error in opening zip file
[ERROR] /C:/Users/boris/Desktop/JavaLearning/jboss-eap-quickstarts-6.3.0.GA/gree
ter/src/main/java/org/jboss/as/quickstarts/greeter/Resources.java:[24,27] packag
e javax.faces.context does not exist
[ERROR] /C:/Users/boris/Desktop/JavaLearning/jboss-eap-quickstarts-6.3.0.GA/gree
ter/src/main/java/org/jboss/as/quickstarts/greeter/Resources.java:[44,12] cannot
find symbol
[ERROR] symbol: class FacesContext
[ERROR] location: class org.jboss.as.quickstarts.greeter.Resources
[ERROR] /C:/Users/boris/Desktop/JavaLearning/jboss-eap-quickstarts-6.3.0.GA/gree
ter/src/main/java/org/jboss/as/quickstarts/greeter/web/CreateController.java:[21
,31] package javax.faces.application does not exist
[ERROR] /C:/Users/boris/Desktop/JavaLearning/jboss-eap-quickstarts-6.3.0.GA/gree
ter/src/main/java/org/jboss/as/quickstarts/greeter/web/CreateController.java:[22
,27] package javax.faces.context does not exist
[ERROR] /C:/Users/boris/Desktop/JavaLearning/jboss-eap-quickstarts-6.3.0.GA/gree
ter/src/main/java/org/jboss/as/quickstarts/greeter/web/CreateController.java:[34
,13] cannot find symbol
[ERROR] symbol: class FacesContext
[ERROR] location: class org.jboss.as.quickstarts.greeter.web.CreateController
[ERROR] /C:/Users/boris/Desktop/JavaLearning/jboss-eap-quickstarts-6.3.0.GA/gree
ter/src/main/java/org/jboss/as/quickstarts/greeter/domain/ManagedBeanUserDao.jav
a:[23,25] cannot find symbol
[ERROR] symbol: class SystemException
[ERROR] location: package javax.transaction
[ERROR] /C:/Users/boris/Desktop/JavaLearning/jboss-eap-quickstarts-6.3.0.GA/gree
ter/src/main/java/org/jboss/as/quickstarts/greeter/domain/ManagedBeanUserDao.jav
a:[24,25] cannot find symbol
[ERROR] symbol: class UserTransaction
[ERROR] location: package javax.transaction
[ERROR] /C:/Users/boris/Desktop/JavaLearning/jboss-eap-quickstarts-6.3.0.GA/gree
ter/src/main/java/org/jboss/as/quickstarts/greeter/domain/ManagedBeanUserDao.jav
a:[32,13] cannot find symbol
[ERROR] symbol: class UserTransaction
[ERROR] location: class org.jboss.as.quickstarts.greeter.domain.ManagedBeanUserD
ao
[ERROR] /C:/Users/boris/Desktop/JavaLearning/jboss-eap-quickstarts-6.3.0.GA/gree
ter/src/main/java/org/jboss/as/quickstarts/greeter/domain/EJBUserDao.java:[19,17
] package javax.ejb does not exist
[ERROR] /C:/Users/boris/Desktop/JavaLearning/jboss-eap-quickstarts-6.3.0.GA/gree
ter/src/main/java/org/jboss/as/quickstarts/greeter/domain/EJBUserDao.java:[26,2]
cannot find symbol
[ERROR] symbol: class Stateful
[ERROR] /C:/Users/boris/Desktop/JavaLearning/jboss-eap-quickstarts-6.3.0.GA/gree
ter/src/main/java/org/jboss/as/quickstarts/greeter/Resources.java:[45,16] cannot
find symbol
[ERROR] symbol: variable FacesContext
[ERROR] location: class org.jboss.as.quickstarts.greeter.Resources
[ERROR] /C:/Users/boris/Desktop/JavaLearning/jboss-eap-quickstarts-6.3.0.GA/gree
ter/src/main/java/org/jboss/as/quickstarts/greeter/web/CreateController.java:[48
,47] cannot find symbol
[ERROR] symbol: class FacesMessage
[ERROR] location: class org.jboss.as.quickstarts.greeter.web.CreateController
[ERROR] /C:/Users/boris/Desktop/JavaLearning/jboss-eap-quickstarts-6.3.0.GA/gree
ter/src/main/java/org/jboss/as/quickstarts/greeter/web/CreateController.java:[51
,47] cannot find symbol
[ERROR] symbol: class FacesMessage
[ERROR] location: class org.jboss.as.quickstarts.greeter.web.CreateController
[ERROR] /C:/Users/boris/Desktop/JavaLearning/jboss-eap-quickstarts-6.3.0.GA/gree
ter/src/main/java/org/jboss/as/quickstarts/greeter/domain/ManagedBeanUserDao.jav
a:[50,22] cannot find symbol
[ERROR] symbol: class SystemException
[ERROR] location: class org.jboss.as.quickstarts.greeter.domain.ManagedBeanUserD
ao
[ERROR] /C:/Users/boris/Desktop/JavaLearning/jboss-eap-quickstarts-6.3.0.GA/gree
ter/src/main/java/org/jboss/as/quickstarts/greeter/domain/ManagedBeanUserDao.jav
a:[68,22] cannot find symbol
[ERROR] symbol: class SystemException
[ERROR] location: class org.jboss.as.quickstarts.greeter.domain.ManagedBeanUserD
ao
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureExc
eption
I checked the files it tries to open in the maven repo. They all are 1kb large and won't open by winrar. Windows says "file corrupt or damaged".
Other examples (without JSF though) worked just fine.
What is your M2_HOME? You can configure the path in the M2_HOME/conf/settings.xml, e.g.:
<!-- localRepository
| The path to the local repository maven will use to store artifacts.
|
| Default: ${user.home}/.m2/repository
<localRepository>/path/to/local/repo</localRepository>
-->
I removed the specified files that maven couldn't open. Maven redownloaded them, then it worked just fine.

Error while running openIE using scala

i am running openIE in scala. while running sbt run i got error. can any body explain?
Set current project to openie (in build file:/home/user_name/Videos/openie-master/)
[info] Running edu.knowitall.openie.OpenIECli
[error] Exception in thread "main" java.lang.NoSuchFieldError: MODULE$
[error] at scala.util.PropertiesTrait$class.scalaPropOrNone(Properties.scala:65)
[error] at scala.util.Properties$.scalaPropOrNone(Properties.scala:16)
[error] at scala.util.PropertiesTrait$class.$init$(Properties.scala:77)
[error] at scala.util.Properties$.<init>(Properties.scala:16)
[error] at scala.util.Properties$.<clinit>(Properties.scala)
[error] at scala.compat.Platform$.<init>(Platform.scala:112)
[error] at scala.compat.Platform$.<clinit>(Platform.scala)
[error] at scala.App$class.$init$(App.scala:42)
[error] at edu.knowitall.openie.OpenIECli$.<init>(OpenIECli.scala:29)
[error] at edu.knowitall.openie.OpenIECli$.<clinit>(OpenIECli.scala)
[error] at edu.knowitall.openie.OpenIECli.main(OpenIECli.scala)

Run Test Play! Framework - DataSource user is null

Hello I am trying run a simple test in a web app using Play! Framework, but I got a error:
[info] RouteTest
[error] Test RouteTest.testRouteActivityIndex failed: DataSource user is null?
[error] at com.avaje.ebeaninternal.server.lib.sql.DataSourcePool.<init>(DataSourcePool.java:198)
[error] at com.avaje.ebeaninternal.server.lib.sql.DataSourceManager.getDataSource(DataSourceManager.java:210)
[error] at com.avaje.ebeaninternal.server.lib.sql.DataSourceGlobalManager.getDataSource(DataSourceGlobalManager.java:63)
[error] at com.avaje.ebeaninternal.server.core.DefaultServerFactory.getDataSourceFromConfig(DefaultServerFactory.java:427)
[error] at com.avaje.ebeaninternal.server.core.DefaultServerFactory.setDataSource(DefaultServerFactory.java:388)
[error] at com.avaje.ebeaninternal.server.core.DefaultServerFactory.createServer(DefaultServerFactory.java:168)
[error] at com.avaje.ebeaninternal.server.core.DefaultServerFactory.createServer(DefaultServerFactory.java:125)
[error] at com.avaje.ebeaninternal.server.core.DefaultServerFactory.createServer(DefaultServerFactory.java:64)
[error] at com.avaje.ebean.EbeanServerFactory.create(EbeanServerFactory.java:64)
[error] at com.avaje.ebean.Ebean$ServerManager.getWithCreate(Ebean.java:237)
[error] at com.avaje.ebean.Ebean$ServerManager.get(Ebean.java:224)
[error] at com.avaje.ebean.Ebean$ServerManager.access$200(Ebean.java:159)
[error] at com.avaje.ebean.Ebean.getServer(Ebean.java:288)
[error] at play.db.ebean.Model$Finder.server(Model.java:216)
[error] at play.db.ebean.Model$Finder.all(Model.java:230)
[error] at models.Activity.all(Activity.java:29)
[error] at controllers.Application.activities(Application.java:18)
[error] at Routes$$anonfun$routes$1$$anonfun$apply$5$$anonfun$apply$6.apply(routes_routing.scala:60)
[error] at Routes$$anonfun$routes$1$$anonfun$apply$5$$anonfun$apply$6.apply(routes_routing.scala:60)
[error] at play.core.Router$HandlerInvoker$$anon$4$$anon$1.invocation(Router.scala:1086)
[error] at play.core.j.JavaAction$$anon$1.call(JavaAction.scala:33)
[error] at play.core.j.JavaAction$class.apply(JavaAction.scala:74)
[error] at play.core.Router$HandlerInvoker$$anon$4$$anon$1.apply(Router.scala:1085)
[error] at play.test.Helpers.invokeHandler(Helpers.java:34)
[error] at play.test.Helpers.routeAndCall(Helpers.java:246)
[error] at play.test.Helpers.routeAndCall(Helpers.java:231)
[error] at RouteTest.testRouteActivityIndex(RouteTest.java:14)
[error] ...
[info] x RouteTest.testRouteActivityIndex
The code of test is:
#Test
public void testRouteActivityIndex(){
Result result = routeAndCall(fakeRequest(GET, "/activities"));
Assert.assertNotNull(result);
}
I tried researching the error, but did not find anything very useful for this case, even the site's play!. someone has gone through this?
Your /activities action probably make some calls to the DB.
So you should make your test in a running fake application as explained in the "Running in a fake application" section of this documentation: http://www.playframework.org/documentation/2.0.3/JavaTest
And don't forget to import the static Helper:
import static play.test.Helpers.*;

Categories