Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

default datasource not created since Swarm 2016.12.0 #8

Open
gavinking opened this issue Jul 10, 2017 · 35 comments
Open

default datasource not created since Swarm 2016.12.0 #8

gavinking opened this issue Jul 10, 2017 · 35 comments
Labels

Comments

@gavinking
Copy link
Member

When using Swarm from version 2016.12.0 onward, I get:

WFSWARM1005: Not creating a default datasource due to lack of JDBC driver

My guess is that there must be something missing from the fractions, but I'm not sure what.

@FroMage, @kenfinnigan, @bobmcwhirter any idea?

@gavinking gavinking added the bug label Jul 10, 2017
@gavinking
Copy link
Member Author

gavinking commented Jul 10, 2017

Note, the exact same code works with swarmtool 2016.11.0.

@gavinking
Copy link
Member Author

So I guess it's a result of this breaking change in Swarm.

@kenfinnigan
Copy link

That would be my guess.

We changed to allow you to add a JDBC driver as a dependency and we'd auto create the module.xml for it

@gavinking
Copy link
Member Author

@kenfinnigan OK, but the problem is we don't use Maven, and instead call swarmtool using java -jar. And I'm not sure what to pass as an argument to have it include hsqldb.

@kenfinnigan
Copy link

Ah.

Could you raise a JIRA issue, as I suspect that's a gap we hadn't thought of

@gavinking
Copy link
Member Author

OK.

(I did try --fractions=com.h2database:h2:1.4.187 but that did not help.)

@gavinking
Copy link
Member Author

Issue reported as https://issues.jboss.org/browse/SWARM-1439.

@kenfinnigan
Copy link

Thanks @gavinking

@gavinking
Copy link
Member Author

Hi, @kenfinnigan is there some easy workaround for this issue? Some config file I can easily add to my project to force the default datasource to be created?

Thanks.

@bobmcwhirter
Copy link

You're attempting this against a pre-built .war that you can't rebuild? If you can somehow get your driver within your WEB-INF/lib, then it should create the default DS based on that driver.

@FroMage
Copy link
Member

FroMage commented Aug 18, 2017

What if you add a dep to the h2 module in the Ceylon module, @gavinking?

@Ladicek
Copy link

Ladicek commented Aug 18, 2017

When testing EAP quickstarts with Swarm, I found the same obstacle. I added the --dependencies switch, which takes a comma-separated list of G:A:Vs, and that solved my usecase.

So maybe --dependencies=com.h2database:h2:1.4.187?

@Ladicek
Copy link

Ladicek commented Aug 18, 2017

FTR, this was tracked under https://issues.jboss.org/browse/SWARM-1100

@gavinking
Copy link
Member Author

What if you add a dep to the h2 module in the Ceylon module

Didn't help.

@FroMage
Copy link
Member

FroMage commented Aug 18, 2017

Where did it end up in the .war?

@gavinking
Copy link
Member Author

So maybe --dependencies=com.h2database:h2:1.4.187?

Where precisely? My swarmtool doesn't support this switch.

@gavinking
Copy link
Member Author

My swarmtool doesn't support this switch.

Oh, OK, it's added in newer versions. Fine.

@gavinking
Copy link
Member Author

@Ladicek alright, so here's my problem. swarmtool up until version 2017.3.2 didn't support the --dependencies argument. And so my app fails because the datasource can't be found.

But after 2017.3.2, the server starts, but simply doesn't deploy my JAX-RS app. This is all that is logged by the server startup:

Aug 18, 2017 4:22:41 PM org.jboss.weld.bootstrap.WeldStartup <clinit>
INFO: WELD-000900: 2.3.5 (Final)
Aug 18, 2017 4:22:41 PM org.jboss.weld.environment.deployment.discovery.DiscoveryStrategyFactory create
INFO: WELD-ENV-000020: Using jandex for bean discovery
Aug 18, 2017 4:22:42 PM org.jboss.weld.bootstrap.WeldStartup startContainer
INFO: WELD-000101: Transactional services not available. Injection of @Inject UserTransaction not available. Transactional observers will be invoked synchronously.
Aug 18, 2017 4:22:42 PM org.jboss.weld.environment.se.WeldContainer initialize
INFO: WELD-ENV-002003: Weld SE container internal initialized
Fri Aug 18 16:22:42 CEST 2017 DEBUG [org.wildfly.swarm.runtime.server] (main) Temporarily storing configuration at: /var/folders/g5/3h5202y10nlbqllm_ftn9kc40000gn/T/swarm-config-7773360740688947777.xml
Aug 18, 2017 4:22:42 PM org.jboss.msc.service.ServiceContainerImpl <clinit>
INFO: JBoss MSC version 1.2.6.Final
Aug 18, 2017 4:22:42 PM org.jboss.as.server.ApplicationServerService start
INFO: WFLYSRV0049: WildFly Swarm 2017.3.2 (WildFly Core 2.2.1.CR1) starting
Aug 18, 2017 4:22:42 PM org.wildfly.swarm.container.runtime.cli.CommandLineArgsServiceActivator activate
INFO: WFSWARM0029: Install MSC service for command line args: []
Aug 18, 2017 4:22:43 PM org.jboss.as.server.BootstrapListener done
INFO: WFLYSRV0025: WildFly Swarm 2017.3.2 (WildFly Core 2.2.1.CR1) started in 520ms - Started 28 of 32 services (4 services are lazy, passive or on-demand)
Fri Aug 18 16:22:43 CEST 2017 INFO [org.wildfly.swarm.runtime.deployer] (main) deploying 2984f714-5916-493a-ac13-e24f2c9a0a70.war
Aug 18, 2017 4:22:43 PM org.jboss.as.server.deployment.AbstractDeploymentUnitService start
INFO: WFLYSRV0027: Starting deployment of "2984f714-5916-493a-ac13-e24f2c9a0a70.war" (runtime-name: "2984f714-5916-493a-ac13-e24f2c9a0a70.war")
Aug 18, 2017 4:22:43 PM org.jboss.as.server.deployment.DeploymentHandlerUtil$1$2 handleResult
INFO: WFLYSRV0010: Deployed "2984f714-5916-493a-ac13-e24f2c9a0a70.war" (runtime-name : "2984f714-5916-493a-ac13-e24f2c9a0a70.war")
Aug 18, 2017 4:22:43 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO: WFSWARM99999: WildFly Swarm is Ready

