I'm running JBoss 7.1.1 and I can see that one of the libraries I need to use is already included in JBoss (I see it in /jboss-as-7.1.1/modules/org/codehaus/jackson/jackson-core-asl/main/jackson-core-asl-1.9.2.jar). How can I access it from my web app if it's not in web-inf/lib? Do I need to declare it in one of the xml files?
Check out Class Loading in AS7 you either need a jboss-deployment-structure.xml
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="org.codehaus.jackson.jackson-core-asl" />
</dependencies>
</deployment>
</jboss-deployment-structure>
or a header in your MANIFEST.MF
Dependencies: org.codehaus.jackson.jackson-core-asl
Related
I'm following some guide to set JCache in Wildfly 14 enviroment using as provider Infinispan.
I followed these steps :
- I downloaded the wildfly module version 9.4.14 from Infinispan website
- I copied the content of the zip in the module dir of Wildfly
- I added to my application the file jboss-deployment-structure.xml
- I added the interceptors to the beans.xml file on my application
- I add the annotation #CacheResult to a function
- I start Wildfly and I get the following error
org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type InfinispanExtensionEmbedded with qualifiers #Default
at injection point [BackedAnnotatedField] #Inject private org.infinispan.cdi.embedded.AdvancedCacheProducer.infinispanExtension
I add information that can be useful. The application that I'm deploying on wildfly is an ear ant this is the structure that I'm using :
ear file
lib
META-INF
JAR library file
META-INF
beans.xml file
jboss-deployment-structure.xml
WAR file
jboss-deployment-structure.xml :
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
<deployment>
<dependencies>
<module name="org.infinispan" slot="ispn-9.4" services="export"/>
<module name="org.infinispan.cdi.embedded" slot="ispn-9.4" services="export"/>
<module name="org.infinispan.jcache" slot="ispn-9.4" services="export"/>
</dependencies>
</deployment>
</jboss-deployment-structure>
beans.xml :
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
version="1.1" bean-discovery-mode="all">
<interceptors>
<class>org.infinispan.jcache.annotation.InjectedCacheResultInterceptor</class>
<class>org.infinispan.jcache.annotation.InjectedCachePutInterceptor</class>
<class>org.infinispan.jcache.annotation.InjectedCacheRemoveEntryInterceptor</class>
<class>org.infinispan.jcache.annotation.InjectedCacheRemoveAllInterceptor</class>
<class>org.infinispan.jcache.annotation.CacheResultInterceptor</class>
<class>org.infinispan.jcache.annotation.CachePutInterceptor</class>
<class>org.infinispan.jcache.annotation.CacheRemoveEntryInterceptor</class>
<class>org.infinispan.jcache.annotation.CacheRemoveAllInterceptor</class>
</interceptors>
</beans>
With this standard configuration, I expect the interceptor start to defined in the beans.xml start to function, so I can use a default cache container in the application
org.infinispan.cdi.embedded and org.infinispan.jcache modules have SPI extensions inside them (jar/META-INF/services folder). Just add services="export" in module dependencies in jboss-deployment-structure.xml to enable them.
Here is mine jboss-deployment-structure.xml:
<jboss-deployment-structure>
<deployment>
<module-alias name="deployment.magic-blog" />
<dependencies>
<module name="org.infinispan.cdi.embedded" slot="ispn-9.4" export="true" services="export" />
<module name="org.infinispan.jcache" slot="ispn-9.4" export="true" services="export" />
<module name="javax.cache.api" slot="ispn-9.4" export="true"/>
</dependencies>
</deployment>
I am working on web application project in wildfly. I have a web-application project which has dependency on authentication jar file. Instead of placing the authentication jar file in WEB-INF/lib, the authentication jar file placed in wildfly custom module says "com.example.authentication"
The authentication project does have log4j propery file for the logger, however, log4j jar file has been invoked common module says "com.example.logger" having log4j.jar file.
I expect the logger to be working in authentication project but the logger is not working for authentication module. NO errors or warnings on this.
Webapplication - WEB-INF/jboss-deployment-structure.xml
<jboss-deployment-structure>
<deployment>
<module name="com.example.authentication"/>
</deployment>
</jboss-deployment-structure>
com.example.authentication - module.xml
<module xmlns="urn:jboss:module:1:3" name="com.example.authentication">
<resources>
<resource-root path="authentication.jar"
</resources>
<dependencies>
<module name="com.example.logger" export="true"/>
</dependencies>
</module>
com.example.logger - module.xml
Is it possible to use CDI 1.1 with JBoss 7.1.1?
I have a single test war and would like to deploy this war together with weld 2.0.
I disabled the automatically loading of the weld module with the jboss-deployment-structure File:
<jboss-deployment-structure>
<deployment>
<exclusions>
<module name="org.jboss.weld.core" />
</exclusions>
</deployment>
</jboss-deployment-structure>
I also tried to add a extra slot in the jboss/module folder:
<jboss-deployment-structure>
<deployment>
<exclusions>
<module name="org.jboss.weld.core" />
<module name="org.jboss.weld.api" />
<module name="org.jboss.weld.spi" />
</exclusions>
<dependencies>
<module name="org.jboss.weld.core" slot="2.0" />
<module name="org.jboss.weld.api" slot="2.0" />
<module name="org.jboss.weld.spi" slot="2.0" />
</dependencies>
</deployment>
</jboss-deployment-structure>
The deployment failed in both cases because JBoss apparently needs weld for the deployment.
So is it possible to use CDI 1.1 with JBoss 7.1.1 and how?
No, it's not possible. You could try weld-servlet from 2.0 but it won't work with EJB and will get quite confused. The app server integration is different in weld 2.0, so it won't work with AS7.
JBoss Weld community has an installation script to update JBoss AS Weld Subsystem to Weld 2.0;
https://github.com/weld/as7-weld-subsystem . Wildfly is currently in Alpha4 so this may be a better option at this time.
In module.xml file in Jboss AS 7, I have a dependency
<dependencies>
<module name="org.apache.camel.components"/>
</dependencies>
I dont know what are the camel jar files I must include in the folder path org/apache/camel/components/main/ .
Kindly guide me
to start, you need camel-core...possibly others depending on which components you need...
download here: http://mvnrepository.com/artifact/org.apache.camel/camel-core
or if you are using Maven, just add this dependency to your project's pom.xml...
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>2.10.1</version>
</dependency>
I have a couple of EARs deployed in JBoss 7 AS.
App1.ear serves as a library to other EARs.
App2.ear has following deployment XML,
<jboss-deployment-structure>
<ear-subdeployments-isolated>false</ear-subdeployments-isolated>
<deployment>
<dependencies>
<module name="deployment.app1.ear" export="true" />
</dependencies>
</deployment>
<sub-deployment name="app2_ejb1.jar">
<dependencies>
<!-- Is it required ??? -->
<module name="deployment.app1.ear" />
</dependencies>
</sub-deployment>
</jboss-deployment-structure>
JBoss throws following exception while deploying the applications.
Failed to load module: deployment.app2.ear.app2_ejb1.jar:main
Caused by: org.jboss.modules.ModuleLoadException: Could not load module deployment.app1.ear:main as corresponding module spec service deployment.app1.ear:main was not found.
If childEAR depends on parentEAR and if the dependencies are specified accordingly in the XML, I would expect subdeployments of childEAR to wait untill parentEAR is successfully & completely deployed.
Does my understanding contradicts the JBoss 7 classloading architecture ?
Can someone provide a solution ?