GithubHelp home page GithubHelp logo

Comments (39)

fusesource-ci avatar fusesource-ci commented on August 23, 2024

this got fixed in fabric8 a while back where the bin/launcher shell script wasn’t defaulting to using bash so some classpath expression went wonky. Could you check that the install/processes/$containerName/bin/launcher script is using bash?

On 18 Sep 2014, at 13:45, Olli Varis [email protected] wrote:

I'm using latest build jboss-fuse-6.2.0.redhat-025. I have succesfully deployed two Spring Boot apps (with Camel Routes) and with the third app I'm having this problem that Fabric is unable to start boot app due to invalid sources.

I have verified million times that the spring.main.sources property is pointing to root folder where the main class is. I have also successfully ran the io.fabric8.process.spring.boot.container.FabricSpringApplication with my IDE to verify that app launches nicely.

What should I try next, any tips howto debug to see what's happening?

when starting the container following is outputted processes/mycontainer/logs/out.log

java.lang.IllegalArgumentException: Invalid source 'fi.fifthelement.woodforce'
at org.springframework.boot.BeanDefinitionLoader.load(BeanDefinitionLoader.java:223)
at org.springframework.boot.BeanDefinitionLoader.load(BeanDefinitionLoader.java:144)
at org.springframework.boot.BeanDefinitionLoader.load(BeanDefinitionLoader.java:127)
at org.springframework.boot.SpringApplication.load(SpringApplication.java:620)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:314)
at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:142)
at io.fabric8.process.spring.boot.container.FabricSpringApplication.run(FabricSpringApplication.java:70)
at io.fabric8.process.spring.boot.container.FabricSpringApplication.main(FabricSpringApplication.java:76)
logs/cmd.log is:

