Le lun. 19 oct. 2020 à 22:04, Karl Kildén <[email protected]> a écrit :
> Romain, the craftmanship seems incredible as always. Meecro is really well
> designed from what I can tell so far. But I am a mere mortal and need docs
> to get servers to run :)
>
>
> - I do find it odd that javase code like the bake stuff can't run in a
> main method in intellij.
> - If that is the case, then surely we most doc this with a sample.
>
>
it does as soon as your idea classpath has meecrowave-core dependency tree
and specs jars present, there is really nothing special there.
Maybe dump your classpath
(System.out.println(System.getProperty("java.class.path"))) to ensure it is
correct.
>
> - Following your guide, I setup some maven plugins and could run the
> Cli class. Very convenient. For production purposes I think I would prefer
> the assembly, that works fine too.
>
>
I only use the assembly for standalone installation and the java -cp ....
Cli for docker like container build. That said both use Cli class at the
end ;).
>
> From intellij, I tried some exec stuff and did a run configuration with
> the provided dependencies checked. Simply exec:java with my Bake main
> configured in pom. I had the same issue as when starting directly from
> intellij however... Same exception: Caused by:
> java.lang.NullPointerException: Cannot invoke
> "org.apache.webbeans.corespi.scanner.xbean.OwbAnnotationFinder.getArchive()"
> because the return value of
> "org.apache.webbeans.web.scanner.WebScannerService.getFinder()" is null
>
Ok think I know, you disabled tomcat scanning so scanner is not initialized
and needs to be tuned to not fail in OWBJarScanner which is owb-tomcat
scanning alignment.
tomcatScanning(true) (or removing this line) will make it work.
Alternatively you can set a noop scanner on the context using a context
customizer or any equivalent solution.
>
>
> While running the app from maven only is acceptable since development is
> test driven anyways, I still feel like we need super crisp documentation in
> the form of a sample with some readme.
>
> Thanks for the help!
>
> My additions based on your tips are pushed:
> https://github.com/karlkilden/openwebbeans-meecrowave-examples
>
Last tip is that builder is now also a real builder (setters are needed for
factories) so you can do:
public class Start {
public static void main(String[] args) {
new Meecrowave(new Meecrowave.Builder()
.httpPort(8888)
.tomcatAutoSetup(false)
.realm(new JAASRealm())
.user("admin", "secret"))
.bake()
.await();
}
}
>
> cheers
>
>
> mån 19 okt. 2020 kl. 18:17 skrev Romain Manni-Bucau <[email protected]
> >:
>
>> @Karl: I see, so to run from intellij you should....do nothing :D
>> Joke apart, add commons-cli in scope provided (or compile/optional
>> depending if you want it or not at the end), select the main class from
>> meecrowave-core "Cli" and run :)
>>
>> Tip: ensure "include provided dependencies" checkbox is checked in
>> Application configuration in idea.
>>
>> If you really want to run your main because it has some more logic, you
>> can use maven exec plugin and in intellij configuration the same trick will
>> work.
>>
>>
>> Romain Manni-Bucau
>> @rmannibucau <https://twitter.com/rmannibucau> | Blog
>> <https://rmannibucau.metawerx.net/> | Old Blog
>> <http://rmannibucau.wordpress.com> | Github
>> <https://github.com/rmannibucau> | LinkedIn
>> <https://www.linkedin.com/in/rmannibucau> | Book
>> <https://www.packtpub.com/application-development/java-ee-8-high-performance>
>>
>>
>> Le lun. 19 oct. 2020 à 18:09, Karl Kildén <[email protected]> a
>> écrit :
>>
>>> To clarify, I assume you are supposed to be able to run it from intellij
>>> during development? E.g. run the main method like you always do.
>>>
>>> Cheers
>>>
>>> On Mon, 19 Oct 2020 at 18:07, Karl Kildén <[email protected]> wrote:
>>>
>>>> Thanks Romain for the suggestion,
>>>>
>>>> What commands did you use? Maven package and meecrowave:run works fine,
>>>> but I have not yet gotten to configure a maven plugin to run the Start
>>>> class with a main method.
>>>>
>>>> meecrowave:run, can I annotate port somehow when I run that? 8080 is
>>>> busy over here with something I don't want to restart.
>>>>
>>>> On Mon, 19 Oct 2020 at 17:24, Romain Manni-Bucau <[email protected]>
>>>> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> tested with maven and got no issue, here what you can check/try: do
>>>>> you use maven embedded in intellij (never do ;) and use a real maven 3.5
>>>>> or
>>>>> 3.6)
>>>>>
>>>>> Romain Manni-Bucau
>>>>> @rmannibucau <https://twitter.com/rmannibucau> | Blog
>>>>> <https://rmannibucau.metawerx.net/> | Old Blog
>>>>> <http://rmannibucau.wordpress.com> | Github
>>>>> <https://github.com/rmannibucau> | LinkedIn
>>>>> <https://www.linkedin.com/in/rmannibucau> | Book
>>>>> <https://www.packtpub.com/application-development/java-ee-8-high-performance>
>>>>>
>>>>>
>>>>> Le lun. 19 oct. 2020 à 17:20, Karl Kildén <[email protected]> a
>>>>> écrit :
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> So when getting to know Meecro I just added the sample bake into the
>>>>>> rest trivial and tried to run it in Intellij.
>>>>>>
>>>>>>
>>>>>> https://github.com/karlkilden/openwebbeans-meecrowave-examples/commit/15ceab392683adf356e103c1d1c8fc66139b862e
>>>>>>
>>>>>> stacktrace and code above.
>>>>>>
>>>>>> Anything I am missing?
>>>>>>
>>>>>> Cheers
>>>>>> Karl
>>>>>>
>>>>>