After switching to Sleuth 3.0.2 TracerContext is always null - spring-cloud

I have upgraded Sleuth to version 3.0.2 and started getting NPEs.
I know that there were breaking changes, and there is a migration guide, but for the life of me I cannot say how to resolve this issue.
[INFO] +- org.springframework.cloud:spring-cloud-starter-sleuth:jar:3.0.2:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-aop:jar:2.4.5:compile
[INFO] | | \- org.aspectj:aspectjweaver:jar:1.9.6:compile
[INFO] | +- org.springframework.cloud:spring-cloud-sleuth-autoconfigure:jar:3.0.2:compile
[INFO] | | +- org.springframework.cloud:spring-cloud-sleuth-instrumentation:jar:3.0.2:compile
[INFO] | | | \- org.springframework.cloud:spring-cloud-sleuth-api:jar:3.0.2:compile
[INFO] | | \- org.aspectj:aspectjrt:jar:1.9.6:compile
[INFO] | \- org.springframework.cloud:spring-cloud-sleuth-brave:jar:3.0.2:compile
[INFO] | +- io.zipkin.brave:brave:jar:5.13.2:compile
[INFO] | +- io.zipkin.brave:brave-context-slf4j:jar:5.13.2:compile
[INFO] | +- io.zipkin.brave:brave-instrumentation-messaging:jar:5.13.2:compile
[INFO] | +- io.zipkin.brave:brave-instrumentation-rpc:jar:5.13.2:compile
[INFO] | +- io.zipkin.brave:brave-instrumentation-spring-rabbit:jar:5.13.2:compile
[INFO] | +- io.zipkin.brave:brave-instrumentation-kafka-clients:jar:5.13.2:compile
[INFO] | +- io.zipkin.brave:brave-instrumentation-kafka-streams:jar:5.13.2:compile
[INFO] | +- io.zipkin.brave:brave-instrumentation-httpclient:jar:5.13.2:compile
[INFO] | | \- io.zipkin.brave:brave-instrumentation-http:jar:5.13.2:compile
[INFO] | +- io.zipkin.brave:brave-instrumentation-httpasyncclient:jar:5.13.2:compile
[INFO] | +- io.zipkin.brave:brave-instrumentation-jms:jar:5.13.2:compile
[INFO] | +- io.zipkin.brave:brave-instrumentation-mongodb:jar:5.13.2:compile
[INFO] | +- io.zipkin.aws:brave-propagation-aws:jar:0.21.3:compile
[INFO] | \- io.zipkin.reporter2:zipkin-reporter-metrics-micrometer:jar:2.16.1:compile
[INFO] | \- io.zipkin.reporter2:zipkin-reporter:jar:2.16.1:compile
[INFO] | \- io.zipkin.zipkin2:zipkin:jar:2.23.0:compile
The field that is being injected.
#Autowired
protected Tracer tracer;
The line that is throwing NPE:
tracer.currentSpan().context().traceId();
The currentSpan() method, where ThreadContext is null.
#Nullable
public Span currentSpan() {
TraceContext context = this.currentTraceContext.get();
return context == null ? null : new LazySpan(this, context);
}
Also this line is producing null: String traceId = MDC.get("X-B3-TraceId");
MDC.getCopyOfContextMap(); returns an empty map.
Here is the code of the method for the completeness of the picture:
#GetMapping(path = "/user", produces = APPLICATION_JSON_VALUE)
#RequiresPermissions(IAM_USER_GET_PERMISSION)
public Object getMyself() {
UserContext userContext = (UserContext) SecurityUtils.getSubject().getPrincipal();
String traceId = MDC.get("X-B3-TraceId");
System.out.println(traceId);
System.out.println(MDC.getCopyOfContextMap());
OperationContext operationContext = OperationContext.newInstance(userContext, tracer.currentSpan().context().traceId());
UserBO user = identityManager.getMyself(operationContext);
return ResponseEntity.status(HttpStatus.OK).body(new UserEnvelopeDTO(iamDTOMapper.mapScoped(user, user.getActiveOrganizationId())));
}
As you can see this is an HTTP thread, that doesn't get MDC properly populated.
Also, I have this bean configured:
#Bean
public CurrentTraceContext.ScopeDecorator legacyMDCKeys() {
return MDCScopeDecorator.newBuilder()
.clear()
.add(CorrelationScopeConfig.SingleCorrelationField.newBuilder(BaggageFields.TRACE_ID)
.name("X-B3-TraceId").build())
.add(CorrelationScopeConfig.SingleCorrelationField.newBuilder(BaggageFields.PARENT_ID)
.name("X-B3-ParentSpanId").build())
.add(CorrelationScopeConfig.SingleCorrelationField.newBuilder(BaggageFields.SPAN_ID)
.name("X-B3-SpanId").build())
.add(CorrelationScopeConfig.SingleCorrelationField.newBuilder(BaggageFields.SAMPLED)
.name("X-Span-Export").build())
.build();
}

Related

kie-maven-plugin fails to generate model with a mix of Java and DRL facts

