Fork me on GitHub
#immutant
<
2016-03-14
>
symbit17:03:51

Any tips on creating a WAR from BOOT that will work in wildfly 8.2? Going from the original deps in my POM that creates a working WAR, adding in hoplon front end deps,etc. When deploying it fails on NoClassDefFoundError: org/jboss/modules/Module. I never need this before. I add the dep to build.boot. The new WAR fails, says weld.weldclassintrospector is missing. Any Ides?

tcrawley18:03:50

@symbit: how are you creating the war? are you using http://github.com/immutant/boot-immutant?

symbit18:03:51

first I heard of it.

symbit18:03:33

Am using the war boot task.

tcrawley18:03:45

hmm, looks like we don't mention it in the WildFly guide, only lein-immutant: http://immutant.org/documentation/2.1.3/apidoc/guide-wildfly.html#h5392

tcrawley18:03:12

Immutant-based wars need a little extra sauce in them so Immutant can tie in to WildFly internals

tcrawley18:03:31

that's what's tripping you up

tcrawley18:03:03

NPE, or NCFE?

tcrawley18:03:09

NCDFE, that is

symbit18:03:08

Caused by: java.lang.NullPointerException at org.projectodd.wunderboss.as.CoreServiceActivator.activate(CoreServiceActivator.java:33) at org.jboss.as.server.deployment.service.ServiceActivatorProcessor.deploy(ServiceActivatorProcessor.java:70) [wildfly-server-8 .2.0.Final.jar:8.2.0.Final] at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:159) [wildfly-server-8.2.0.Final.jar:8.2.0.Final]

symbit18:03:23

either no module of the identifier is null. I haven't used/need this before when using mvn package and the clojure-maven-plugin

tcrawley18:03:46

have you built immutant wars with mvn package that worked?

tcrawley18:03:29

interesting. are you inserting a jboss-deployment-structure.xml in that war? otherwise, you should see the NCDFE

tcrawley18:03:00

the NPE likely means the module isn't found, which is probably happening because you are now bundling jboss-modules in the war, so there are two copies of the classes

symbit18:03:02

Yes, that file was created by lein-immutant when using lein.

symbit18:03:27

That and the app.properties hook is also hardcoded.

tcrawley18:03:41

and your app sees the "local" copy, instead of the one provided by the container, and the local copy can't find the correct module

tcrawley18:03:05

right, so, any war created by boot needs those same files

tcrawley18:03:10

which is what boot-immutant will give you

symbit18:03:52

Is there an example you could share?

tcrawley18:03:05

of using boot-immutant? sure, one sec

tcrawley18:03:26

the boot.immutant/immutant-war task works similarly to lein immutant war, and the options are doc'ed at: https://github.com/immutant/boot-immutant/blob/master/resources/deployment-guide.md

tcrawley18:03:34

if you need more, I can work up a sample project

tcrawley18:03:00

or, better, add a build.boot to our feature-demo

symbit18:03:57

I'm not sure I follow the example

symbit18:03:51

I'd expect a deftask like create-war that calls you boot-war task or something like that.

tcrawley18:03:07

I'll add that, one sec

tcrawley18:03:40

that test-app was there for me to manually confirm behavior via boot immutant-war on the command-line

tcrawley18:03:18

actually, I'll add a build.boot to the feature-demo now, that will be more useful/comprehensive I think

symbit18:03:39

Thanks you! I see the guide and options nowt too..

symbit18:03:31

I'm looking to integrate this task above..

tcrawley18:03:58

see if replacing (war) with (boot.immutant/immutant-war) (after adding [boot-immutant "0.5.0" :scope "test"] as a dep) works

symbit18:03:30

ok, just a sec.

tcrawley18:03:33

note that boot-immutant calls the uber task for you, but really should expect the uberjar to be in the fileset

tcrawley18:03:43

so you may see the uberjar created twice

symbit18:03:50

I'm assuming I should remove/rename my statif files webapp/app.properties and WEB-INF/jboss-deployment-structure.xml andjboss-web.xml ?

