Apache Camel - UriEndpoint is missing values for attributes title,syntax - java

After upgrade of JBoss Fuse 6.1 -> 6.2 and as a result Apache Camel 2.12 -> 2.15, the following compilation error occurred in one of our custom components:
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] [redacted].java:[11] error: annotation UriEndpoint is missing values for attributes title,syntax
[ERROR] [redacted].java:[8] error: annotation UriEndpoint is missing values for attributes title,syntax
[INFO] 2 errors
*-note that the [redacted] means "removed" or "anonymized" part

The solution was to change from:
#UriEndpoint(scheme = "[redacted]")
to:
#UriEndpoint(scheme = "[redacted]", syntax = "scheme:host:port/path", title = "[redacted]")
More information in #UriEndpoint JavaDoc
The documentation is quite enigmatic ATM.

Related

Is Scala 3 Compatible with Maven?

I am trying to get Maven to compile Scala 3, but I get weird stuff like
[INFO] --- scala-maven-plugin:4.5.4:compile (default) # laboratory ---
[INFO] Using incremental compilation using Mixed compile order
[INFO] compiling 1 Scala source and 10 Java sources to C:\Users\ERIC\Documents\git\loom-lab\laboratory\target\classes ...
[ERROR] C:\Users\ERIC\Documents\git\loom-lab\laboratory\src\main\Scala\net\kolotyluk\loom\HelloScala.scala:<233..233>: '=' expected, but '{' found
[ERROR] C:\Users\ERIC\Documents\git\loom-lab\laboratory\src\main\java\net\kolotyluk\loom\Context.java:<332..332>: unclosed string literal
[ERROR] C:\Users\ERIC\Documents\git\loom-lab\laboratory\src\main\java\net\kolotyluk\loom\Context.java:<595..595>: unclosed string literal
[ERROR] C:\Users\ERIC\Documents\git\loom-lab\laboratory\src\main\java\net\kolotyluk\loom\Context.java:<666..744>: '}' expected but eof found.
[ERROR] C:\Users\ERIC\Documents\git\loom-lab\laboratory\src\main\java\net\kolotyluk\loom\Experiment04_PrimeThreads.java:<16902..16902>: unclosed string literal
[ERROR] C:\Users\ERIC\Documents\git\loom-lab\laboratory\src\main\java\net\kolotyluk\loom\Experiment04_PrimeThreads.java:<17176..17176>: unclosed string literal
[ERROR] C:\Users\ERIC\Documents\git\loom-lab\laboratory\src\main\java\net\kolotyluk\loom\Experiment04_PrimeThreads.java:<28863..28870>: '}' expected but eof found.
[ERROR] 7 errors found
First of all, why are the .java files failing too?
The code for HelloScala.scala is
package net.kolotyluk.loom
import java.time.Instant
import java.util.concurrent.StructuredExecutor
import scala.util.Using
object HelloScala {
def main(args: Array[String]) {
Context.printHeader(HelloScala.getClass)
val results =
Using(StructuredExecutor.open("HelloScala")) { structuredExecutor =>
val futureResults = (0 to 15).map { item =>
println(s"item = $item, Thread ID = ${Thread.currentThread}")
structuredExecutor.fork { () =>
println(s"\ttask = $item, Thread ID = ${Thread.currentThread}")
item
}
}
futureResults.map(_.get)
}
println(results)
}
}
And this compiles just fine using Scala 2.13, so the error message does not make sense.
As an aside, in IntelliJ, I cannot get Scala 3 to build, that fails for different reasons...
The reason for the error in HelloScala.scala is that procedure syntax was dropped: https://docs.scala-lang.org/scala3/reference/dropped-features/procedure-syntax.html
Instead, use
def main(args: Array[String]): Unit = {

errors when trying extract package name from Class variable

In my current project, i have this code:
for(Annotation annotation : field.getAnnotations()) {
String package = annotation.annotationType().getPackage().getName();
if(package.equals("com.loja.annotations.input_type"))
input.setAttribute("type", annotation.annotationType().getSimpleName());
}
when i try build the project, this code causes a compilation failure due to this error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project store: Compilation failure: Compilation failure:
[ERROR] /c:/Users/Kleber Mota/Documents/GitHub/app/src/main/java/com/loja/thymeleaf/processor/form/InputProcessor.java:[37,11] not a statement
[ERROR] /c:/Users/Kleber Mota/Documents/GitHub/app/src/main/java/com/loja/thymeleaf/processor/form/InputProcessor.java:[37,17] ';' expected
[ERROR] /c:/Users/Kleber Mota/Documents/GitHub/app/src/main/java/com/loja/thymeleaf/processor/form/InputProcessor.java:[38,14] illegal start of expression
[ERROR] /c:/Users/Kleber Mota/Documents/GitHub/app/src/main/java/com/loja/thymeleaf/processor/form/InputProcessor.java:[38,21] illegal start of expression
[ERROR] /c:/Users/Kleber Mota/Documents/GitHub/app/src/main/java/com/loja/thymeleaf/processor/form/InputProcessor.java:[38,28] ';' expected
[ERROR] /c:/Users/Kleber Mota/Documents/GitHub/app/src/main/java/com/loja/thymeleaf/processor/form/InputProcessor.java:[38,22] variable declaration not allowed here
anyone can see what's wrong here?
line 37 is: String package = annotation.annotationType().getPackage().getName(); and line 38 is if(package.equals("com.loja.annotations.input_type"))
you can try this..
annotation.annotationType().getName();
You can print out your "package" variable after line 37 (before if).
I wrote and ran the similar code and it worked for me. I created a custom annotation in my api package and line 37 returned "api".

Upgrading from apache poi's 3.2.final to 3.11 beta version giving some errors

I am trying to upgrade from org.apache.poi 3.2 to org.apache.poi 3.11 beta version. Doing so is issuing the following error
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project xyzxyz: Compilation failure
[ERROR] xxxx.java:[648,34] method setRegion in class xyzz cannot be applied to given types;
[ERROR] required: org.apache.poi.hssf.util.CellRangeAddress
[ERROR] found: org.apache.poi.ss.util.CellRangeAddress
[ERROR] reason: actual argument org.apache.poi.ss.util.CellRangeAddress cannot be converted to org.apache.poi.hssf.util.CellRangeAddress by method invocation conversion
Futhermore below is a part of the code which gives compilation error.
method(xyzz excelBean){
HSSFSheet workSheet = excelBean.getWorkSheet();
CellRangeAddress region = new CellRangeAddress(rownum, rownum
+ rowSpan - 1, colNum,
(colSpan - 1 + colNum));
workSheet.addMergedRegion(region);
excelBean.setRegion(region);
}
What exactly is the issue and how do I fix it?

Error in parsing Aramex WSDL file

When I'm trying to parse the Aramex shipping services WSDL (which is needed to create shipments), a namespace error occurs with following error log:
C:\Program Files\Java\jdk1.6.0_37\bin>wsimport.exe -keep -verbose D:\ATG\aramex\shipping-services-api-wsdl\shipping-services-api-wsdl.wsdl -d D:\ATG\aramex\java\
parsing WSDL...
[WARNING] src-resolve.4.2: Error resolving component 'ser:guid'. It was detected that 'ser:guid' is in namespace 'http://schemas.microsoft.com/2003/10/Serialization/', but components from this namespace are not referenceable from schema document 'file:/D:/ATG/aramex/shipping-services-api-wsdl/shipping-services-api-wsdl.wsdl#types?schema1'. If this is the incorrect namespace, perhaps the prefix of 'ser:guid'
needs to be changed. If this is the correct namespace, then an appropriate 'import' tag should be added to 'file:/D:/ATG/aramex/shipping-services-api-wsdl/shipping-services-api-wsdl.wsdl#types?schema1'.
line 331 of file:/D:/ATG/aramex/shipping-services-api-wsdl/shipping-services-api-wsdl.wsdl#types?schema1
[ERROR] Two declarations cause a collision in the ObjectFactory class.
line 126 of file:/D:/ATG/aramex/shipping-services-api-wsdl/shipping-services-api-wsdl.wsdl
[ERROR] (Related to above error) This is the other declaration.
line 57 of file:/D:/ATG/aramex/shipping-services-api-wsdl/shipping-services-api-wsdl.wsdl
How can I get rid of the error?
OK i resolved it. I changed one declaration and after the it worked.

Play! 2.1 Forms broken after updating a Play! 2.0 app

The simple code snippet speaks for itself.
[error] Form<User> userForm = Form.form(User.class).bindFromRequest();
[error] ^
[error] symbol: method form()
[error] location: class Form
I've checked documentation : http://www.playframework.com/documentation/2.1.0/JavaForms
Doesn't understand what's going on...
The documentation is clear about that :
http://www.playframework.com/documentation/2.1.0/Migration
and the Java API is clear too :
http://www.playframework.com/documentation/api/2.1.0/java/play/data/Form.html#form(java.lang.Class)
Form<User> userForm = form(User.class);
OR
DynamicForm requestData = form().bindFromRequest();
Shifting from play 2.0.x to 2.1.x gives error for above code.
solution:
play.data.Form.* is a static import.
use import static play.data.Form.*; in your file & error will get resolved.
The form method has been moved in version 2.1.
Check that you are actually using play.data.Form.form() (it was previsously in play.mvc.Controller.Form if I remember well).
If you did change that, try a play clean clean-all and re-run a compilation. It should work then...

Categories