Is global module required as dependency in jboss-deployment-structure.xml? - jboss

My scenario:
I have defined module as global module in standalone.xml
Do I need to add this module as dependency in jboss-deployment-structure.xml?

No.
See the wildfly ee subsystem documentation:
Global modules is a set of JBoss Modules that will be added as dependencies to the JBoss Module of every Java EE deployment. Such dependencies allows Java EE deployments to see the classes exported by the global modules.

Related

What's the difference between a module and a subsystem

In the context of JBoss and Wildfly, what's the difference between a module and a subsystem?
Jboss modules is a class loading system:
JBoss Modules is a standalone implementation of a modular (non-hierarchical) class loading and execution environment for Java. In other words, rather than a single class loader which loads all JARs into a flat class path, each library becomes a module which only links against the exact modules it depends on, and nothing more. It implements a thread-safe, fast, and highly concurrent delegating class loader model, coupled to an extensible module resolution system, which combine to form a unique, simple and powerful system for application execution and distribution.
Guide for Class Loading in WildFly
Subsystems are the groups of customizable features of Jboss:
The EE subsystem provides common functionality in the Java EE platform, such as the EE Concurrency Utilities (JSR 236) and #Resource injection. The subsystem is also responsible for managing the lifecycle of Java EE application's deployments, that is, .ear files.
The EE subsystem configuration may be used to:
customise the deployment of Java EE applications,
create EE Concurrency Utilities instances,
define the default bindings
Guide for subsystem configuration

libraries in Tomcat/lib not resolved when deploying using Eclipse

I have the following issue.
I have a dao library using the atomikos JTA transaction manager.
Also I have a web project that includes that dao library.
And although the tomcat lib folder includes all the required atomikos libraries, I still need to include the atomikos dependency (maven) with scope compile on the library (such that it is packaged along, or at least Eclipse knows it has to be packaged along).
If the library is not packaged along I get Class not found exceptions when deploying under eclipse/STS.
Since the Atomikos libraries are only required for development environments, I don't want these libraries to have scope compile (or runtime).
How can I change my tomcat eclipse setup such that I can set my atomikos dependencies with scope provided in my dao library.
Any suggestions?

How do I use a Portable CDI Extension in an EAR on JBoss AS7?

We have a web application WAR that includes portable CDI extensions (seam-spring-core, activity-cdi) as JARs in the WEB-INF/lib, which works as expected on JBoss AS7.1.1.
However, when we package the WAR in an EAR the service discovery mechanism seams to fail. The class loader does not find the respective resource files in META-INF/services any more.
We have tried to put the portable CDI extensions into (JBoss) modules, however this stops the CDI annotations from being processed. We have also tried to put the JARs inside the EAR's lib directory, with the same result.
Where is the right place for portable CDI extensions within an EAR? Should portable CDI extensions within the WAR work - as it does without the EAR? Is this a JBoss AS7.1.1 issue?
That should work (jars in ear's lib) do you have beans.xml in ear? It's possible it's needed to dice into the jars.

Deploy vaadin to JBoss 7.0 gives me a ClassNotFoundException

I've created a new Vaadin (6.6.5) project in eclipse and I've tried to deploy it on JBoss 7.0 but it gives me a GWT ClassNotFoundException
Caused by: java.lang.ClassNotFoundException: com.google.gwt.user.client.ui.HasWidgets from [Module "deployment.test.war:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:191)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:358)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:330)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:330)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:307)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:101)
... 64 more
Do I need to do something extra to deploy the gwt libraries?
Seems that some GWT classes in gwt-user.jar required for compiling the Vaadin client side widgetset are loaded by the JBoss7 unnecessarily.
vaadin.jar contains references to gwt-user.jar but it's not required during runtime, only during widgetset compilation time. Still JBoss wants to load these classes causing the problem.
There's a bug report in JBoss for this: http://community.jboss.org/thread/169575?tstart=0
As mentioned there, workaround is to include gwt-user.jar to the deployment package in WEB-INF/lib folder with the vaadin.jar, seems to work.
Vaadin Eclipse plugin creates library dependencies to gwt jar files and generally Eclipse should take care of the runtime classpath when deploying.
As the package name com.google.gwt.user.client suggest this should be in gwt-user.jar.
The gwt-dev.jar should only be needed when compiling client-side code with GWT.
Are you using add-ons? Add-ons (and their dependencies) should be always added to WEB-INF/lib to make the server-side classes available to the application and client-side code available to the GWT compiler.
On possible cause of the problem is (unnecessary) dependency to client-side class which is not available in the server at runtime. So, you might also check your code for unnecessary server-side dependencies to client-side GWT classes (like HasWidgets).
Check your code to ensure that you do not accidentally access this com.google.gwt.** class from your code. As said above, there is no need to deploy gwt libraries in the server.
Vaadin has now published an add-on to fix this, see https://vaadin.com/directory#!addon/vaadin-application-server-class-loader-workaround

Which projects are on the list of JAVA EE Module Dependancy

I'm trying to include a project within another project as EE Dependency in Eclipse.
For some reason, the project I want to include is not displayed in the list of possible projects.
How does Eclipse decide which projects to use there?
Thanks!
WTP 1.5 (Eclipse 3.2+) introduced support for J2EE module dependencies for plain Java projects, external JARs, JARs in the workspace etc. This is controlled at the level of the Enterprise Application, rather than at the level of an EJB project or a Web Project.
Therefore, if you have a plain Java Project that you cannot add as a dependency to an EJB project, you can have this resolved by creating an Enterprise Application Project containing the EJB, and then adding the Java Project as a Java EE module dependency to the Enterprise Application. Once this is done, the Java Project is available as a Java EE module dependency for the EJB project.