Running:
java -javaagent:jolokia-agent.jar=host=0.0.0.0,port=9038,agentId=wf-services2 -Dspring.main.sources=fi.fifthelement.woodforce -Dspring.profiles.active=test -Dfabric8.containerId=wf-services2 -classpath /opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/antlr-2.7.7.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/aopalliance-1.0.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/aspectjrt-1.8.1.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/aspectjweaver-1.8.1.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/bcpkix-jdk15on-1.47.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/bcprov-jdk15on-1.47.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/classmate-1.0.0.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/commons-codec-1.6.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/commons-collections-3.2.1.jar:!
/opt/fuse
/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/commons-pool-1.6.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/core-1.5.0.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/data-0.2.0-SNAPSHOT.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/dom4j-1.6.1.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/fe-hibernate-utils-1.1.0.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/gt-api-2.7.5.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/gt-geojson-2.7.5.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/gt-main-2.7.5.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/gt-metadata-2.7.5.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/gt-opengis-2.7.5.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/gt-referencing-2.7.5.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-se!
rvices2/l
ib/guava-16.0.1.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/hibernate-commons-annotations-4.0.4.Final.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/hibernate-core-4.3.5.Final.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/hibernate-entitymanager-4.3.5.Final.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/hibernate-jpa-2.1-api-1.0.0.Final.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/hibernate-spatial-4.3.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/hibernate-validator-5.0.3.Final.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/jackson-annotations-2.3.3.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/jackson-core-2.3.3.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/jackson-core-asl-1.9.13.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/jackson-databind-2.3!
.3.jar:/o
pt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/jackson-datatype-joda-2.3.3.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/jackson-mapper-asl-1.9.13.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/jai_core-1.1.3.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/jandex-1.1.0.Final.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/javassist-3.18.1-GA.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/jboss-logging-3.1.3.GA.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/jboss-logging-annotations-1.2.0.Beta1.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/jboss-transaction-api_1.2_spec-1.0.0.Final.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/jcl-over-slf4j-1.7.7.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/jdom-1.0.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-service!
s2/lib/jm
s-1.1.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/joda-time-2.3.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/jolokia-core-1.2.2.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/json-simple-1.1.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/jsr-275-1.0-beta-2.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/jts-1.13.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/jul-to-slf4j-1.7.7.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/log4j-over-slf4j-1.7.7.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/logback-classic-1.1.2.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/logback-core-1.1.2.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/lombok-1.14.4.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/postgis-jdbc-1.5.2.jar:/opt/fuse/jboss-fuse-6.2.0!
.redhat-0
25/processes/wf-services2/lib/postgresql-9.3-1101-jdbc41.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/process-spring-boot-container-1.2.0.Beta4.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/process-spring-boot-registry-1.2.0.Beta4.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/services-0.2.0-SNAPSHOT.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/slf4j-api-1.7.7.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/snakeyaml-1.13.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/spring-aop-4.0.7.RELEASE.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/spring-aspects-4.0.7.RELEASE.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/spring-beans-4.0.7.RELEASE.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/spring-boot-1.1.5.RELEASE.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/!
lib/sprin
g-boot-actuator-1.1.5.RELEASE.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/spring-boot-autoconfigure-1.1.5.RELEASE.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/spring-boot-starter-1.1.5.RELEASE.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/spring-boot-starter-actuator-1.1.5.RELEASE.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/spring-boot-starter-aop-1.1.5.RELEASE.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/spring-boot-starter-data-jpa-1.1.5.RELEASE.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/spring-boot-starter-jdbc-1.1.5.RELEASE.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/spring-boot-starter-logging-1.1.5.RELEASE.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/spring-boot-starter-security-1.1.5.RELEASE.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/spring-boot-sta!
rter-tomc
at-1.1.5.RELEASE.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/spring-boot-starter-web-1.1.5.RELEASE.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/spring-context-4.0.7.RELEASE.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/spring-core-4.0.6.RELEASE.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/spring-data-commons-1.8.4.RELEASE.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/spring-data-jpa-1.6.4.RELEASE.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/spring-expression-4.0.7.RELEASE.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/spring-jdbc-4.0.7.RELEASE.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/spring-orm-4.0.7.RELEASE.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/spring-security-config-3.2.5.RELEASE.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/spri!
ng-securi
ty-core-3.2.5.RELEASE.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/spring-security-jwt-1.0.2.RELEASE.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/spring-security-oauth2-2.0.1.RELEASE.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/spring-security-web-3.2.5.RELEASE.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/spring-tx-4.0.7.RELEASE.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/spring-web-4.0.7.RELEASE.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/spring-webmvc-4.0.7.RELEASE.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/tomcat-embed-core-8.0.8.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/tomcat-embed-el-8.0.8.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/tomcat-embed-logging-juli-8.0.8.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/tomcat-jdbc-8.0.!
8.jar:/op
t/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/tomcat-juli-8.0.8.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/usertype.core-3.2.0.GA.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/usertype.spi-3.2.0.GA.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/validation-api-1.1.0.Final.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/vecmath-1.3.2.jar:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/*.war:/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/classes io.fabric8.process.spring.boot.container.FabricSpringApplication

Environment variables:
FABRIC8_HTTP_PORT=8080
FABRIC8_HTTP_PROXY_PORT=9037
FABRIC8_JAVA_AGENT=-javaagent:jolokia-agent.jar=host=0.0.0.0,port=9038,agentId=wf-services2
FABRIC8_JAVA_MAIN=io.fabric8.process.spring.boot.container.FabricSpringApplication
FABRIC8_JOLOKIA_PORT=8778
FABRIC8_JOLOKIA_PROXY_PORT=9038
FABRIC8_KARAF_NAME=wf-services2
FABRIC8_LISTEN_ADDRESS=10.0.144.41
FABRIC8_PROCESS_INSTALL_DIR=/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2
FABRIC8_PROCESS_STOP_TIMEOUT=60
FABRIC8_RMI_PORT=1099
FABRIC8_RMI_PROXY_PORT=9036


Reply to this email directly or view it on GitHub.

James

Red Hat

Twitter: @jstrachan
Email: [email protected]
Blog: http://macstrac.blogspot.com/

hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Open Source Integration

from fuse.

ovaris avatar ovaris commented on August 23, 2024

It's using bash:

#!/bin/bash
#
#  Copyright 2005-2014 Red Hat, Inc.
#
#  Red Hat licenses this file to you under the Apache License, version
#  2.0 (the "License"); you may not use this file except in compliance
#  with the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
#  implied.  See the License for the specific language governing
#  permissions and limitations under the License.

### Helper functions

jvmArgs() {
  if [ -z "$FABRIC8_JVM_ARGS" ]; then
    cat ${APP_BASE}/etc/jvm.config
  else
    echo "$FABRIC8_JVM_ARGS"
  fi
}
....

from fuse.

jstrachan avatar jstrachan commented on August 23, 2024

doh sorry - misread the exception. Is fi.fifthelement.woodforce definitely a valid package etc?

from fuse.

jstrachan avatar jstrachan commented on August 23, 2024

all the jars you need are in the installDir/processes/$containerName/lib folder right? And those system properties all look OK to you?

from fuse.

ovaris avatar ovaris commented on August 23, 2024

Yeah, it's valid. As I said, I have also "verified" it by running FabricSpringApplication with IntelliJ IDEA in my project folder and it works. But I understand that Fabric8 launches jar a bit differently.

There's a huge list of dependency jars in lib folder + my app jar and everything looks good.

Do you mean env variables listed in cmd.out? They look just fine.

from fuse.

jstrachan avatar jstrachan commented on August 23, 2024

I don't have your app so am a bit in the dark; if you can't see from the classpath, env vars and system properties whats wrong am not sure I'll be able to guess what fabric8's doing wrong am afraid ;)

from fuse.

ovaris avatar ovaris commented on August 23, 2024

By system properties do you mean profile properties or where should I check
these?

Should I zip the process folder and make it available for you?
On Sep 18, 2014 6:07 PM, "James Strachan" [email protected] wrote:

I don't have your app so am a bit in the dark; if you can't see from the
classpath, env vars and system properties whats wrong am not sure I'll be
able to guess what fabric8's doing wrong am afraid ;)


Reply to this email directly or view it on GitHub
#15 (comment).

from fuse.

jstrachan avatar jstrachan commented on August 23, 2024

System properties are supplied on the Java command line (see above)...

java  -javaagent:jolokia-agent.jar=host=0.0.0.0,port=9038,agentId=wf-services2  -Dspring.main.sources=fi.fifthelement.woodforce -Dspring.profiles.active=test -Dfabric8.containerId=wf-services2 

I wonder if you set the env vars to the same as fabric8; set the classpath to lib/* would java boot up your app?

from fuse.

ovaris avatar ovaris commented on August 23, 2024

If I just copy java command from cmd.log (with all system props & classpath) it gives me exactly the same error, 'Invalid source' .... So this was without env variables set.

Then with lib/* it can't find the main class:

java  -javaagent:jolokia-agent.jar=host=0.0.0.0,port=9038,agentId=wf-services2  -Dspring.main.sources=fi.fifthelement.woodforce -Dspring.profiles.active=test -Dfabric8.containerId=wf-services2 -classpath lib/* io.fabric8.process.spring.boot.container.FabricSpringApplication
I> No access restrictor found, access to all MBean is allowed
Jolokia: Agent started with URL http://10.0.144.41:9038/jolokia/
Error: Could not find or load main class lib.aopalliance-1.0.jar

UPDATE: okay if using wildcard it must be quoted:

[jboss@navitas wf-services2]$ java  -javaagent:jolokia-agent.jar=host=0.0.0.0,port=9038,agentId=wf-services2  -Dspring.main.sources=fi.fifthelement.woodforce -Dspring.profiles.active=test -Dfabric8.containerId=wf-services2 -classpath "lib/*" io.fabric8.process.spring.boot.container.FabricSpringApplication
I> No access restrictor found, access to all MBean is allowed
Jolokia: Agent started with URL http://10.0.144.41:9038/jolokia/

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v1.1.5.RELEASE)

2014-09-18 20:25:10.933  INFO 362 --- [           main] i.f.p.s.b.c.FabricSpringApplication      : Starting FabricSpringApplication on navitas.fifthelement.fi with PID 362 (/opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2/lib/process-spring-boot-container-1.2.0.Beta4.jar started by jboss in /opt/fuse/jboss-fuse-6.2.0.redhat-025/processes/wf-services2)
....
2014-09-18 20:25:10.982 ERROR 362 --- [           main] o.s.boot.SpringApplication               : Application startup failed

java.lang.IllegalArgumentException: Invalid source 'fi.fifthelement.woodforce'
    at org.springframework.boot.BeanDefinitionLoader.load(BeanDefinitionLoader.java:223)
    at org.springframework.boot.BeanDefinitionLoader.load(BeanDefinitionLoader.java:144)
    at org.springframework.boot.BeanDefinitionLoader.load(BeanDefinitionLoader.java:127)
    at org.springframework.boot.SpringApplication.load(SpringApplication.java:620)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:314)
    at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:142)
    at io.fabric8.process.spring.boot.container.FabricSpringApplication.run(FabricSpringApplication.java:70)
    at io.fabric8.process.spring.boot.container.FabricSpringApplication.main(FabricSpringApplication.java:76)

Exception in thread "main" java.lang.IllegalArgumentException: Invalid source 'fi.fifthelement.woodforce'
    at org.springframework.boot.BeanDefinitionLoader.load(BeanDefinitionLoader.java:223)
    at org.springframework.boot.BeanDefinitionLoader.load(BeanDefinitionLoader.java:144)
    at org.springframework.boot.BeanDefinitionLoader.load(BeanDefinitionLoader.java:127)
    at org.springframework.boot.SpringApplication.load(SpringApplication.java:620)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:314)
    at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:142)
    at io.fabric8.process.spring.boot.container.FabricSpringApplication.run(FabricSpringApplication.java:70)
    at io.fabric8.process.spring.boot.container.FabricSpringApplication.main(FabricSpringApplication.java:76)

from fuse.

jstrachan avatar jstrachan commented on August 23, 2024

what system properties do you specify when it works in IDEA? Can you specify the same on the command line too?

from fuse.

ovaris avatar ovaris commented on August 23, 2024

Only thing I do specify is the -Dspring.main.sources=fi.fifthelement.woodforce and it just works. Alternatively it can be defined in application.properties.

from fuse.

ovaris avatar ovaris commented on August 23, 2024

Okay strange, if I move out the jar which includes my main Application class from lib folder, I get the same exception. So for some reason that jar is not picked up & loaded in classpath when it's inside lib folder.

from fuse.

ovaris avatar ovaris commented on August 23, 2024

Even this does not work...so there must be something wrong with my jar packaging.

java -Dspring.main.sources=fi.fifthelement.woodforce -classpath "lib/*" fi.fithelement.woodforce.Application
Error: Could not find or load main class fi.fithelement.woodforce.Application

from fuse.

hekonsek avatar hekonsek commented on August 23, 2024

Hi,

I strongly suggest to use the latest Fabric8, instead of the Fuse 6.2. Spring Boot for Fabric8 is bleeding edge stuff, so we constantly tweaking it. It is very likely that the issue with the launcher has been already resolved in the latest Fabric8. I believe that this kind of the invalid script won't be generated by the latest Fabric8.

Can you try to switch to the latest Fabric8 and see if that helps?

Cheers.

from fuse.

hekonsek avatar hekonsek commented on August 23, 2024

Oh BTW in the latest Fabric8 we have added better support for Spring Boot fat jars. I encourage to generate new Spring Bott project from the latest quickstart. Fat jars are easier to test outside the fabric. New quickstarts also keep spring.main.sources in the application.properties by default.

So again - latest Fabric8 FTW ;) .

from fuse.

ovaris avatar ovaris commented on August 23, 2024

Okay thanks for the tip. It sounded a bit strange not to use Boots fat jars
anyway.

By latest Fabric8,do you mean building from master?
On Sep 18, 2014 9:37 PM, "Henryk Konsek" [email protected] wrote:

Oh BTW in the latest Fabric8 we have added better support for Spring Boot
fat jars. I encourage to generate new Spring Bott project from the latest
quickstart. Fat jars are easier to test outside the fabric. New quickstarts
also keep spring.main.sources in the application.properties by default.

So again - latest Fabric8 FTW ;) .


Reply to this email directly or view it on GitHub
#15 (comment).

from fuse.

hekonsek avatar hekonsek commented on August 23, 2024

1.2.0.Beta4 is the latest beta release.

But building from source is even better option - so bleeding edge, so up to date :) . As simple as:

git clone [email protected]:hekonsek/fabric8.git
cd fabric8
mvn install -DskipTests
cd fabric/fabric8-karaf/target

And yeah, fat jars rocks and are the recommended way to deploy Spring Boot apps with Fabric8. :)

from fuse.

jstrachan avatar jstrachan commented on August 23, 2024

You can download it here http://fabric8.io/getstarted/index.html

On Thursday, September 18, 2014, Henryk Konsek [email protected]
wrote:

1.2.0.Beta4 is the latest beta release.

But building from source is even better option - so bleeding edge, so up
to date :) . As simple as:

git clone [email protected]:hekonsek/fabric8.git
cd fabric8

mvn install -DskipTests
cd fabric/fabric8-karaf/target

And yeah, fat jars rocks and are the recommended way to deploy Spring Boot
apps with Fabric8. :)


Reply to this email directly or view it on GitHub
#15 (comment).

James

Red Hat

Twitter: @jstrachan
Email: [email protected]
Blog: http://macstrac.blogspot.com/

hawtio: http:/ http://fusesource.com//hawt.io/
fabric8: http:/ http://fusesource.com//fabric8.io/

Open Source Integration

from fuse.

ovaris avatar ovaris commented on August 23, 2024

@hekonsek building from master does not work:

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 32.749s
[INFO] Finished at: Fri Sep 19 08:56:56 EEST 2014
[INFO] Final Memory: 197M/444M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project fabric-api: Compilation failure: Compilation failure:
[ERROR] error reading /home/ovaris/.m2/repository/org/jboss/gravia/gravia-runtime-api/1.1.0.Beta40/gravia-runtime-api-1.1.0.Beta40.jar; error in opening zip file
[ERROR] error reading /home/ovaris/.m2/repository/org/jboss/gravia/gravia-runtime-api/1.1.0.Beta40/gravia-runtime-api-1.1.0.Beta40.jar; error in opening zip file
[ERROR] /home/ovaris/projects/woodforce/git/fabric8/fabric/fabric-api/src/main/java/io/fabric8/api/Profiles.java:[31,30] package org.jboss.gravia.utils does not exist
[ERROR] /home/ovaris/projects/woodforce/git/fabric8/fabric/fabric-api/src/main/java/io/fabric8/api/permit/PermitKey.java:[18,30] package org.jboss.gravia.utils does not exist
[ERROR] /home/ovaris/projects/woodforce/git/fabric8/fabric/fabric-api/src/main/java/io/fabric8/api/scr/AbstractRuntimeProperties.java:[25,30] package org.jboss.gravia.utils does not exist
[ERROR] /home/ovaris/projects/woodforce/git/fabric8/fabric/fabric-api/src/main/java/io/fabric8/api/scr/AbstractRuntimeProperties.java:[26,30] package org.jboss.gravia.utils does not exist
[ERROR] /home/ovaris/projects/woodforce/git/fabric8/fabric/fabric-api/src/main/java/io/fabric8/api/ProfileManagerLocator.java:[18,32] package org.jboss.gravia.runtime does not exist
[ERROR] /home/ovaris/projects/woodforce/git/fabric8/fabric/fabric-api/src/main/java/io/fabric8/api/ProfileBuilder.java:[22,32] package org.jboss.gravia.runtime does not exist
[ERROR] /home/ovaris/projects/woodforce/git/fabric8/fabric/fabric-api/src/main/java/io/fabric8/api/permit/DefaultPermitManager.java:[29,30] package org.jboss.gravia.utils does not exist
[ERROR] /home/ovaris/projects/woodforce/git/fabric8/fabric/fabric-api/src/main/java/io/fabric8/api/permit/DefaultPermitManager.java:[30,30] package org.jboss.gravia.utils does not exist
[ERROR] /home/ovaris/projects/woodforce/git/fabric8/fabric/fabric-api/src/main/java/io/fabric8/api/VersionBuilder.java:[21,32] package org.jboss.gravia.runtime does not exist
[ERROR] /home/ovaris/projects/woodforce/git/fabric8/fabric/fabric-api/src/main/java/io/fabric8/api/mxbean/ProfileManagement.java:[26,30] package org.jboss.gravia.utils does not exist
[ERROR] /home/ovaris/projects/woodforce/git/fabric8/fabric/fabric-api/src/main/java/io/fabric8/api/Profiles.java:[385,9] cannot find symbol
[ERROR] symbol:   variable IllegalArgumentAssertion
[ERROR] location: class io.fabric8.api.Profiles


from fuse.

davsclaus avatar davsclaus commented on August 23, 2024

Sounds like your m2 repo is corrupt. Try deleting the gravia dir so maven re-download the JARs.

cd ~/.m2/repository
rm -rf org/jboss/gravia

from fuse.

ovaris avatar ovaris commented on August 23, 2024

That's what I did now and it works, I also noticed that. thx.

from fuse.

ovaris avatar ovaris commented on August 23, 2024

About Fabric8 version & Fuse version. I was under impression that https://github.com/fabric8io/fabric8/releases/tag/fabric8-1.1.0.redhat-025 has basically the same Fabric8 version, Beta 4 that is, but apparently this is not case.

We have a Fuse licence but we would like to use Fabric8 Spring Boot features (we are not in production phase yet). We have couple of Boot apps with Camel routes and one web app, Boot as well. Two camel apps deployed quite nicely, but this web app was problematic. Do you recommend that we keep testing with latest Fabcric8 version instead of Fuse?

from fuse.

jstrachan avatar jstrachan commented on August 23, 2024

The upstream open source project is much more solid right now around Spring Boot; so right now its my recommended place to start.

The Fuse 6.2 beta builds are just starting and I don't know yet if anyone's even tried spring boot with them yet; so am not sure how complete they'll be. Fabric8 1.2.0 Final is gonna be productised into Fuse 6.2; so hopefully if things work for you in Fabric8 1.2.0 then things will work when the Fuse 6.2 builds start getting stable & near beta. So its your call really ;)

For better response to your issues since you're a customer, you could raise a support request if you wanna stick to the Fuse 6.2 alpha builds?

from fuse.

ovaris avatar ovaris commented on August 23, 2024

Okay thanks, I think we will use Fabric8 upstream builds for now and then move to Fuse 6.2.0 when it's released. For future questions, is this the right forum (or actually the Fabric8 project)? For support requests we should then be testing Fuse 6.2 beta, right?

from fuse.

hekonsek avatar hekonsek commented on August 23, 2024

I recommend Fabric8 mailing lists [1] and GitHub issues [2] for questions like this. They get better visibility there.

BTW If you are Red Hat customer, then feel free to raise a customer support issue regarding your interest in Spring Boot in Fuse 6.2. You can even send me the ticket number here - I'll handle your case :) .

[1] https://groups.google.com/forum/#!forum/fabric8
[2] https://github.com/fabric8io/fabric8/issues

from fuse.

ovaris avatar ovaris commented on August 23, 2024

Okay, will do that.

Now I'm running the latest Fabric8 from master, but the problem is still the same.

My maven project setting looks like this:

 <build>
        <finalName>woodforce-services-${project.version}</finalName>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <mainClass>io.fabric8.process.spring.boot.container.FabricSpringApplication</mainClass>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
<plugin>
                <!--
                  this plugin will use the fabric.* properties to configure its behaviour
                  see the Properties section here: http://fabric8.io/gitbook/mavenPlugin.html
                -->
                <groupId>io.fabric8</groupId>
                <artifactId>fabric8-maven-plugin</artifactId>
                <version>${fabric.version}</version>
            </plugin>
        </plugins>
    </build>

When building with mvn install and then running Spring Boot with java -jar it lanches nicely:

2014-09-19 09:58:06.796  INFO 26213 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080/http
2014-09-19 09:58:06.799  INFO 26213 --- [           main] i.f.p.s.b.c.FabricSpringApplication      : Started FabricSpringApplication in 26.001 seconds (JVM running for 26.638)

But then using mvn fabric8:deploy into latest Fabric8 (I'm using spring boot parent profile) and creating new container with newly created profile, it is still the same problem:

java.lang.IllegalArgumentException: Invalid source 'fi.fifthelement.woodforce'
        at org.springframework.boot.BeanDefinitionLoader.load(BeanDefinitionLoader.java:223)
        at org.springframework.boot.BeanDefinitionLoader.load(BeanDefinitionLoader.java:144)
        at org.springframework.boot.BeanDefinitionLoader.load(BeanDefinitionLoader.java:127)
        at org.springframework.boot.SpringApplication.load(SpringApplication.java:620)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:314)
        at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:142)
        at io.fabric8.process.spring.boot.container.FabricSpringApplication.run(FabricSpringApplication.java:70)
        at io.fabric8.process.spring.boot.container.FabricSpringApplication.main(FabricSpringApplication.java:76)

But how should I use fat jar approach? When I look into lib folder & cmd.out it still has all separate jars.

from fuse.

hekonsek avatar hekonsek commented on August 23, 2024

Don't bother with all the jars for the moment. In the latest version Fabric8 copies them into lib regardless of the fact that fat jar is being used. But that makes no harm, as you just have redundant jars in the lib directory. This is known issue (#2403 [1]) and it will be addressed. After #2403 [1] is fixed, there will be only fat jar in the lib.

Before we proceed with the issue - what OS do you use?

[1] fabric8io/fabric8#2403

from fuse.

ovaris avatar ovaris commented on August 23, 2024

Now I'm using Ubuntu 14.04 LTS, but those earliser tests with Fuse 6.2.0 beta were on CentOS.

JDK version on both machines are 1.8.0, also Fabric8 is build and ran with java 1.8.

from fuse.

hekonsek avatar hekonsek commented on August 23, 2024

Can you send me your process directory generated by Fabric8? I got the same Ubuntu on my box, so I should be able to see the same error when starting your microservice. I could debug it then.

from fuse.

ovaris avatar ovaris commented on August 23, 2024

@hekonsek I sent you a email ([email protected]) with link to download processes folder.

from fuse.

hekonsek avatar hekonsek commented on August 23, 2024

@ovaris I remember about you. Will try to find some time today :) .

from fuse.

ovaris avatar ovaris commented on August 23, 2024

I've been sitting here couple days just waiting and doing nothing... just joking. Great to hear.

from fuse.

hekonsek avatar hekonsek commented on August 23, 2024

OK, I got it. :)

TL;DR; This is Spring's fault, not ours :P Set spring.main.sources=fi.fifthelement.woodforce.Application as a workaround (instead of the spring.main.sources=fi.fifthelement.woodforce).

Longer version:

Spring Boot internally uses java.lang.Package.getPackage(String) method to load the package indicated by the spring.main.sources property. Unfortunately, this method has some nasty limitations. To be exact, if your top level class is a.b.c.D, then Package.getPackage("a.b") will return null. Only Package.getPackage("a.b.c") will return the package, as Package.getPackage doesn't work recursively. As your classpath contains data-x.y.jar which top level package is fi.fifthelement.woodforce.{dao|model|repository} and because that jar happens to be loaded by the classloader before service-x.y.jar, then Package.getPackage("fi.fifthelement.woodforce") returns null as well. You can remove data.jar from the classpath and you will see that application will start correctly. Specifying configuration class instead of packages is a workaround in your situation - spring.main.sources=fi.fifthelement.woodforce.Application .

I planned to create a pull request to Spring Boot and propose that they shouldn't use Package.getPackage method as it's confusing in such situation (you're not the first one who hit this issue, believe me :) . IMHO Spring guys should delegate to classpath scanner immediately, without unnecessary Package.getPackage call (or replace that call with something better). I'll create an appropriate pull request in the near future.

from fuse.

hekonsek avatar hekonsek commented on August 23, 2024

BTW If you have Fuse subscription I encourage you to create the support request and send me the ticket number on my private e-mail address. I can assign higher priority to the issues created by the Fuse subscribers and spend more time on them :) .

from fuse.

ovaris avatar ovaris commented on August 23, 2024

Okay, thanks a lot for explanation. I actually suspected that this has something to do with the fact that our data jar is having same package structure than services (because data module is extracted from services :)). So actually this is also bad package naming from our side, ie. services should under fi.fifthelement.woodforce.service.... and data jar should have fi.fifthelement.woodforce.data...

For future requests I can open support request!

from fuse.

ovaris avatar ovaris commented on August 23, 2024

Actually, data jar has already fi.fifthelement.woodforce.data so perhaps our services should just have fi.fifthelement.woodforce.servicesas "root" package, not fi.fifthelement.woodforce.

Anyways, I will test your work around for now and let's see if it helps.

from fuse.

hekonsek avatar hekonsek commented on August 23, 2024

Actually the naming isn't bad. This is common approach to put application configuration into com.app and model into com.app.data. Actually this is even approach promoted by the Spring team :) . The issue here is that separated jars confuses Package.getPackage(). Your convention is good :) .

from fuse.

ovaris avatar ovaris commented on August 23, 2024

It works, it works! This issue can be be closed now.

from fuse.

hekonsek avatar hekonsek commented on August 23, 2024

Yay! Glad to hear that :)

from fuse.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.