I'm trying to generate a fully compiled kmodule with kie-maven-plugin. It works when all facts are defined in DRL, but fails when some facts are defined as Java POJOs.
In the same project:
Java fact (src\main\java\org\example\FactA.java):
package org.example;
public class FactA {
private String propA;
public FactA() { }
public FactA(String propA) {
this.propA = propA;
}
public String getPropA() {
return propA;
}
public void setPropA(String propA) {
this.propA = propA;
}
}
DRL Fact (src\main\resources\org\example\decB.drl):
package org.example
import org.example.FactA
declare FactB
factA: FactA
propB : String
end
POM:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<properties>
<generateModel>YES</generateModel>
<runtime.version>7.20.0.Final</runtime.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<groupId>org</groupId>
<artifactId>example</artifactId>
<version>1.0.0</version>
<packaging>kjar</packaging>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-bom</artifactId>
<version>${runtime.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-api</artifactId>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-model-compiler</artifactId>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-canonical-model</artifactId>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-core</artifactId>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.kie</groupId>
<artifactId>kie-maven-plugin</artifactId>
<version>${runtime.version}</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
</project>
Output of mvn clean package
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------------< org:example >-----------------------------
[INFO] Building example 1.0.0
[INFO] --------------------------------[ kjar ]--------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # example ---
[INFO] Deleting C:\Projects\t\kie-maven-plugin-example\target
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) # example ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) # example ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Compiling 1 source file to C:\Projects\t\kie-maven-plugin-example\target\classes
[INFO]
[INFO] --- kie-maven-plugin:7.20.0.Final:generateModel (default-generateModel) # example ---
[INFO] Loading kie.conf from jar:file:/C:/Users/Dmitri/.m2/repository/org/drools/drools-core/7.20.0.Final/drools-core-7.20.0.Final.jar!/META-INF/kie.conf in classloader ClassRealm[extension>org.kie:kie-maven-plugin:7.20.0.Final, parent: sun.misc.Launcher$AppClassLoader#7852e922]
[INFO] Adding Service org.drools.core.io.impl.ResourceFactoryServiceImpl
[INFO] Adding Service org.drools.core.marshalling.impl.MarshallerProviderImpl
[INFO] Adding Service org.drools.core.concurrent.ExecutorProviderImpl
[INFO] Loading kie.conf from jar:file:/C:/Users/Dmitri/.m2/repository/org/drools/drools-compiler/7.20.0.Final/drools-compiler-7.20.0.Final.jar!/META-INF/kie.conf in classloader ClassRealm[extension>org.kie:kie-maven-plugin:7.20.0.Final, parent: sun.misc.Launcher$AppClassLoader#7852e922]
[INFO] Adding Service org.drools.compiler.kie.builder.impl.KieServicesImpl
[INFO] Adding Service org.drools.compiler.builder.impl.KnowledgeBuilderFactoryServiceImpl
[INFO] Loading kie.conf from jar:file:/C:/Users/Dmitri/.m2/repository/org/drools/drools-model-compiler/7.20.0.Final/drools-model-compiler-7.20.0.Final.jar!/META-INF/kie.conf in classloader ClassRealm[extension>org.kie:kie-maven-plugin:7.20.0.Final, parent: sun.misc.Launcher$AppClassLoader#7852e922]
[INFO] Adding Service org.drools.modelcompiler.CanonicalKieModuleProvider
[INFO] Loading kie.conf from jar:file:/C:/Users/Dmitri/.m2/repository/org/kie/kie-internal/7.20.0.Final/kie-internal-7.20.0.Final.jar!/META-INF/kie.conf in classloader ClassRealm[extension>org.kie:kie-maven-plugin:7.20.0.Final, parent: sun.misc.Launcher$AppClassLoader#7852e922]
[INFO] Adding Service org.kie.internal.services.KieAssemblersImpl
[INFO] Adding Service org.kie.internal.services.KieRuntimesImpl
[INFO] Adding Service org.kie.internal.services.KieWeaversImpl
[INFO] Adding Service org.kie.internal.services.KieBeliefsImpl
[INFO] Loading kie.conf from jar:file:/C:/Users/Dmitri/.m2/repository/org/drools/drools-decisiontables/7.20.0.Final/drools-decisiontables-7.20.0.Final.jar!/META-INF/kie.conf in classloader ClassRealm[extension>org.kie:kie-maven-plugin:7.20.0.Final, parent: sun.misc.Launcher$AppClassLoader#7852e922]
[INFO] Adding Service org.drools.decisiontable.DecisionTableProviderImpl
[INFO] Loading kie.conf from jar:file:/C:/Users/Dmitri/.m2/repository/org/drools/drools-scorecards/7.20.0.Final/drools-scorecards-7.20.0.Final.jar!/META-INF/kie.conf in classloader ClassRealm[extension>org.kie:kie-maven-plugin:7.20.0.Final, parent: sun.misc.Launcher$AppClassLoader#7852e922]
[INFO] Adding Service org.drools.scorecards.ScoreCardProviderImpl
[INFO] Loading kie.conf from jar:file:/C:/Users/Dmitri/.m2/repository/org/drools/kie-pmml/7.20.0.Final/kie-pmml-7.20.0.Final.jar!/META-INF/kie.conf in classloader ClassRealm[extension>org.kie:kie-maven-plugin:7.20.0.Final, parent: sun.misc.Launcher$AppClassLoader#7852e922]
[INFO] Adding Service +org.kie.pmml.assembler.PMMLAssemblerService
[INFO] Loading kie.conf from jar:file:/C:/Users/Dmitri/.m2/repository/org/jbpm/jbpm-bpmn2/7.20.0.Final/jbpm-bpmn2-7.20.0.Final.jar!/META-INF/kie.conf in classloader ClassRealm[extension>org.kie:kie-maven-plugin:7.20.0.Final, parent: sun.misc.Launcher$AppClassLoader#7852e922]
[INFO] Adding Service org.jbpm.bpmn2.BPMN2ProcessProviderImpl
[INFO] Adding Service org.jbpm.bpmn2.xml.XmlProcessDumperFactoryServiceImpl
[INFO] Loading kie.conf from jar:file:/C:/Users/Dmitri/.m2/repository/org/jbpm/jbpm-flow-builder/7.20.0.Final/jbpm-flow-builder-7.20.0.Final.jar!/META-INF/kie.conf in classloader ClassRealm[extension>org.kie:kie-maven-plugin:7.20.0.Final, parent: sun.misc.Launcher$AppClassLoader#7852e922]
[INFO] Adding Service org.jbpm.process.builder.ProcessBuilderFactoryServiceImpl
[INFO] Adding Service +org.jbpm.assembler.BPMN2AssemblerService
[INFO] Adding Service +org.jbpm.weaver.BPMN2WeaverService
[INFO] Adding Service +org.jbpm.assembler.DRFAssemblerService
[INFO] Adding Service +org.jbpm.weaver.DRFWeaverService
[INFO] Loading kie.conf from jar:file:/C:/Users/Dmitri/.m2/repository/org/jbpm/jbpm-flow/7.20.0.Final/jbpm-flow-7.20.0.Final.jar!/META-INF/kie.conf in classloader ClassRealm[extension>org.kie:kie-maven-plugin:7.20.0.Final, parent: sun.misc.Launcher$AppClassLoader#7852e922]
[INFO] Adding Service org.jbpm.marshalling.impl.ProcessMarshallerFactoryServiceImpl
[INFO] Adding Service org.jbpm.process.instance.ProcessRuntimeFactoryServiceImpl
[INFO] Loading kie.conf from jar:file:/C:/Users/Dmitri/.m2/repository/org/jbpm/jbpm-case-mgmt-cmmn/7.20.0.Final/jbpm-case-mgmt-cmmn-7.20.0.Final.jar!/META-INF/kie.conf in classloader ClassRealm[extension>org.kie:kie-maven-plugin:7.20.0.Final, parent: sun.misc.Launcher$AppClassLoader#7852e922]
[INFO] Adding Service org.jbpm.casemgmt.cmmn.CMMNCaseProviderImpl
[INFO] Adding Service +org.jbpm.casemgmt.cmmn.assembler.CMMNAssemblerService
[INFO] Loading kie.conf from jar:file:/C:/Users/Dmitri/.m2/repository/org/drools/drools-workbench-models-guided-dtable/7.20.0.Final/drools-workbench-models-guided-dtable-7.20.0.Final.jar!/META-INF/kie.conf in classloader ClassRealm[extension>org.kie:kie-maven-plugin:7.20.0.Final, parent: sun.misc.Launcher$AppClassLoader#7852e922]
[INFO] Adding Service org.drools.workbench.models.guided.dtable.backend.GuidedDecisionTableProviderImpl
[INFO] Loading kie.conf from jar:file:/C:/Users/Dmitri/.m2/repository/org/drools/drools-workbench-models-guided-template/7.20.0.Final/drools-workbench-models-guided-template-7.20.0.Final.jar!/META-INF/kie.conf in classloader ClassRealm[extension>org.kie:kie-maven-plugin:7.20.0.Final, parent: sun.misc.Launcher$AppClassLoader#7852e922]
[INFO] Adding Service org.drools.workbench.models.guided.template.backend.GuidedRuleTemplateProviderImpl
[INFO] Loading kie.conf from jar:file:/C:/Users/Dmitri/.m2/repository/org/drools/drools-workbench-models-guided-scorecard/7.20.0.Final/drools-workbench-models-guided-scorecard-7.20.0.Final.jar!/META-INF/kie.conf in classloader ClassRealm[extension>org.kie:kie-maven-plugin:7.20.0.Final, parent: sun.misc.Launcher$AppClassLoader#7852e922]
[INFO] Adding Service org.drools.workbench.models.guided.scorecard.backend.GuidedScoreCardProviderImpl
[INFO] Loading kie.conf from jar:file:/C:/Users/Dmitri/.m2/repository/org/optaplanner/optaplanner-core/7.20.0.Final/optaplanner-core-7.20.0.Final.jar!/META-INF/kie.conf in classloader ClassRealm[extension>org.kie:kie-maven-plugin:7.20.0.Final, parent: sun.misc.Launcher$AppClassLoader#7852e922]
[INFO] Adding Service +org.optaplanner.core.impl.solver.kie.KieSolverAssemblerService
[INFO] Loading kie.conf from jar:file:/C:/Users/Dmitri/.m2/repository/org/kie/kie-dmn-core/7.20.0.Final/kie-dmn-core-7.20.0.Final.jar!/META-INF/kie.conf in classloader ClassRealm[extension>org.kie:kie-maven-plugin:7.20.0.Final, parent: sun.misc.Launcher$AppClassLoader#7852e922]
[INFO] Adding Service +org.kie.dmn.core.assembler.DMNAssemblerService
[INFO] Adding Service +org.kie.dmn.core.runtime.DMNRuntimeService
[INFO] Adding Service +org.kie.dmn.core.weaver.DMNWeaverService
[INFO] Artifact not fetched from maven: org.drools:drools-bom:${runtime.version}. To enable the KieScanner you need kie-ci on the classpath
[ERROR] package org.example
public class FactB implements org.drools.core.factmodel.GeneratedFact, java.io.Serializable {
public FactB() {
}
public FactB(FactA factA, String propB) {
super();
this.factA = factA;
this.propB = propB;
}
#org.kie.api.definition.type.Position(value = 0)
private FactA factA;
public void setFactA(FactA factA) {
this.factA = factA;
}
public FactA getFactA() {
return factA;
}
#org.kie.api.definition.type.Position(value = 1)
private String propB;
public void setPropB(String propB) {
this.propB = propB;
}
public String getPropB() {
return propB;
}
#Override()
public String toString() {
return "FactB" + "( " + "factA=" + factA + ", " + "propB=" + propB + " )";
}
}
[ERROR] Unable to build KieBaseModel:defaultKieBase
CompilationProblemErrorResult: cannot find symbol
symbol: class FactA
location: package org.example
CompilationProblemErrorResult: cannot find symbol
symbol: class FactA
location: class org.example.FactB
CompilationProblemErrorResult: cannot find symbol
symbol: class FactA
location: class org.example.FactB
CompilationProblemErrorResult: cannot find symbol
symbol: class FactA
location: class org.example.FactB
CompilationProblemErrorResult: cannot find symbol
symbol: class FactA
location: class org.example.FactB
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.465 s
[INFO] Finished at: 2019-04-26T09:00:16-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.kie:kie-maven-plugin:7.20.0.Final:generateModel (default-generateModel) on project example: Execution default-generateModel of goal org.kie:kie-maven-plugin:7.20.0.Final:generateModel failed: Unable to get KieModule, Errors Existed: Error Messages:
[ERROR] Message [id=1, kieBase=defaultKieBase, level=ERROR, path=null, line=5, column=0
[ERROR] text=cannot find symbol
[ERROR] symbol: class FactA
[ERROR] location: package org.example]
[ERROR] Message [id=2, kieBase=defaultKieBase, level=ERROR, path=null, line=12, column=0
[ERROR] text=cannot find symbol
[ERROR] symbol: class FactA
[ERROR] location: class org.example.FactB]
[ERROR] Message [id=3, kieBase=defaultKieBase, level=ERROR, path=null, line=19, column=0
[ERROR] text=cannot find symbol
[ERROR] symbol: class FactA
[ERROR] location: class org.example.FactB]
[ERROR] Message [id=4, kieBase=defaultKieBase, level=ERROR, path=null, line=21, column=0
[ERROR] text=cannot find symbol
[ERROR] symbol: class FactA
[ERROR] location: class org.example.FactB]
[ERROR] Message [id=5, kieBase=defaultKieBase, level=ERROR, path=null, line=25, column=0
[ERROR] text=cannot find symbol
[ERROR] symbol: class FactA
[ERROR] location: class org.example.FactB]
[ERROR] ---
[ERROR] Warning Messages:
[ERROR] ---
[ERROR] Info Messages:
[ERROR]
[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/PluginExecutionException
It's probably a bug in the generation of declared types with the executable model.
Can you kindly post your reproducer here?
https://issues.jboss.org/projects/DROOLS/issues
In the meanwhile, as a workaround, can you try use the fully qualified name while using the class in the declared type?
package org.example
declare FactB
factA: org.example.FactA
propB : String
end
I've tried this against current master and it works.
Thanks for your help
It was a bug fixed here
https://github.com/kiegroup/drools/commit/c36f3ebf1f02e54742c8b4056e7b64bb5deaed07
Thanks for reporting

Gwt Overlay Compilation error whenever method gets used

I am trying to test getting rid of gwt-rpc entrypoints and instead use JAX-RS / JSON based entrypoints.
To do this, I am simply using the native GWT RequestBuilder apis.
As per the documentation here referenced next.
http://www.gwtproject.org/doc/latest/tutorial/JSON.html
The problem I am facing is that the compiler seems unhappy about letting me make use of any overlay API, namely any method that has no java code to be compiled and that is flagged as native.
I am of course using the latest, and greatest, gwt 2.8 compiler.
If I write my overlay as follows.
public class UserLoginGwtRpcMessageOverlay extends JavaScriptObject {
/**
* Mandatory PROTECTED no arguments constructor.
*/
protected UserLoginGwtRpcMessageOverlay() {
super();
}
public final native String getUserName(); /*
* { return userName; }
*/
public final native String getHashedPassword(); /*
* { return hashedPassword;
* }
*/
public final String toStringOverlay() {
return getUserName() + "-" + getHashedPassword();
}
The class will not compile.
And it will not compile because my artifical toString is making use of the overlay APIs, e.g. ( getUserName()).
If I were to take those calls out of the class, it the compiler would not break handling the class.
Going further, If I try to make a rest call as follows:
private void invokeRestService() {
try {
// (a) prepare the JSON request to the server
RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, JSON_URL);
// (b) send an HTTP Json request
Request request = builder.sendRequest(null, new RequestCallback() {
// (i) callback handler when there is an error
public void onError(Request request, Throwable exception) {
LOGGER.log(Level.SEVERE, "Couldn't retrieve JSON", exception);
}
// (ii) callback result on success
public void onResponseReceived(Request request, Response response) {
if (200 == response.getStatusCode()) {
UserLoginGwtRpcMessageOverlay responseOverlay = JsonUtils
.<UserLoginGwtRpcMessageOverlay>safeEval(response.getText());
LOGGER.info("responseOverlay: " + responseOverlay.getUserName());
} else {
LOGGER.log(Level.SEVERE, "Couldn't retrieve JSON (" + response.getStatusText() + ")");
}
}
});
} catch (RequestException e) {
LOGGER.log(Level.SEVERE, "Couldn't execute request ", e);
}
}
Again, the compilation shall fail.
Once more this is the result of me trying to use the getUserName().
In particular, the followig line of code breaks the compiler.
LOGGER.info("responseOverlay: " + responseOverlay.getUserName());
Given that the compiler is running null pointer exceptions giving no other hint besides:
<no source info>: <source info not available>
I suspect I am dealing either with a compiler bug, or a feature that somehow got de-supported and whose APIs still linger. But at the same time, I would be surprised as I would assume overlays to be a core part of GWT, this should just work. So more likely I have some bug in the code I am not spotting.
QUOTE FULL compile error:
[INFO] --- gwt-maven-plugin:2.8.0:compile (gwt-compile) #
jntl-expenses-frontend --- [INFO] Compiling module
org.gwtproject.tutorial.TodoList [INFO] Compiling 1 permutation
[INFO] Compiling permutation 0... [INFO] [ERROR] An
internal compiler exception occurred [INFO]
com.google.gwt.dev.jjs.InternalCompilerException: Unexpected error
during visit. [INFO] at
com.google.gwt.dev.jjs.ast.JVisitor.translateException(JVisitor.java:111)
[INFO] at
com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:276)
[INFO] at
com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:265)
[INFO] at
com.google.gwt.dev.jjs.impl.MakeCallsStatic$CreateStaticImplsVisitor.visit(MakeCallsStatic.java:222)
[INFO] at
com.google.gwt.dev.jjs.ast.JMethod.traverse(JMethod.java:777) [INFO]
at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:127)
[INFO] at
com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:122) [INFO]
at
com.google.gwt.dev.jjs.impl.MakeCallsStatic$CreateStaticImplsVisitor.getOrCreateStaticImpl(MakeCallsStatic.java:240)
[INFO] at
com.google.gwt.dev.jjs.impl.Devirtualizer$RewriteVirtualDispatches.ensureDevirtualVersionExists(Devirtualizer.java:271)
[INFO] at
com.google.gwt.dev.jjs.impl.Devirtualizer$RewriteVirtualDispatches.endVisit(Devirtualizer.java:160)
[INFO] at
com.google.gwt.dev.jjs.ast.JMethodCall.traverse(JMethodCall.java:268)
[INFO] at
com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:361)
[INFO] at
com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:273)
[INFO] at
com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:265)
[INFO] at
com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:118) [INFO]
at
com.google.gwt.dev.jjs.ast.JBinaryOperation.traverse(JBinaryOperation.java:89)
[INFO] at
com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:361)
[INFO] at
com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:273)
[INFO] at
com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:265)
[INFO] at
com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:118) [INFO]
at
com.google.gwt.dev.jjs.ast.JExpressionStatement.traverse(JExpressionStatement.java:42)
[INFO] at
com.google.gwt.dev.jjs.ast.JModVisitor$ListContext.traverse(JModVisitor.java:88)
[INFO] at
com.google.gwt.dev.jjs.ast.JModVisitor.acceptWithInsertRemove(JModVisitor.java:331)
[INFO] at com.google.gwt.dev.jjs.ast.JBlock.traverse(JBlock.java:92)
[INFO] at
com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:361)
[INFO] at
com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:273)
[INFO] at
com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:139) [INFO]
at
com.google.gwt.dev.jjs.ast.JIfStatement.traverse(JIfStatement.java:53)
[INFO] at
com.google.gwt.dev.jjs.ast.JModVisitor$ListContext.traverse(JModVisitor.java:88)
[INFO] at
com.google.gwt.dev.jjs.ast.JModVisitor.acceptWithInsertRemove(JModVisitor.java:331)
[INFO] at com.google.gwt.dev.jjs.ast.JBlock.traverse(JBlock.java:92)
[INFO] at
com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:361)
[INFO] at
com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:273)
[INFO] at
com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:139) [INFO]
at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:135)
[INFO] at
com.google.gwt.dev.jjs.ast.JMethodBody.traverse(JMethodBody.java:83)
[INFO] at
com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:361)
[INFO] at
com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:273)
[INFO] at
com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:265)
[INFO] at
com.google.gwt.dev.jjs.ast.JMethod.visitChildren(JMethod.java:786)
[INFO] at
com.google.gwt.dev.jjs.ast.JMethod.traverse(JMethod.java:778) [INFO]
at
com.google.gwt.dev.jjs.ast.JModVisitor$ListContextImmutable.traverse(JModVisitor.java:169)
[INFO] at
com.google.gwt.dev.jjs.ast.JModVisitor.acceptWithInsertRemoveImmutable(JModVisitor.java:336)
[INFO] at
com.google.gwt.dev.jjs.ast.JClassType.traverse(JClassType.java:147)
[INFO] at
com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:361)
[INFO] at
com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:273)
[INFO] at
com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:265)
[INFO] at
com.google.gwt.dev.jjs.ast.JProgram.visitModuleTypes(JProgram.java:1284)
[INFO] at
com.google.gwt.dev.jjs.ast.JProgram.traverse(JProgram.java:1249)
[INFO] at
com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:361)
[INFO] at
com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:273)
[INFO] at
com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:265)
[INFO] at
com.google.gwt.dev.jjs.impl.Devirtualizer.execImpl(Devirtualizer.java:409)
[INFO] at
com.google.gwt.dev.jjs.impl.Devirtualizer.exec(Devirtualizer.java:324)
[INFO] at
com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.normalizeSemantics(JavaToJavaScriptCompiler.java:489)
[INFO] at
com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.compilePermutation(JavaToJavaScriptCompiler.java:364)
[INFO] at
com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.compilePermutation(JavaToJavaScriptCompiler.java:272)
[INFO] at
com.google.gwt.dev.CompilePerms.compile(CompilePerms.java:198) [INFO]
at
com.google.gwt.dev.ThreadedPermutationWorkerFactory$ThreadedPermutationWorker.compile(ThreadedPermutationWorkerFactory.java:50)
[INFO] at
com.google.gwt.dev.PermutationWorkerFactory$Manager$WorkerThread.run(PermutationWorkerFactory.java:74)
[INFO] at java.lang.Thread.run(Thread.java:745) [INFO] Caused by:
java.lang.NullPointerException [INFO] at
com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:361)
[INFO] at
com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:273)
[INFO] ... 59 more [INFO] [ERROR] : [INFO] [ERROR] at
UserLoginGwtRpcMessageOverlay.java(23):
org.gwtproject.tutorial.client.overlay.UserLoginGwtRpcMessageOverlay.getUserName()Ljava/lang/String;
[INFO] com.google.gwt.dev.jjs.ast.JMethod [INFO]
[ERROR] at TodoList.java(148): responseOverlay.getUserName() [INFO]
com.google.gwt.dev.jjs.ast.JMethodCall [INFO] [ERROR] at
TodoList.java(148): "responseOverlay: " +
responseOverlay.getUserName() [INFO]
com.google.gwt.dev.jjs.ast.JBinaryOperation [INFO] [ERROR] at
TodoList.java(148): "responseOverlay: " +
responseOverlay.getUserName() [INFO]
com.google.gwt.dev.jjs.ast.JExpressionStatement [INFO]
[ERROR] at TodoList.java(145): { [INFO] final
UserLoginGwtRpcMessageOverlay responseOverlay =
(UserLoginGwtRpcMessageOverlay)
JsonUtils.safeEval(response.getText()); [INFO] TodoList.$clinit();
[INFO] "responseOverlay: " + responseOverlay.getUserName(); [INFO] }
[INFO] com.google.gwt.dev.jjs.ast.JBlock [INFO]
[ERROR] at TodoList.java(145): if (200 == response.getStatusCode()) {
[INFO] final UserLoginGwtRpcMessageOverlay responseOverlay =
(UserLoginGwtRpcMessageOverlay)
JsonUtils.safeEval(response.getText()); [INFO] TodoList.$clinit();
[INFO] "responseOverlay: " + responseOverlay.getUserName(); [INFO] }
else { [INFO] TodoList.$clinit(); [INFO] Level.$clinit(); [INFO]
"Couldn\'t retrieve JSON (" + response.getStatusText() + ")"; [INFO] }
[INFO] com.google.gwt.dev.jjs.ast.JIfStatement [INFO]
[ERROR] at TodoList.java(144): { [INFO] if (200 ==
response.getStatusCode()) { [INFO] final
UserLoginGwtRpcMessageOverlay responseOverlay =
(UserLoginGwtRpcMessageOverlay)
JsonUtils.safeEval(response.getText()); [INFO] TodoList.$clinit();
[INFO] "responseOverlay: " + responseOverlay.getUserName(); [INFO]
} else { [INFO] TodoList.$clinit(); [INFO] Level.$clinit();
[INFO] "Couldn\'t retrieve JSON (" + response.getStatusText() +
")"; [INFO] } [INFO] } [INFO]
com.google.gwt.dev.jjs.ast.JBlock [INFO] [ERROR] at
TodoList.java(144): { [INFO] if (200 == response.getStatusCode()) {
[INFO] final UserLoginGwtRpcMessageOverlay responseOverlay =
(UserLoginGwtRpcMessageOverlay)
JsonUtils.safeEval(response.getText()); [INFO] TodoList.$clinit();
[INFO] "responseOverlay: " + responseOverlay.getUserName(); [INFO]
} else { [INFO] TodoList.$clinit(); [INFO] Level.$clinit();
[INFO] "Couldn\'t retrieve JSON (" + response.getStatusText() +
")"; [INFO] } [INFO] } [INFO]
com.google.gwt.dev.jjs.ast.JMethodBody [INFO] [ERROR] at
TodoList.java(144):
org.gwtproject.tutorial.client.TodoList$3.onResponseReceived(Lcom/google/gwt/http/client/Request;Lcom/google/gwt/http/client/Response;)V
[INFO] com.google.gwt.dev.jjs.ast.JMethod [INFO]
[ERROR] at TodoList.java(136):
org.gwtproject.tutorial.client.TodoList$3 (final extends Object
implements RequestCallback) [INFO]
com.google.gwt.dev.jjs.ast.JClassType [INFO] [ERROR] at
Unknown(0): [INFO]
com.google.gwt.dev.jjs.ast.JProgram
Is anyone else experiencing problems in GWT 2.8 with overlays, or am I making some sort of mistake of which I am not aware.
Kind regards,
Any good pointer is appreciated.
public final native String getUserName(); /*
* { return userName; }
*/
This is not valid JSNI (with the same issue in getHashedPassword()). The correct way to write this would be
public final native String getUserName() /*-{
return userName;
}-*/;
You must start with /*-{ and end with }-*/;, and not have *s inbetween like Javadoc might.
However, as JS, that doesn't make any sense, so while it will compile, it isn't what you want. The body of the method should read
return this.userName;
since JS doesn't have an implicit this like Java does.
At a brief glance, the rest looks okay, but without legal JSNI, the compiler cannot accept it.