tcrawley18:03:17

correct, you won't need those

tcrawley18:03:44

but /me wonders why it failed before if you had those in the war generated by (war)

tcrawley18:03:04

maybe they weren't ending up in the correct place

tcrawley18:03:21

is the war task built-in?

tcrawley18:03:40

ah, so it is

symbit18:03:01

added [boot-immutant "0.5.0" :scope "test"] to my deps. not requiring since it has the full path.., but getting ClassNotFoundException on boot.immutant

symbit18:03:30

changed to require :as i that worked.

symbit18:03:09

It looks like boot doesn't like full package.

tcrawley18:03:20

I'm getting a FNFE with my test-app now, so it may be that I haven't kept up with boot itself

tcrawley18:03:26

related to the uberjar

symbit18:03:28

'[boot.immutant :as i]

symbit18:03:29

(i/immutant-war)

symbit18:03:31

They're on 2.5.2 One new thing is there is an explicit target task you need to use.

symbit18:03:37

sorry 2.5.5

tcrawley18:03:54

is it working for you at all?

tcrawley18:03:17

I'm looking at what it would take to use the uberjar in the fileset instead of creating one

tcrawley18:03:03

yeah, that's what I'm getting as well

tcrawley18:03:19

let me see if I can fix it and cut you a new plugin release quickly

symbit19:03:28

Ok. Thank you!! (I was supposed to release last Friday, so this is a huge help!!)

tcrawley19:03:47

right, it currently calls uber no matter what, and expects the result to be in target/, unfortunately

symbit19:03:51

oh ok. np. Sound like you're on it..

symbit20:03:13

How's it going? Let me know if you need any help.

tcrawley20:03:57

sorry, trying to juggle a couple of things. right now, I can't seem to find any jars in the fileset after calling uber

symbit20:03:14

did you add the new target task?

symbit20:03:22

new this release

tcrawley20:03:34

ah, I probably need uber -> jar -> immutant-war

symbit20:03:44

otherwise nothing is written.

tcrawley20:03:45

I'm looking in the fileset for it currently

symbit20:03:26

(comp (hoplon) (cljs :optimizations :advanced) (aot) (pom) (web) (i/immutant-war) (target))

tcrawley20:03:01

does that work for you?

tcrawley20:03:30

if so, that may be a workaround until I improve the plugin to not uber itself

symbit20:03:58

Adding target actually writes to the target directory, otherwise it goes through all steps, but does write anything at all.

tcrawley20:03:18

and that doesn't throw an exception for you?

symbit20:03:25

doesn't write anything..

tcrawley20:03:00

ok, let me see if I can give you a hack that works for today as a SNAPSHOT, and try to fix it for real after

tcrawley20:03:14

since you're against a deadline

symbit20:03:13

let me try again.. I didn't check the target directory with all the exceptions..

tcrawley20:03:57

if you get exceptions, it's likely you don't have a valid war, since the war task calls uber w/o calling target, then looks for the jar in target/ for the war

symbit20:03:15

That makes sense.

symbit20:03:30

The only thing written the target dir are the 3 config files. web.xml,jboss-web.xml and jboss-deplyment-structure.xml I think those are written by a different task.

symbit20:03:37

If I replace (i/immutant-war) with (war) the target dir has a war file, yes.

tcrawley20:03:55

those probably get put in the fileset by the immutant plugin before it tries to build the war

tcrawley20:03:21

I just pushed a snapshot - can you try "0.6.0-SNAPSHOT" and see if it works for you?

tcrawley20:03:47

see if it works with the task chain you posted here last

symbit20:03:58

Thank you @tcrawley ! Running now...

tcrawley20:03:44

if it runs without exception, but you have no war output in target/, remove the (target) call from the end of the chain, since I think it cleans by default

tcrawley20:03:04

the immutant task breaks the rules and writes to target/ directly instead of to the fileset

tcrawley20:03:10

that's one of the things I need to fix

symbit20:03:28

