2

Red Hat JBoss Developer Studio Version: 10.2.0.GA Build id: GA-v20161125-1418-B55 Build date: 20161125-1418

I have an maven EAR project with separate projects for:

war ejb-jar ejb-client ( local interfaces)

If I run a mvn clean install on the parent project from the command line, I can deploy the generated ear file to jboss eap7 with no problem. However, if I perform a clean/build all from the IDE, then select run-as on server, I get the following error:

    Caused by: java.lang.IllegalStateException: WFLYEE0042: Failed to 
construct component instance
        Caused by: java.lang.IllegalArgumentException: Can not set 
com.hsntech.hif.eao.OperationsCache field 
com.hsntech.hif.application.HIFManagement.opCache to 
com.hsntech.hif.eao.OperationsCache$$$view8"}}

the ejb-client jar project contains the interface:

@Local
public interface OperationsCache  {

    Map<String, OperationMapping> getOperationsMaps() throws HIFEJBException;

    void resetCache();
}

and the ejb.jar impelemtation contains:

@Singleton
@ConcurrencyManagement(ConcurrencyManagementType.CONTAINER)
public class OperationsCacheImpl implements OperationsCache, Observer {

The EJB is being created in the war project in this class:

@Singleton
@Startup
public class HIFManagement implements HIFManagementMBean {

@EJB
private OperationsCache opCache;
Tunaki
  • 132,869
  • 46
  • 340
  • 423
OldProgrammer
  • 12,050
  • 4
  • 24
  • 45
  • The injection seems to fail inside a class com.hsntech.hif.application.HIFManagement . Show that code too please. – Gimby Feb 09 '17 at 14:45

3 Answers3

0

My money goes to class loading issue. Having Eclipse build and package your app is not exactly immune to errors. IDE will keep its own build instructions, how to assemble your app into a deployable .ear artifact. You can fiddle with the settings in project settings/web assembly. I guess that if you compare the Eclipse built ear with maven built one, there will be differences in the classes contained within modules or libs.
If you are using maven ejb plugin, to filter out implementation classes from the ejb-client module, then I do not think there is a way how to get the same thing working in Eclipse. That being said, I do not think that you actually need a separate module for ejb-client. War module within ear will have access to all classes contained in jar supermodules of the parent ear module. So just add you ejb-jar as dependency to your war module with scope provided.

yntelectual
  • 3,028
  • 18
  • 24
0

I will going to give you a cure for all possible problems: 1. Arrange order of modules at parent pom:

<modules>
    <module>core-module</module>
    <module>depends-on-core</module>
    <module>depends-on-core2</module>
    <module>depends-on-depends-on-core</module>
</modules>
  1. mvn eclipse:clean don't worry Developer Studio is based on eclipse so it will be no problem.
  2. mvn eclipse:eclipse

  3. Run on server

0

General advice: Don't do it from Eclipse anyway, it's prone to random errors due to classloading, etc...

But here are some possible hints:

  • check if you're using the same Maven runtime from console and Eclipse. Some Eclipse distros ship with a weird build-in version

  • check if Eclipse is set to ignore some Maven plugins

  • check if the JBoss-Deployment works via console. There is a plugin. If you can get to work, you could use that from Eclipse, instead of the build-in feature.

Scorpio
  • 2,309
  • 1
  • 27
  • 45