Why does sbt fail to resolve spongeapi dependency that gradle can find fine?

I'm getting the following error when attempting to build a project that has previously built fine.
Error:Error while importing SBT project:
...
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
at sbt.std.Transform$$anon$4.work(System.scala:63)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
at sbt.Execute.work(Execute.scala:235)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
[error] sbt.ResolveException: unresolved dependency: org.spongepowered#spongeapi;2.1-SNAPSHOT: not found
[error] Use 'last' for the full log.
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=384M; support was removed in 8.0
See complete log in C:\Users\Ryan\.IntelliJIdea14\system\log\sbt.last.log
build.sbt
name := "MemoryStones"
version := "1.0"
scalaVersion := "2.11.7"
resolvers += "sponge-repo1" at "http://repo.spongepowered.org/maven"
resolvers += Resolver.sonatypeRepo("snapshots")
resolvers += "sonatypeReleases" at "http://oss.sonatype.org/content/repositories/releases/"
libraryDependencies += "org.spongepowered" % "spongeapi" % "2.1-SNAPSHOT"
libraryDependencies += "com.typesafe" % "config" % "1.2.1"
libraryDependencies += "org.scala-lang.modules" % "scala-java8-compat_2.11" % "0.7.0"
libraryDependencies += "org.scala-lang.modules" %% "scala-parser-combinators" % "1.0.4"
assemblyOption in assembly := (assemblyOption in assembly).value.copy(includeScala = false)
However, using the same dependency on a java/gradle project works fine without error, and the dependency resolves fine.
build.gradle
group 'au.id.rleach'
version '0.1-SNAPSHOT'
apply plugin: 'java'
sourceCompatibility = 1.8
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.11'
compile 'org.spongepowered:spongeapi:2.1-SNAPSHOT'
}
repositories {
mavenCentral()
maven {
name = 'sponge'
url = 'http://repo.spongepowered.org/maven'
}
}
I wasn't able to reproduce this issue using sbt 0.13.9.
$ sbt
MemoryStones> update
[info] Updating {file:/Users/eugene/work/quick-test/so-34368203/}so-34368203...
[info] Resolving jline#jline;2.12.1 ...
[info] downloading http://repo.spongepowered.org/maven/org/spongepowered/spongeapi/2.1-SNAPSHOT/spongeapi-2.1-20151219.052344-209.jar ...
[info] [SUCCESSFUL ] org.spongepowered#spongeapi;2.1-SNAPSHOT!spongeapi.jar (1545ms)
[info] downloading https://jcenter.bintray.com/org/scala-lang/modules/scala-java8-compat_2.11/0.7.0/scala-java8-compat_2.11-0.7.0.jar ...
[info] [SUCCESSFUL ] org.scala-lang.modules#scala-java8-compat_2.11;0.7.0!scala-java8-compat_2.11.jar(bundle) (2043ms)
[info] downloading https://jcenter.bintray.com/com/flowpowered/flow-math/1.0.1/flow-math-1.0.1.jar ...
[info] [SUCCESSFUL ] com.flowpowered#flow-math;1.0.1!flow-math.jar (671ms)
[info] downloading https://jcenter.bintray.com/ninja/leaping/configurate/configurate-yaml/3.1/configurate-yaml-3.1.jar ...
[info] [SUCCESSFUL ] ninja.leaping.configurate#configurate-yaml;3.1!configurate-yaml.jar (399ms)
[info] downloading https://jcenter.bintray.com/ninja/leaping/configurate/configurate-gson/3.1/configurate-gson-3.1.jar ...
[info] [SUCCESSFUL ] ninja.leaping.configurate#configurate-gson;3.1!configurate-gson.jar (403ms)
[info] downloading https://jcenter.bintray.com/org/slf4j/slf4j-api/1.7.13/slf4j-api-1.7.13.jar ...
[info] [SUCCESSFUL ] org.slf4j#slf4j-api;1.7.13!slf4j-api.jar (381ms)
[info] downloading http://repo.spongepowered.org/maven/com/flowpowered/flow-noise/1.0.1-SNAPSHOT/flow-noise-1.0.1-20150609.030116-1.jar ...
[info] [SUCCESSFUL ] com.flowpowered#flow-noise;1.0.1-SNAPSHOT!flow-noise.jar (325ms)
[info] downloading http://repo.spongepowered.org/maven/org/spongepowered/event-gen-core/0.10-SNAPSHOT/event-gen-core-0.10-20151125.161414-1.jar ...
[info] [SUCCESSFUL ] org.spongepowered#event-gen-core;0.10-SNAPSHOT!event-gen-core.jar (316ms)
[info] downloading https://jcenter.bintray.com/ninja/leaping/configurate/configurate-hocon/3.1/configurate-hocon-3.1.jar ...
[info] [SUCCESSFUL ] ninja.leaping.configurate#configurate-hocon;3.1!configurate-hocon.jar (409ms)
[info] downloading https://jcenter.bintray.com/org/yaml/snakeyaml/1.16/snakeyaml-1.16.jar ...
[info] [SUCCESSFUL ] org.yaml#snakeyaml;1.16!snakeyaml.jar(bundle) (1447ms)
[info] downloading https://jcenter.bintray.com/ninja/leaping/configurate/configurate-core/3.1/configurate-core-3.1.jar ...
[info] [SUCCESSFUL ] ninja.leaping.configurate#configurate-core;3.1!configurate-core.jar (597ms)
[info] Done updating.
[success] Total time: 40 s, completed Dec 19, 2015 2:10:36 AM
The only change I made from your build file was commenting out the last line since you didn't specify to use sbt-assembly.