it got farther. Wrote to the target dir, created a war in the wildfly dir. Then exception.

tcrawley20:03:38

what's the exception?

tcrawley20:03:50

what if you get rid of the final (target) call? do you still get an exception?

tcrawley20:03:00

and does the generated war work for you in WildFly?

symbit20:03:47

I tried the generated war. It's missing the application code.

symbit20:03:22

FileNotFoundException: Could not locate my_project/service/core__init.class

symbit20:03:40

trying without (target) task

tcrawley20:03:22

ah, can you try adding (set-env! :resource-paths #{"src"}) as well? (using whatever path you have for the source there)

symbit20:03:24

:resource-paths #{"src/main/clojure" "......." "......."} :source-paths #{"src/main/clojure"})

symbit20:03:33

trying without (target)..

symbit20:03:57

no exc on build!

symbit21:03:51

found the code, started the immutant cache, but exc

symbit21:03:12

clojure.lang.ArityException: Wrong number of args (0) passed to: not -modified/wrap-not-modified/fn--11837

tcrawley21:03:17

does this app run outside of WildFly?

tcrawley21:03:29

and can you gist the full trace?

symbit21:03:47

i think I have to scope a few things out.

symbit21:03:11

yes, I can run it with boot dev

tcrawley21:03:33

if you're using boot-http, you're not using Immutant's web bits

symbit21:03:13

For dev I'm using that..

tcrawley21:03:16

and inside the container, you may be trying to start up http-kit instead of using the container's web server

tcrawley21:03:33

are you calling immutant.web/run anywhere?

symbit21:03:08

(run handler)

tcrawley21:03:22

is the line you linked to in the stack trace?

tcrawley21:03:56

what does the (web) task do?

symbit21:03:35

It looks like boot-http is getting called. I should be able to add :scope "test"

symbit21:03:36

Is there an app.properties hook that calls the clojure "main" functions?

symbit21:03:31

When I created the 3 files 1 year ago with lein-immutant that was the hook to call into the client app.

tcrawley21:03:10

there is an entry in app.properties that calls your init fn that you specify with :init-fn 'your.app/main

symbit21:03:19

Does it make sense that the boot-http was called first?

tcrawley21:03:39

so you'll need to pass that to the immutant-war task to have it called

symbit21:03:55

yes, I have that..

symbit21:03:41

building again with [pandeiro/boot-http "0.7.0" :scope "test"]

tcrawley21:03:09

k - I don't know enough about boot-http to know why it would be called

symbit21:03:34

:scope "test" didn't have any effect.

tcrawley21:03:24

are you sure it is being called? can you share the stack trace you get in WildFly?

tcrawley21:03:14

given that stack, it looks like something that is triggered in your init-fn. are you calling wrap-not-modified directly in your code?

symbit21:03:35

nothing direct.

symbit21:03:57

Also, I don't see my app in the stack trace.

symbit21:03:09

wrap-params from ring

tcrawley21:03:15

is there a further cause in the stack trace?

tcrawley21:03:26

what version of immutant are you using?

symbit21:03:33

ring.middleware.defaults/wrap-defaults

symbit21:03:41

nope that was the whole trace.

tcrawley21:03:02

https://github.com/immutant/immutant/blob/2.1.2/wildfly/src/immutant/wildfly.clj#L90 is the last non-clojure line in that stack, which is what makes me think it's an issue somewhere in your init-fn

tcrawley21:03:27

it may be a version mismatch between the ring you bring in and the one immutant depends on, maybe

symbit21:03:44

ugh, I just realized, my init-fn is pointing to the def handler and not the function where (run/handler is defined. Small difference between running dev in lein/jetty and prod in wildfly

symbit21:03:58

let me try pointing to the other function..

symbit22:03:40

@tcrawley: Yup that was the last piece of the puzzle. Thank you for all your time. Let me know if you need me to test anything..

tcrawley22:03:54

good to hear! I'll try to fix up the boot-immutant task a bit more, and release a 0.6.0. I'll let you know when I have something ready to test there