I try to run (without maven) the atmosphere-gwt20 demo found here.
Java compile fine but, when I compile with gwt (2.5.1), I stumble in this error:
[ERROR] Errors in 'org/atmosphere/gwt20/client/AtmosphereRequestConfig.java'
[ERROR] Line 18: The import org.atmosphere.gwt20.shared cannot be resolved
[ERROR] Line 99: Constants cannot be resolved
My WEB-INF/lib contains
atmosphere-gwt20-client-2.0.0.jar
atmosphere-gwt20-common-2.0.0.jar
atmosphere-gwt20-server-2.0.0.jar
atmosphere-runtime-2.0.5.jar
gwt-servlet.jar
slf4j-api.1.6.1.jar
do I miss something?
I substitute each atmosphere-gwt20-..-2.0.0.jar with atmosphere-gwt-20-...-2.0.2.jar and gwt compiles fine.
Related
I am using the Play framework (which uses SBT build tool) with Java where I need to consume a Protobuf. So I have xxx.proto file. I got binary protoc compiler and added to class path. so I see -
protoc --version
libprotoc 3.1.0
I have compiled the xxx.proto file using -
protoc -I=$SRC_DIR --java_out=$DST_DIR $SRC_DIR/xxx.proto so it has generated xxx.java file.
Now when I am compiling this xxx.java file ( the project using sbt build tool)
[error] /my_project/app/helpers/xxx.java:7: package com.google.protobuf does not exist
[error] com.google.protobuf.ExtensionRegistryLite
[error] /my_project/app/helpers/xxx.java:11: package com.google.protobuf does not exist
[error] com.google.protobuf.ExtensionRegistry
[error] /my_project/app/helpers/xxx.java:6182: package com.google.protobuf.Descriptors does not exist
[error] com.google.protobuf.Descriptors.Descriptor
[error] /my_project/app/helpers/xxx.java:6185: package com.google.protobuf.GeneratedMessageV3 does not exist
[error] com.google.protobuf.GeneratedMessageV3.FieldAccessorTable`
I see in my installed library - com.google.protobuf jar is there.
My xxx.proto looks following -
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: xxx.proto
public final class xxx {
private xxx() {}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistryLite registry) {
}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistry registry) {
registerAllExtensions(
(com.google.protobuf.ExtensionRegistryLite) registry);
}
......
Is there anything I have missed while generating the xxx.java file?
How should I fix these compilation error?
You need to make sure that you're using the exact same versions of protoc and libprotobuf.jar. From what you wrote, it sounds like you're using protoc version 3.1.0 but libprotobuf 2.5.0. You need to use libprotobuf 3.1.0 instead, otherwise you will get compile errors like the ones you quote.
Re-stating Kenton's answer with some more instructions:
In Intellij, click on External Libraries and find the jar for protobuf.
Check the version of protoc:
If they don't match, (as shown above) then you will get the compilation errors.
I've seen similar issue with maven after changing some field type in my proto schema and then building without doing a clean first. However, doing a clean and build fixed it every time.
I am trying to run a project generated using jhipster. I opted to use Spring Websockets while generating the project. However on running the mvn command on the folder. I get the following error:
[ERROR] diagnostic: C:\java_dev\workspaces\pmilive\pmi\trunk\src\main\java\id\co\allianz\pension\config\WebsocketSecurityConfiguration.java:10: error:
cannot access org.springframework.web.socket.config.annotation.AbstractWebSocketMessageBrokerConfigurer
public class WebsocketSecurityConfiguration extends AbstractSecurityWebSocketMessageBrokerConfigurer {
^
class file for org.springframework.web.socket.config.annotation.AbstractWebSocketMessageBrokerConfigurer not found
[ERROR] error on execute: error during compilation
Is there any other additional setting that I should add?
No nothing special is required, I suspect that you had an error during maven dependency resolution phase. maybe something is wrong in your ~/.m2 local repository: try deleting ~/.m2/respository/org/springframework and re-run mvn.
If you're on Windows, path is %USERPROFILE%\.m2\repository\org\springframework.
I have Issue with using database
I was going with this tutorial
http://vimeo.com/58969923# (one from playframework.com page)
in the model:
play-2.2.1/jcirs/app/models/MedicalIncident.java
public class MedicalIncident extends Model{}
I am trying to use Entity. For that I have to import:
javax.persistence.* and play.db.ebean.*
but none of them can be found.
The error is
package javax.persistence does not exist
What should I do?
Use any other database engine? Or should download some dependency.
I would like to go with playframework best way.
Please help.
My configuration
application.conf:
db.default.driver=org.h2.Driver
db.default.url="jdbc:h2:mem:play"
ebean.default="models.*"
stack trace:
[jcirs] $ run 8081
--- (Running the application from SBT, auto-reloading is enabled) ---
[info] play - Listening for HTTP on /0:0:0:0:0:0:0:0:8081
(Server started, use Ctrl+D to stop and go back to the console...)
[info] Compiling 5 Scala sources and 5 Java sources to /home/daniel/play-2.2.1/jcirs/target/scala-2.10/classes...
[error] /home/daniel/play-2.2.1/jcirs/app/models/MedicalIncident.java:4: error: package javax.persistence does not exist
[error] import javax.persistence.*;
[error] ^
[error] /home/daniel/play-2.2.1/jcirs/app/models/MedicalIncident.java:6: error: package play.db.ebean does not exist
[error] import play.db.ebean.*;
[error] ^
[error] /home/daniel/play-2.2.1/jcirs/app/models/MedicalIncident.java:14: error: cannot find symbol
[error] public class MedicalIncident extends Model {
[error] ^
[error] symbol: class Model
[error] /home/daniel/play-2.2.1/jcirs/app/models/MedicalIncident.java:13: error: cannot find symbol
[error] #Entity
[error] ^
[error] symbol: class Entity
[error] /home/daniel/play-2.2.1/jcirs/app/models/MedicalIncident.java:15: error: cannot find symbol
[error] #id
[error] ^
[error] symbol: class id
[error] location: class MedicalIncident
[error] /home/daniel/play-2.2.1/jcirs/app/controllers/MedicalIncident.java:21: error: cannot find symbol
[error] MedicalIncident medical_incident = Form.form(MedicalIncident.class).bindFormRequest().get();
[error] ^
[error] symbol: variable Form
[error] location: class MedicalIncident
[error] 6 errors
[error] (compile:compile) javac returned nonzero exit code
[error] application -
! #6gfjpj0cf - Internal server error, for (GET) [/] ->
play.PlayExceptions$CompilationException: Compilation error[error: package javax.persistence does not exist]
at play.PlayReloader$$anon$1$$anonfun$reload$2$$anonfun$apply$14$$anonfun$apply$16.apply(PlayReloader.scala:304) ~[na:na]
at play.PlayReloader$$anon$1$$anonfun$reload$2$$anonfun$apply$14$$anonfun$apply$16.apply(PlayReloader.scala:304) ~[na:na]
at scala.Option.map(Option.scala:145) ~[scala-library.jar:na]
at play.PlayReloader$$anon$1$$anonfun$reload$2$$anonfun$apply$14.apply(PlayReloader.scala:304) ~[na:na]
at play.PlayReloader$$anon$1$$anonfun$reload$2$$anonfun$apply$14.apply(PlayReloader.scala:298) ~[na:na]
at scala.Option.map(Option.scala:145) ~[scala-library.jar:na]
[warn] play - No application found at invoker init
Have you updated your project dependencies in Build.scala?
Not sure if anything has changed in Play 2.2.1 but for Play 2.1.3 dependencies in Build.scala would look like this:
val appDependencies = Seq(
javaCore,
javaJdbc,
javaEbean
)
EDIT:
Once you update your dependencies in Build.scala don't forget to update dependencies in your IDEA or Eclipse by running corresponding play command, e.g.
play idea
Playframework is generating the IDEA specific files when you run "play idea" (if you're using Eclipse, run "play eclipse"). If you imported the project in the same way the tutorial explained, you should have the necessary JARs already available in the project.
If it's still not working, verify if IDEA correctly assigned a JDK to your project.
Try to understand what this framework is doing under the hood, don't just try to make it work and ignore the important stuff.
I had the same problem and I was using Eclipse. I included #Entity, e.g. and in my project console I typed eclipse with-source=true. After a "Refresh" in my Eclipse project and a "Clean", it brings me all JARs and then I clicked on the issue and the IDE offered the possibility to include javax.persistence.*, play.db.ebean.Model, etc.
I was having the same problem, while using a heavily modified version of Eclipse Neon. The clue to solving it for me, was that the only place I was seeing the errors was during a Maven build. The Eclipse IDE was able to compile and run the program just fine.I was able to solve it by adding a couple of dependencies to the project's pom.xml file. See below for the xml code for the dependencies.I was able to get the groupId's and artifactId's versions by drilling down the directories out on Maven Central. I just walked the tree until I found the metadata.xml files for the persistence.core and the persistence.jpa artifacts.
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.core</artifactId>
<version>2.6.4</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.jpa</artifactId>
<version>2.6.4</version>
<scope>compile</scope>
</dependency>
I successfully built the Scala-only project template from the sbt android plugin. Next, I tried to add some Java sources to my project and got the following error in TR.scala. TR.scala is a file generated from the Java sources.
[info] Compiling 2 Scala sources and 5 Java sources to D:\Workspaces\MyProject\my-project\target\scala-2.9.0-1\classes...
[error] D:\Workspaces\MyProject\my-project\target\src_managed\main\scala\com\mydomain\myproject\TR.scala:2: object app is not a member of package com.mydomain.myproject.android
[error] import android.app.Activity
[error] ^
[error] D:\Workspaces\MyProject\my-project\target\src_managed\main\scala\com\mydomain\myproject\TR.scala:3: object view is not a member of package com.mydomain.myproject.android
[error] import android.view.View
[error] ^
[error] two errors found
[error] {file:/D:/Workspaces/MyProject/my-project/}My Project/compile:compile: Compilation failed
[error] Total time: 5 s, completed Oct 12, 2011 11:20:55 AM
Thanks to Yifan Yu's response in Google Groups, it appears to be a bug in the sbt Android plugin. Thanks Jan Berkel, for fixing the bug in this release.
You have a package path named com.mydomain.myproject.android, so
it's confusing the compiler when it tries to compile TR.scala in
'com.mydomain.myproject', because it thinks of 'android.whatever' as a
relative path. The plugin tries to prepend _root_. to the Activity
source it generates, but it forgets to do so for TR.scala.
Well, you didn't say exactly what you did ("add some Java sources"? how's that? cut&pasted code? which code? where? what?), which makes it hard to give a good answer. However, the explanation is actually simple from the error message.
It gives an error when you do "import android.app.Activity". Might that be the Java sources you spoke of? Well, I don't know. But I know you have either imported or are inside the package com.mydomain.myproject.android, because it says so in the message. In other words, you have one of the following:
package com.mydomain.myproject.android
import com.mydomain.myproject._
import com.mydomain.myproject.android
before the other import. What that means is that the following two lines will be equivalent:
import android.app.Activity
import com.mydomain.myproject.android.app.Activity
Which is probably not what you want. You wanted android.app.Activity to be an absolute reference, right? Well, it is not. You can make it absolute like this:
import _root_.android.app.Activity
Or you can just not have a package named android in your project.
In eclipse when I compiled my GWT-modules then I got successful
compilation but when I tried to run my ant script for gwt compilation
I got the following error messages :
[ERROR] Errors in 'file: ../../../... .java'
[java] [ERROR] Line 19: The import com.ensarm.......
cannot be resolved
Finding entry point classes
[java] [ERROR] Unable to find type .....*
[java] [ERROR] Hint: Previous compiler errors may have
made this type unavailable
[java] [ERROR] Hint: Check the inheritance chain from
your module; it may not be inheriting a required module or a module
may not be adding its source path entries properly..
Any idea/suggestion guys ?
Thanks,
Sachin.
Looking at the error it seems that you are missing some jar containing containing the missing classes. You need need to add that jar to the class path. Eclipse can find it but for the ant target the 'compile path' provided should include that jar.
Can you make sure it is there in your compile path.