Using sbt to build command line application

Anybody successfully followed
http://www.scala-sbt.org/0.13/docs/Command-Line-Applications.html
using latest sbt 0.13.7 ?
I get unresolved dependency "org.scala-sbt#command;0.12.0: not found" for 0.12.0.
Trying command version 0.13.7 gets compile errors in Main.scala file around initialGlobalLogging:
[error] Unspecified value parameter console.
[error] GlobalLogging.initial(MainLogging.globalDefault _, File.crea
teTempFile("hello", "log") )
[error] GlobalLogging.initial(MainLogging.globalDefault _, File.crea
teTempFile("hello", "log") )
Thank you
0.13.7 seems to have updated the type and number of parameters for GlobalLogging.initial().
(http://www.scala-sbt.org/0.13.7/api/#sbt.GlobalLogging$)
Try changing the last two lines in Main.scala:
from
/** Configures logging to log to a temporary backing file as well as to the console.
* An application would need to do more here to customize the logging level and
* provide access to the backing file (like sbt's last command and logLevel setting).*/
def initialGlobalLogging: GlobalLogging =
GlobalLogging.initial(MainLogging.globalDefault _, File.createTempFile("hello", "log"))
to
val consoleOut = ConsoleOut.systemOut
def initialGlobalLogging: GlobalLogging =
GlobalLogging.initial(MainLogging.globalDefault(consoleOut).apply, java.io.File.createTempFile("hello", "log"), consoleOut )
Yes, I got same error. However, the error was resolved by renaming the file as "project/build.properties" and specifying the file via -Dsbt.repository.config:
~/Documents/spark/hello $ sbt -Dsbt.repository.config=./project/build.properties
[info] Loading project definition from /Users/suztomo/Documents/spark/hello/project
[warn] Multiple resolvers having different access mechanism configured with same name 'typesafe-ivy-releases'. To avoid conflict, Remove duplicate project resolvers (`resolvers`) or rename publishing resolver (`publishTo`).
[info] Updating {file:/Users/suztomo/Documents/spark/hello/project/}hello-build...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] downloading https://repo1.maven.org/maven2/org/scala-lang/scala-library/2.10.4/scala-library-2.10.4.jar ...
[info] [SUCCESSFUL ] org.scala-lang#scala-library;2.10.4!scala-library.jar (6413ms)
[info] downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt/0.13.7/jars/sbt.jar ...
[info] [SUCCESSFUL ] org.scala-sbt#sbt;0.13.7!sbt.jar (410ms)
[info] downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/main/0.13.7/jars/main.jar ...
[info] [SUCCESSFUL ] org.scala-sbt#main;0.13.7!main.jar (1955ms)
[info] downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/compiler-interface/0.13.7/jars/compiler-interface-src.jar ...
[info] [SUCCESSFUL ] org.scala-sbt#compiler-interface;0.13.7!compiler-interface-src.jar (197ms)
[info] downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/compiler-interface/0.13.7/jars/compiler-interface-bin.jar ...
[info] [SUCCESSFUL ] org.scala-sbt#compiler-interface;0.13.7!compiler-interface-bin.jar (304ms)
[info] downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/precompiled-2_8_2/0.13.7/jars/compiler-interface-bin.jar ...
[info] [SUCCESSFUL ] org.scala-sbt#precompiled-2_8_2;0.13.7!compiler-interface-bin.jar (383ms)
[info] downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/precompiled-2_9_2/0.13.7/jars/compiler-interface-bin.jar ...
[info] [SUCCESSFUL ] org.scala-sbt#precompiled-2_9_2;0.13.7!compiler-interface-bin.jar (438ms)
[info] downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/precompiled-2_9_3/0.13.7/jars/compiler-interface-bin.jar ...
[info] [SUCCESSFUL ] org.scala-sbt#precompiled-2_9_3;0.13.7!compiler-interface-bin.jar (556ms)
[info] downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/actions/0.13.7/jars/actions.jar ...
[info] [SUCCESSFUL ] org.scala-sbt#actions;0.13.7!actions.jar (604ms)
[info] downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/main-settings/0.13.7/jars/main-settings.jar ...
[info] [SUCCESSFUL ] org.scala-sbt#main-settings;0.13.7!main-settings.jar (478ms)
[info] downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/interface/0.13.7/jars/interface.jar ...
[info] [SUCCESSFUL ] org.scala-sbt#interface;0.13.7!interface.jar (190ms)
[info] downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/io/0.13.7/jars/io.jar ...
[info] [SUCCESSFUL ] org.scala-sbt#io;0.13.7!io.jar (364ms)
[info] downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/ivy/0.13.7/jars/ivy.jar ...
[info] [SUCCESSFUL ] org.scala-sbt#ivy;0.13.7!ivy.jar (699ms)
[info] downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/launcher-interface/0.13.7/jars/launcher-interface.jar ...
[info] [SUCCESSFUL ] org.scala-sbt#launcher-interface;0.13.7!launcher-interface.jar (187ms)
[info] downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/logging/0.13.7/jars/logging.jar ...
[info] [SUCCESSFUL ] org.scala-sbt#logging;0.13.7!logging.jar (245ms)
[info] downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/logic/0.13.7/jars/logic.jar ...
[info] [SUCCESSFUL ] org.scala-sbt#logic;0.13.7!logic.jar (189ms)
[info] downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/process/0.13.7/jars/process.jar ...
[info] [SUCCESSFUL ] org.scala-sbt#process;0.13.7!process.jar (247ms)
[info] downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/run/0.13.7/jars/run.jar ...
[info] [SUCCESSFUL ] org.scala-sbt#run;0.13.7!run.jar (253ms)
[info] downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/command/0.13.7/jars/command.jar ...
[info] [SUCCESSFUL ] org.scala-sbt#command;0.13.7!command.jar (297ms)
[info] downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/classpath/0.13.7/jars/classpath.jar ...
[info] [SUCCESSFUL ] org.scala-sbt#classpath;0.13.7!classpath.jar (285ms)
[info] downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/completion/0.13.7/jars/completion.jar ...
[info] [SUCCESSFUL ] org.scala-sbt#completion;0.13.7!completion.jar (634ms)
[info] downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/api/0.13.7/jars/api.jar ...
[info] [SUCCESSFUL ] org.scala-sbt#api;0.13.7!api.jar (359ms)
[info] downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/compiler-integration/0.13.7/jars/compiler-integration.jar ...
[info] [SUCCESSFUL ] org.scala-sbt#compiler-integration;0.13.7!compiler-integration.jar (247ms)
[info] downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/compiler-ivy-integration/0.13.7/jars/compiler-ivy-integration.jar ...
[info] [SUCCESSFUL ] org.scala-sbt#compiler-ivy-integration;0.13.7!compiler-ivy-integration.jar (186ms)
[info] downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/relation/0.13.7/jars/relation.jar ...
[info] [SUCCESSFUL ] org.scala-sbt#relation;0.13.7!relation.jar (189ms)
[info] downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/task-system/0.13.7/jars/task-system.jar ...
[info] [SUCCESSFUL ] org.scala-sbt#task-system;0.13.7!task-system.jar (322ms)
[info] downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/tasks/0.13.7/jars/tasks.jar ...
[info] [SUCCESSFUL ] org.scala-sbt#tasks;0.13.7!tasks.jar (465ms)
[info] downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/tracking/0.13.7/jars/tracking.jar ...
[info] [SUCCESSFUL ] org.scala-sbt#tracking;0.13.7!tracking.jar (270ms)
[info] downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/testing/0.13.7/jars/testing.jar ...
[info] [SUCCESSFUL ] org.scala-sbt#testing;0.13.7!testing.jar (241ms)
[info] downloading https://repo1.maven.org/maven2/org/scala-lang/scala-compiler/2.10.4/scala-compiler-2.10.4.jar ...
[info] [SUCCESSFUL ] org.scala-lang#scala-compiler;2.10.4!scala-compiler.jar (12424ms)
[info] downloading https://repo1.maven.org/maven2/org/scala-lang/scala-reflect/2.10.4/scala-reflect-2.10.4.jar ...
[info] [SUCCESSFUL ] org.scala-lang#scala-reflect;2.10.4!scala-reflect.jar (3486ms)
[info] downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/control/0.13.7/jars/control.jar ...
[info] [SUCCESSFUL ] org.scala-sbt#control;0.13.7!control.jar (268ms)
[info] downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/collections/0.13.7/jars/collections.jar ...
[info] [SUCCESSFUL ] org.scala-sbt#collections;0.13.7!collections.jar (418ms)
[info] downloading https://repo1.maven.org/maven2/jline/jline/2.11/jline-2.11.jar ...
[info] [SUCCESSFUL ] jline#jline;2.11!jline.jar (352ms)
[info] downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/incremental-compiler/0.13.7/jars/incremental-compiler.jar ...
[info] [SUCCESSFUL ] org.scala-sbt#incremental-compiler;0.13.7!incremental-compiler.jar (622ms)
[info] downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/compile/0.13.7/jars/compile.jar ...
[info] [SUCCESSFUL ] org.scala-sbt#compile;0.13.7!compile.jar (236ms)
[info] downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/persist/0.13.7/jars/persist.jar ...
[info] [SUCCESSFUL ] org.scala-sbt#persist;0.13.7!persist.jar (264ms)
[info] downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/classfile/0.13.7/jars/classfile.jar ...
[info] [SUCCESSFUL ] org.scala-sbt#classfile;0.13.7!classfile.jar (210ms)
[info] downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbinary/sbinary_2.10/0.4.2/jars/sbinary_2.10.jar ...
[info] [SUCCESSFUL ] org.scala-tools.sbinary#sbinary_2.10;0.4.2!sbinary_2.10.jar (260ms)
[info] downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/cross/0.13.7/jars/cross.jar ...
[info] [SUCCESSFUL ] org.scala-sbt#cross;0.13.7!cross.jar (190ms)
[info] downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt.ivy/ivy/2.3.0-sbt-fccfbd44c9f64523b61398a0155784dcbaeae28f/jars/ivy.jar ...
[info] [SUCCESSFUL ] org.scala-sbt.ivy#ivy;2.3.0-sbt-fccfbd44c9f64523b61398a0155784dcbaeae28f!ivy.jar (1006ms)
[info] downloading https://repo1.maven.org/maven2/com/jcraft/jsch/0.1.46/jsch-0.1.46.jar ...
[info] [SUCCESSFUL ] com.jcraft#jsch;0.1.46!jsch.jar (322ms)
[info] downloading https://repo1.maven.org/maven2/org/json4s/json4s-native_2.10/3.2.10/json4s-native_2.10-3.2.10.jar ...
[info] [SUCCESSFUL ] org.json4s#json4s-native_2.10;3.2.10!json4s-native_2.10.jar (194ms)
[info] downloading https://repo1.maven.org/maven2/org/spire-math/jawn-parser_2.10/0.6.0/jawn-parser_2.10-0.6.0.jar ...
[info] [SUCCESSFUL ] org.spire-math#jawn-parser_2.10;0.6.0!jawn-parser_2.10.jar (179ms)
[info] downloading https://repo1.maven.org/maven2/org/spire-math/json4s-support_2.10/0.6.0/json4s-support_2.10-0.6.0.jar ...
[info] [SUCCESSFUL ] org.spire-math#json4s-support_2.10;0.6.0!json4s-support_2.10.jar (155ms)
[info] downloading https://repo1.maven.org/maven2/org/json4s/json4s-core_2.10/3.2.10/json4s-core_2.10-3.2.10.jar ...
[info] [SUCCESSFUL ] org.json4s#json4s-core_2.10;3.2.10!json4s-core_2.10.jar (664ms)
[info] downloading https://repo1.maven.org/maven2/org/json4s/json4s-ast_2.10/3.2.10/json4s-ast_2.10-3.2.10.jar ...
[info] [SUCCESSFUL ] org.json4s#json4s-ast_2.10;3.2.10!json4s-ast_2.10.jar (214ms)
[info] downloading https://repo1.maven.org/maven2/com/thoughtworks/paranamer/paranamer/2.6/paranamer-2.6.jar ...
[info] [SUCCESSFUL ] com.thoughtworks.paranamer#paranamer;2.6!paranamer.jar (157ms)
[info] downloading https://repo1.maven.org/maven2/org/scala-lang/scalap/2.10.0/scalap-2.10.0.jar ...
[info] [SUCCESSFUL ] org.scala-lang#scalap;2.10.0!scalap.jar (517ms)
[info] downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/cache/0.13.7/jars/cache.jar ...
[info] [SUCCESSFUL ] org.scala-sbt#cache;0.13.7!cache.jar (391ms)
[info] downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/test-agent/0.13.7/jars/test-agent.jar ...
[info] [SUCCESSFUL ] org.scala-sbt#test-agent;0.13.7!test-agent.jar (311ms)
[info] downloading https://repo1.maven.org/maven2/org/scala-sbt/test-interface/1.0/test-interface-1.0.jar ...
[error] Server access Error: Operation timed out url=https://repo1.maven.org/maven2/org/scala-sbt/test-interface/1.0/test-interface-1.0.jar.sha1
[info] [SUCCESSFUL ] org.scala-sbt#test-interface;1.0!test-interface.jar (11439ms)
[info] downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/apply-macro/0.13.7/jars/apply-macro.jar ...
[info] [SUCCESSFUL ] org.scala-sbt#apply-macro;0.13.7!apply-macro.jar (498ms)
[info] downloading https://repo1.maven.org/maven2/org/scala-lang/jline/2.10.4/jline-2.10.4.jar ...
[info] [SUCCESSFUL ] org.scala-lang#jline;2.10.4!jline.jar (424ms)
[info] downloading https://repo1.maven.org/maven2/org/fusesource/jansi/jansi/1.4/jansi-1.4.jar ...
[info] [SUCCESSFUL ] org.fusesource.jansi#jansi;1.4!jansi.jar (220ms)
[info] Done updating.
[info] Set current project to hello (in build file:/Users/suztomo/Documents/spark/hello/)
> compile
[info] Updating {file:/Users/suztomo/Documents/spark/hello/}hello...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/command/0.12.0/jars/command.jar ...
[info] [SUCCESSFUL ] org.scala-sbt#command;0.12.0!command.jar (304ms)
[info] downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/interface/0.12.0/jars/interface.jar ...
[info] [SUCCESSFUL ] org.scala-sbt#interface;0.12.0!interface.jar (200ms)
[info] downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/io/0.12.0/jars/io.jar ...
[info] [SUCCESSFUL ] org.scala-sbt#io;0.12.0!io.jar (321ms)
[info] downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/launcher-interface/0.12.0/jars/launcher-interface.jar ...
[info] [SUCCESSFUL ] org.scala-sbt#launcher-interface;0.12.0!launcher-interface.jar (181ms)
[info] downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/logging/0.12.0/jars/logging.jar ...
[info] [SUCCESSFUL ] org.scala-sbt#logging;0.12.0!logging.jar (211ms)
[info] downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/completion/0.12.0/jars/completion.jar ...
[info] [SUCCESSFUL ] org.scala-sbt#completion;0.12.0!completion.jar (343ms)
[info] downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/classpath/0.12.0/jars/classpath.jar ...
[info] [SUCCESSFUL ] org.scala-sbt#classpath;0.12.0!classpath.jar (197ms)
[info] downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/control/0.12.0/jars/control.jar ...
[info] [SUCCESSFUL ] org.scala-sbt#control;0.12.0!control.jar (183ms)
[info] downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/process/0.12.0/jars/process.jar ...
[info] [SUCCESSFUL ] org.scala-sbt#process;0.12.0!process.jar (239ms)
[info] downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/collections/0.12.0/jars/collections.jar ...
[info] [SUCCESSFUL ] org.scala-sbt#collections;0.12.0!collections.jar (604ms)
[info] downloading https://repo1.maven.org/maven2/jline/jline/1.0/jline-1.0.jar ...
[info] [SUCCESSFUL ] jline#jline;1.0!jline.jar (251ms)
[info] Done updating.
[success] Total time: 7 s, completed 2014/11/27 15:36:41
For more detailed explanation, please refer to (sbt configuration documentation)
Sharing my environment to compare with yours:
~/Documents/spark/hello $ which java
/Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home/bin/java
~/Documents/spark/hello $ which sbt
/usr/local/bin/sbt
~/Documents/spark/hello $ brew info sbt
sbt: stable 0.13.7 (bottled)
...