So apparently there is also something else that changed.

@gavinking
Copy link
Member Author

Note that this is with an app that worked fine up until it was broken by swarm 2016.12.0.

@gavinking
Copy link
Member Author

@FroMage @bobmcwhirter On Swarm 2016.12.0 I tried adding com.h2database.h2-1.4.196.jar to the Ceylon overrides.xml file (equivalent to adding it to the module descriptor), and as you can see below, that resulted in the jar being correctly packaged into `WEB-INF/lib.

But the datasource still didn't get created.

gavin$ unzip -l jaxrs.example-1.0.0.war
Archive:  jaxrs.example-1.0.0.war
  Length      Date    Time    Name
---------  ---------- -----   ----
  1821816  08-18-2017 16:30   WEB-INF/lib/com.h2database.h2-1.4.196.jar
    16546  08-18-2017 16:30   WEB-INF/lib/jaxrs.example-1.0.0.jar
  1862166  08-18-2017 16:30   WEB-INF/lib/ceylon.language-1.3.3-SNAPSHOT.jar
   640912  08-18-2017 16:30   WEB-INF/lib/com.redhat.ceylon.model-1.3.3-SNAPSHOT.jar
   238061  08-18-2017 16:30   WEB-INF/lib/com.redhat.ceylon.langtools.classfile-1.3.3-SNAPSHOT.jar
   112326  08-18-2017 16:30   WEB-INF/lib/com.redhat.ceylon.common-1.3.3-SNAPSHOT.jar
   325129  08-18-2017 16:30   WEB-INF/lib/ceylon.interop.persistence-1.3.3-SNAPSHOT.jar
   199609  08-18-2017 16:30   WEB-INF/lib/ceylon.interop.java-1.3.3-SNAPSHOT.jar
   344791  08-18-2017 16:30   WEB-INF/lib/ceylon.collection-1.3.3-SNAPSHOT.jar
        0  08-18-2017 16:30   META-INF/
        0  08-18-2017 16:30   META-INF/ceylon/
     6082  08-18-2017 16:30   META-INF/ceylon/metamodel
---------                     -------
  5567438                     12 files

@gavinking
Copy link
Member Author

But after 2017.3.2, the server starts, but simply doesn't deploy my JAX-RS app.

There is probably some additional metadata required by Swarm 2017.3+, but I don't know what it might be.

@gavinking
Copy link
Member Author

@kenfinnigan @bobmcwhirter Do I need some sort of yaml file or something in the newer versions of Swarm?

@kenfinnigan
Copy link

You don't have to use yaml, but we're moving that way instead of custom main() usage

@gavinking
Copy link
Member Author

gavinking commented Aug 21, 2017

Well I have neither a main(), nor a yaml, AFAIK. Do I need one?

@kenfinnigan
Copy link

Not unless you need to configure fractions in any way, such as DS config

@gavinking
Copy link
Member Author

So then I don't understand why it doesn't discover and start my JAX-RS application in the latest releases. What changed?

@kenfinnigan
Copy link

No error messages?

Endpoint not running at all?

@gavinking
Copy link
Member Author

Exactly.

@kenfinnigan
Copy link

Very weird. Is the project on GH somewhere we can play with?

@gavinking
Copy link
Member Author

Yes it is, it is https://github.com/DiegoCoronel/ceylon-jboss-swarm/ but you need to explicitly specify the version of swarm and the jdbc driver on the command line. Wait till I get home I will tell you the command I'm using.

@gavinking
Copy link
Member Author

gavinking commented Aug 23, 2017

OK, @kenfinnigan, the commands you need to compile, build, and run the jar are:

$ ceylon plugin install --force ceylon.swarm/1.3.3
Scripts for ceylon.swarm installed in /Users/gavin/.ceylon/bin/ceylon.swarm-1.3.3
$ pwd
/Users/gavin/ceylon-jboss-swarm/ceylon-wildfly-swarm-jaxrs
$ ceylon compile
Note: Created module jaxrs.example/1.0.0
$ ceylon swarm --swarm-version=2017.8.1 --dependencies=com.h2database:h2:1.4.196 --provided-module=javax.javaeeapi jaxrs.example
...
$ java -jar jaxrs.example-1.0.0-swarm.jar
...

Note that the command line options I've added are:

  • --swarm-version=2017.8.1 to select the version of swarmtool
  • --dependencies=com.h2database:h2:1.4.196 to pass the H2 jar as an additional dependency to swarmtool.

Let me know how you go.

@kenfinnigan
Copy link

Thanks for the details @gavinking, will take a look

@gavinking
Copy link
Member Author

Appreciated.

@kenfinnigan
Copy link

@gavinking Was able to reproduce the problem locally.

In the logs I see that undertow is the only fraction being detected by the call to ceylon swarm, which is why there is no JAX-RS endpoint being deployed.

Is ceylon swarm just a wrapper around SwarmTool, or is it more?

@gavinking
Copy link
Member Author

It's just a wrapper that directly calls swarmtool

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants