I have a frustrating situation I cannot understand. I am developing an application using the Grails framework (Version: 3.4.0.RELEASE). I used the spring-security-core(1.2.7.3) and spring-security-ldap(1.0.6) plugins to manage credentials. I uninstall the ldap plugin, and for some reason it causes errors. Now when I try to run the project it gives me java errors for one of my groovy classes, such as "...java:15: ')' expected..." or "...java:15: ';' expected...". Everything ran great until I uninstall the ldap plugin. During compile it says "Compile error during compilation with javac". What's happening here? Let me know if I need to show some other code. And this is during runtime. There are no errors showing. I'm in such a hurry to finish the project that each time I get this problem I just create a new project and it runs fine. Just trying to avoid that as I progress in the project
EDIT:
Console output
| Loading Grails 2.2.4
| Configuring classpath.
| Environment set to development.....
| Packaging Grails application....
| Compiling 21 source files.
| Error Compilation error: startup failed:
Compile error during compilation with javac.
C:\Users\cpu user\AppData\Local\Temp\groovy-generated-75457048637925996-java-source\com\example\ldap\MyUserDetails.java:15: ')' expected
super ((java.lang.String)null, (java.lang.String)null, false, false, false, false, (java.util.Collection<java.lang.Object extends org.springframework.security.core.GrantedAuthority>)null);
^
C:\Users\cpu user\AppData\Local\Temp\groovy-generated-75457048637925996-java-source\com\example\ldap\MyUserDetails.java:15: ';' expected
super ((java.lang.String)null, (java.lang.String)null, false, false, false, false, (java.util.Collection<java.lang.Object extends org.springframework.security.core.GrantedAuthority>)null);
^
C:\Users\cpu user\AppData\Local\Temp\groovy-generated-75457048637925996-java-source\com\example\ldap\MyUserDetails.java:15: illegal start of expression
super ((java.lang.String)null, (java.lang.String)null, false, false, false, false, (java.util.Collection<java.lang.Object extends org.springframework.security.core.GrantedAuthority>)null);
^
C:\Users\cpu user\AppData\Local\Temp\groovy-generated-75457048637925996-java-source\com\example\ldap\MyUserDetails.java:15: ';' expected
super ((java.lang.String)null, (java.lang.String)null, false, false, false, false, (java.util.Collection<java.lang.Object extends org.springframework.security.core.GrantedAuthority>)null);
^
C:\Users\cpu user\AppData\Local\Temp\groovy-generated-75457048637925996-java-source\com\example\ldap\MyUserDetails.java:15: illegal start of expression
super ((java.lang.String)null, (java.lang.String)null, false, false, false, false, (java.util.Collection<java.lang.Object extends org.springframework.security.core.GrantedAuthority>)null);
^
C:\Users\cpu user\AppData\Local\Temp\groovy-generated-75457048637925996-java-source\com\example\ldap\MyUserDetails.java:15: not a statement
super ((java.lang.String)null, (java.lang.String)null, false, false, false, false, (java.util.Collection<java.lang.Object extends org.springframework.security.core.GrantedAuthority>)null);
^
C:\Users\cpu user\AppData\Local\Temp\groovy-generated-75457048637925996-java-source\com\example\ldap\MyUserDetails.java:15: not a statement
super ((java.lang.String)null, (java.lang.String)null, false, false, false, false, (java.util.Collection<java.lang.Object extends org.springframework.security.core.GrantedAuthority>)null);
^
C:\Users\cpu user\AppData\Local\Temp\groovy-generated-75457048637925996-java-source\com\example\ldap\MyUserDetails.java:15: ';' expected
super ((java.lang.String)null, (java.lang.String)null, false, false, false, false, (java.util.Collection<java.lang.Object extends org.springframework.security.core.GrantedAuthority>)null);
^
C:\Users\cpu user\AppData\Local\Temp\groovy-generated-75457048637925996-java-source\com\example\ldap\MyUserDetails.java:15: cannot find symbol
symbol : class util
location: package java
super ((java.lang.String)null, (java.lang.String)null, false, false, false, false, (java.util.Collection<java.lang.Object extends org.springframework.security.core.GrantedAuthority>)null);
^
C:\Users\cpu user\AppData\Local\Temp\groovy-generated-75457048637925996-java-source\com\example\ldap\MyUserDetails.java:15: cannot find symbol
symbol : class lang
location: package java
super ((java.lang.String)null, (java.lang.String)null, false, false, false, false, (java.util.Collection<java.lang.Object extends org.springframework.security.core.GrantedAuthority>)null);
^
C:\Users\cpu user\AppData\Local\Temp\groovy-generated-75457048637925996-java-source\com\example\ldap\MyUserDetails.java:15: cannot find symbol
symbol : constructor User(java.lang.String,java.lang.String,boolean,boolean,boolean,boolean,boolean)
location: class org.springframework.security.core.userdetails.User
super ((java.lang.String)null, (java.lang.String)null, false, false, false, false, (java.util.Collection<java.lang.Object extends org.springframework.security.core.GrantedAuthority>)null);
^
C:\Users\cpu user\AppData\Local\Temp\groovy-generated-75457048637925996-java-source\com\example\ldap\MyUserDetails.java:15: package security does not exist
super ((java.lang.String)null, (java.lang.String)null, false, false, false, false, (java.util.Collection<java.lang.Object extends org.springframework.security.core.GrantedAuthority>)null);
^
Note: C:\projects\new portal project\InfinityPortalIntranet\src\java\com\example\ldap\AuthenticateUser.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
12 errors`
EDIT 2:
MyUserDetails.Groovy
package com.example.ldap
import org.springframework.security.core.GrantedAuthority
import org.springframework.security.core.userdetails.User
class MyUserDetails extends User {
// extra instance variables
final String fullname
final String email
final String title
final String firstName
final String lastName
MyUserDetails(String username, String password, boolean enabled, boolean accountNonExpired,
boolean credentialsNonExpired, boolean accountNonLocked,
Collection<GrantedAuthority> authorities,
String fullname, String email, String title, String firstName, String lastName) {
super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked,
authorities)
this.fullname = fullname
this.email = email
this.title = title
this.firstName = firstName
this.lastName = lastName
}
}
Related
I am trying to use Dart alongside a api for a school system i have reverse engineered and I'm trying to implement it in a library, when using dio to send a request it is converted to a map (the output of the api is json i think) but it is nested and I’m not sure on how to work with them.
This is the code i have written
class StudentClient{
String sessionID;
StudentClient(this.sessionID);
Future<Map> basicInfo() async {
var dio = Dio();
dio.options.headers["Authorization"] = "Basic $sessionID";
Response loginRequest = await dio.get(
'https://www.classcharts.com/apiv2student/ping',
options: Options(contentType: Headers.formUrlEncodedContentType),
);
assert(loginRequest.data is Map);
Map<dynamic, dynamic> request = loginRequest.data;
return request;
}
and the (censored) output
{success: 1, data: {user: {id: 696969, name: Foo Bar, first_name: Foo, last_name: Bar, avatar_url: https://asdsdsdsd/26.0.0/img/faces/default.png, display_behaviour: true, display_parent_behaviour: false, display_homework: true, display_rewards: true, display_detentions: true, display_report_cards: true, display_classes: false, display_announcements: true, display_attendance: false, display_attendance_type: none, display_attendance_percentage: true, display_activity: true, display_mental_health: false, display_mental_health_no_tracker: false, display_timetable: true, is_disabled: false, display_two_way_communications: true, display_absences: false, can_upload_attachments: false, display_event_badges: false, display_avatars: false, display_concern_submission: false, display_custom_fields: false, pupil_concerns_help_text: , allow_pupils_add_timetable_notes: false, detention_alias_plural_uc: Detentions, announcements_count: 0, messages_count: 0, pusher_channel_name: Pupil_dfghfghhghfghfghfghfghfghfghfghfghfgh, has_birthday: true, has_new_survey: false, survey_id: null}}, meta: {version: 26.0.0}}
Any help would be appreciated!
How can I fix this error?
PHP Parse error: syntax error, unexpected ':', expecting ';' or '{' in /home/domainname/public_html/..../src/Parse/HttpClients/ParseCurlHttpClient.php on line 154
PHP sürümü: 7.3.6
Code where error occurs:
public function getResponseContentType()
{
return $this->responseContentType;
}
/**
* Sets up our cURL request in advance
*/
public function setup() : void **//154 line**
{
// init parse curl
$this->parseCurl->init();
$this->parseCurl->setOptionsArray(array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_HEADER => 1,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_SSL_VERIFYPEER => true,
CURLOPT_SSL_VERIFYHOST => 2,
));
}
Code repo: https://github.com/parse-community/parse-php-sdk/blob/master/src/Parse/HttpClients/ParseCurlHttpClient.php
I have defined a concept in my model file. It looks like this
concept DoctorSchedule {
o Boolean AM12to1 optional
o Boolean AM1to2 optional
o Boolean AM2to3 optional
o Boolean AM3to4 optional
o Boolean AM4to5 optional
o Boolean AM5to6 optional
o Boolean AM6to7 optional
o Boolean AM7to8 optional
o Boolean AM8to9 optional
o Boolean AM9to10 optional
o Boolean AM10to11 optional
o Boolean AM11to12 optional
o Boolean PM12to1 optional
}
participant Doctor identified by doctorID {
o String doctorID
o String contact
o DoctorSchedule doctorSchedule
}
When I test it on the composer-playground, and try to add a new doctor participant. The JSON preview looks something like this
{
"$class": "org.acme.Doctor",
"doctorID": "0624",
"contact": "",
"doctorSchedule": {
"$class": "org.acme.DoctorSchedule",
"AM12to1": false,
"AM1to2": false,
"AM2to3": false,
"AM3to4": false,
"AM4to5": false,
"AM5to6": false,
"AM6to7": false,
"AM7to8": false,
"AM8to9": false,
"AM9to10": false,
"AM10to11": false,
"AM11to12": false,
"PM12to1": false,
}}
But when I generate the composer-rest-server and try to add a doctor using the post method, an additional id field appears
{
"$class": "org.acme.Doctor",
"doctorID": "stri1ng",
"contact": "string",
"doctorSchedule": {
"$class": "org.acme.DoctorSchedule",
"AM12to1": true,
"AM1to2": true,
"AM2to3": true,
"AM3to4": true,
"AM4to5": true,
"AM5to6": true,
"AM6to7": true,
"AM7to8": true,
"AM8to9": true,
"AM9to10": true,
"AM10to11": true,
"AM11to12": true,
"PM12to1": true,
"id": "string"
}}
What is this id field inside the DoctorSchedule concept? According to my understanding, you don't need an ID to identify a concept (like with assets or participants.) And why is this id field appearing in the composer-rest-server and not on the composer-playground?
Note: The post method throws an error if this id is a blank string.
I think you have found a bug in the REST server - I have added this new issue: 3963 whilst investigating your problem I also discovered a related problem and created a 2nd issue: 3962
My experience differs from yours in that I can leave the extra id field empty - which you obviously can't do with the DoctorID.
I have created two domain classes like below:
Component:
class Component {
String name;
Integer orderOfComponent;
Boolean limitedAccess;
Date dateCreated;
String alignment;
String type;
static belongsTo = [subpage: Subpage]
static constraints = {
name nullable: false, blank: false;
orderOfComponent nullable:false, blank: false;
limitedAccess nullable: true, blank: true;
alignment nullable: true, blank: true, inList: ["left", "right", "center", ""];
type nullable: false, blank: false, inList: ["text", "image", "document", "html"];
subpage nullable: false, blank: false;
}
}
Text:
class Text extends Component {
String text;
String color;
String additionalStyle;
String textType;
String link;
static constraints = {
text nullable: true, blank: true;
color nullable: true, blank: true;
additionalStyle nullable: true, blank: true;
textType nullable: true, blank: true, inList: ["p", "h1", "h2", "h3", ""];
link nullable: true, blank: true;
}
}
Everything is fine when I create instance of Component class:
new Component(name: "component" + i, orderOfComponent: i, limitedAccess: new Boolean(false), alignment: "right", type: "text", subpage: Subpage.get(1)).save(flush:true, failOnError:true);
But I get Error when I try to do similar for Text class:
new Text(name: "componentText",
orderOfComponent: 0,
limitedAccess: new Boolean(false),
alignment: "right",
type: "text",
subpage: Subpage.get(1),
text: "asdasdasdasd",
color: "#0F0C0A",
additionalStyle: "",
textType: "p",
link: "http://google.pl").save(flush:true, failOnError:true);
Error:
Error 2014-01-28 02:27:10,453 [localhost-startStop-1] ERROR context.GrailsContextLoader - Error initializing the application: Validation Error(s) occurred during save():
- Field error in object 'adminpanel.component.Text' on field 'type': rejected value [null]; (...)
And also very similar "Message".
Does someone know why I cannot create an instance of the Text class or how to use constructor of inheritor class properly? Thanks in advance.
Since the upgrade to grails 2.3.5, a strange behaviour of the hibernate plugin (moved from version 3.6.10.6 to 3.6.10.7) results in a bean error at runtime:
14-01-22 16:22:54,064 ERROR [GrailsContextLoader] - Error initializing the application: Error creating bean with name 'xxx.xxxx.StatisticsValidator': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void org.codehaus.groovy.grails.orm.hibernate.validation.HibernateDomainClassValidator.setProxyHandler(org.codehaus.groovy.grails.support.proxy.ProxyHandler); nested exception is java.lang.NoSuchMethodError: org.springframework.util.ClassUtils.determineCommonAncestor(Ljava/lang/Class;Ljava/lang/Class;)Ljava/lang/Class;
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.xxx.xxxx.StatisticsValidator': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void org.codehaus.groovy.grails.orm.hibernate.validation.HibernateDomainClassValidator.setProxyHandler(org.codehaus.groovy.grails.support.proxy.ProxyHandler); nested exception is java.lang.NoSuchMethodError: org.springframework.util.ClassUtils.determineCommonAncestor(Ljava/lang/Class;Ljava/lang/Class;)Ljava/lang/Class;
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void org.codehaus.groovy.grails.orm.hibernate.validation.HibernateDomainClassValidator.setProxyHandler(org.codehaus.groovy.grails.support.proxy.ProxyHandler); nested exception is java.lang.NoSuchMethodError: org.springframework.util.ClassUtils.determineCommonAncestor(Ljava/lang/Class;Ljava/lang/Class;)Ljava/lang/Class;
Here is the Statistics domain class which is concerned, even if nothing has been changed since grails 2.3.4:
class Statistics implements Serializable {
static belongsTo = [profile: Profile]
Profile profile
String email
String dbkey
String clientCode
String affiliatesNbr
String freeStorageBonus
String freeUsersBonus
String storageUsed
String storageAvailable
String quotaUsersCurrent
String quotaUsersAvailable
String comments
Date processedDate
static constraints = {
profile unique: true, nullable: false, blank: false
email email: true, maxSize: 80, nullable: false, blank: false
dbkey maxSize: 80, nullable: false, blank: false
clientCode maxSize: 40, nullable: false, blank: false
affiliatesNbr maxSize: 40, nullable: true, blank: true
freeStorageBonus maxSize: 40, nullable: true, blank: true
freeUsersBonus maxSize: 40, nullable: true, blank: true
storageUsed maxSize: 40, nullable: true, blank: true
storageAvailable maxSize: 40, nullable: true, blank: true
quotaUsersCurrent maxSize: 40, nullable: true, blank: true
quotaUsersAvailable maxSize: 40, nullable: true, blank: true
comments maxSize: 180, nullable: true, blank: true
processedDate nullable: true, blank: true
}
Below the list of plugins used:
plugins {
build ":tomcat:7.0.50"
runtime ":hibernate:3.6.10.7"
runtime ":database-migration:1.3.8"
runtime ":resources:1.2.1"
runtime ":jquery:1.8.3" //jquery:1.10.2
compile ":scaffolding:2.0.1"
compile ":cache:1.1.1"
compile ":bean-fields:1.0"
compile ":csv:0.3.1"
compile ":famfamfam:1.0.1"
compile ":form-helper:0.2.8"
compile ":google-chart:0.5.2"
compile ":google-visualization:0.6.2"
compile ":jcaptcha:1.2.1"
compile ":jdbc-pool:7.0.47"
compile ":jquery-ui:1.8.24"
compile ":navigation:1.3.2"
compile ":quartz:1.0.1" //1.0.1
compile ":richui:0.8"
compile ":spring-security-core:2.0-RC2"
compile ":webflow:2.0.8.1"
compile ":rendering:0.4.4"
compile ":modernizr:2.7.1.1"
compile ":spring-security-acl:2.0-RC1"
compile ":pdf-viewer:0.1"
compile ":taggable:1.0.1"
compile ":executor:0.3"
compile ":gmetrics:0.3.1"
compile ":lesscss-resources:1.3.3"
compile ":pretty-size:0.2"
compile ":mysql-connectorj:5.1.22.1"
compile ":font-awesome-resources:4.0.3.0"
compile ":aws-sdk:1.6.12"
compile ":aws:1.6.7.5"
}