JNDI lookup only returns "javax.naming.NameNotFoundException"

I'm trying to implement an ejb-call by using JNDI-naming.
Setup:
JBoss-6.1.0.Final
ear-deploy:
gwt.war
ejb.jar
My problem is, although the JNDIView shows me the existing ejb, I'm not able to reach it.
In my RemoteServiceServlet I try to reach the ejb, which is deployed in the ejb.jar inside the same ear-package.
I allready tried several calls, as I wasn't sure about the correct jndi code.
try
{
productLocal = (ProductLocal) context.lookup("ProductHome/local");
}
catch (NamingException e)
{
System.err.println(e.getMessage());
e.printStackTrace();
}
also tried:
productLocal = (ProductLocal) context.lookup("ProductLocal");
productLocal = (ProductLocal) context.lookup("sung_app_kylintv/ProductHome/local");
The stateless ejb is assigned like this:
#Stateless
#Local(ProductLocal.class)
#Remote(ProductRemote.class)
#LocalBinding(jndiBinding="ProductLocal")
#RemoteBinding(jndiBinding="ProductRemote")
public class ProductHome extends HomeBase<ProductEntity> implements SessionBean, Serializable, ProductLocal
The context initiation:
Properties p = new Properties();
p.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
p.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
p.put("java.naming.provider.url","jnp://localhost:1099");
context = new InitialContext(p);
My JNDIView:
+- sung_app_kylintv (class: org.jnp.interfaces.NamingContext)
| +- CategoryHome (class: org.jnp.interfaces.NamingContext)
| | +- local (class: Proxy for: sung.app.kylintv.ejbclient.product.CategoryLocal)
| | +- local-sung.app.kylintv.ejbclient.product.CategoryLocal (class: Proxy for: sung.app.kylintv.ejbclient.product.CategoryLocal)
| | +- remote-sung.app.kylintv.ejbclient.product.CategoryRemote (class: Proxy for: sung.app.kylintv.ejbclient.product.CategoryRemote)
| | +- remote (class: Proxy for: sung.app.kylintv.ejbclient.product.CategoryRemote)
| +- ProductHome (class: org.jnp.interfaces.NamingContext)
| | +- local (class: Proxy for: sung.app.kylintv.ejbclient.product.ProductLocal)
| | +- remote (class: Proxy for: sung.app.kylintv.ejbclient.product.ProductRemote)
| | +- remote-sung.app.kylintv.ejbclient.product.ProductRemote (class: Proxy for: sung.app.kylintv.ejbclient.product.ProductRemote)
| | +- local-sung.app.kylintv.ejbclient.product.ProductLocal (class: Proxy for: sung.app.kylintv.ejbclient.product.ProductLocal)
| +- CustomerHome (class: org.jnp.interfaces.NamingContext)
| | +- local-sung.common.behavior.FindAllBehaviour (class: Proxy for: sung.common.behavior.FindAllBehaviour)
| | +- local (class: Proxy for: sung.common.behavior.FindAllBehaviour)
| +- Option (class: org.jnp.interfaces.NamingContext)
| | +- local-sung.app.kylintv.ejbclient.product.OptionLocal (class: Proxy for: sung.app.kylintv.ejbclient.product.OptionLocal)
| | +- local (class: Proxy for: sung.app.kylintv.ejbclient.product.OptionLocal)
| | +- remote-sung.app.kylintv.ejbclient.product.OptionRemote (class: Proxy for: sung.app.kylintv.ejbclient.product.OptionRemote)
| | +- remote (class: Proxy for: sung.app.kylintv.ejbclient.product.OptionRemote)
| +- DurationHome (class: org.jnp.interfaces.NamingContext)
| | +- local (class: Proxy for: sung.app.kylintv.ejbclient.product.DurationLocal)
| | +- local-sung.app.kylintv.ejbclient.product.DurationLocal (class: Proxy for: sung.app.kylintv.ejbclient.product.DurationLocal)
| | +- remote (class: Proxy for: sung.app.kylintv.ejbclient.product.DurationRemote)
| | +- remote-sung.app.kylintv.ejbclient.product.DurationRemote (class: Proxy for: sung.app.kylintv.ejbclient.product.DurationRemote)
| +- VariantHome (class: org.jnp.interfaces.NamingContext)
| | +- local (class: Proxy for: sung.app.kylintv.ejbclient.product.VariantLocal)
| | +- local-sung.app.kylintv.ejbclient.product.VariantLocal (class: Proxy for: sung.app.kylintv.ejbclient.product.VariantLocal)
| | +- remote (class: Proxy for: sung.app.kylintv.ejbclient.product.VariantRemote)
| | +- remote-sung.app.kylintv.ejbclient.product.VariantRemote (class: Proxy for: sung.app.kylintv.ejbclient.product.VariantRemote)
| +- VelocityBean (class: org.jnp.interfaces.NamingContext)
| | +- local (class: Proxy for: sung.app.kylintv.ejb.velocity.Velocity)
| | +- local-sung.app.kylintv.ejb.velocity.Velocity (class: Proxy for: sung.app.kylintv.ejb.velocity.Velocity)
| +- CustomerAddressHome (class: org.jnp.interfaces.NamingContext)
| | +- local-sung.common.behavior.FindAllBehaviour (class: Proxy for: sung.common.behavior.FindAllBehaviour)
| | +- local (class: Proxy for: sung.common.behavior.FindAllBehaviour)
| +- OrderEntityHome (class: org.jnp.interfaces.NamingContext)
| | +- no-interface (class: sung.app.kylintv.ejbclient.order.OrderEntityHome_$$_javassist_50)
Are there any requirements for jndi to work properly in a case like this?
using
productLocal = (ProductLocal) context.lookup("sung_app_kylintv/ProductHome/local")
returned a slightly different error message:
2011-11-24 12:37:07,893 INFO [STDOUT] (http-0.0.0.0-8080-2) productLocal called successfully.
2011-11-24 12:37:07,893 INFO [STDOUT] (http-0.0.0.0-8080-2) productLocal calling createTestEntry().
2011-11-24 12:37:07,950 ERROR [STDERR] (http-0.0.0.0-8080-2) org.jboss.injection.manager.spi.InjectionException: javax.naming.NamingException: Could not dereference object [Root exception is javax.naming.NameNotFoundException: sung not bound]
After a colleague of mine took a look the error has been identified: I tried an Injection using #EJB inside of that class ProductHome, that used mappedName="sung/...". The mappedName isn't correct and even not required at all, inside the ejb-project the connections do allready exist and work. Hope, this may help others as well.
Solution:
I had to fix my ProductHome by removing the mappedName-Attribute on my ejb-call. After that the class can be instanciated and functions are called.