Is there any way to configure io.sentry and io.sentry.logback for wildfly? so my Javaee application can log to sentry through wildfly.
I tried to add io.sentry and io.sentry.logback as modules, but always get
Caused by: org.jboss.modules.ModuleNotFoundException: io.sentry.logback
I added io.sentry-5.2.0.jar and io.sentry-logback-5.2.0.jar to \modules\system\layers\base\io\sentry\main ...\sentry-logback\main folder with module.xml and tried to configure
<custom-handler name="SENTRY" module="io.sentry.logback" class="io.sentry.logback.SentryAppender">
<level name="WARN"/>
<formatter>
<pattern-formatter pattern="%d %-5p [%c] [%t] %s%E%n"/>
</formatter>
<properties>
<property name="dsn" value="https://f455e9b9a2bd47ca8c547f4919178f3b#sentry.uc.se/38"/>
</properties>
</custom-handler>
in standalone.xml
also added io.sentry and io.sentry.logback jar to module/system/layers/base/io/sentry (sentry-logback)/main
with module.xml. following is xml for sentry.logback
<module name="io.sentry.logback" xmlns="urn:jboss:module:1.9">
<properties>
<property name="jboss.api" value="private"/>
</properties>
<resources>
<resource-root path="sentry-logback-5.2.0.jar"/>
</resources>
<dependencies>
<module name="io.sentry"/>
</dependencies>
</module>
Seems wildfly is using Log4j so I switched to sentry-jul integration, and it works well after that.
Some guide on sentry github
https://github.com/getsentry/sentry-java/discussions/2129#discussioncomment-3031199
Related
I have an application that I am trying to deploy to JBoss EAP 6.4. I don't see any errors while deploying the application. However, when I try to access the application with the context root like http://localhost:8080/contextroot/ I am being redirected to http://localhost:8080/contextroot.war-345rdser34dwwe/login.jsp where contextroot.war-345rdser34dwwe is a folder created under ${jboss.home}/standalone/tmp/vfs/temp
This is my jboss-deployment-structure.xml
<jboss-deployment-structure> <!-- Make sub deployments isolated by default, so they cannot see each others
classes without a Class-Path entry -->
<ear-subdeployments-isolated>false</ear-subdeployments-isolated> <!-- This corresponds to the top level deployment. For a war this is the
war's module, for an ear --> <!-- This is the top level ear module, which contains all the classes in
the EAR's lib folder -->
<deployment>
<resources>
<resource-root path="WEB-INF/lib/bcprov-jdk16-1.46.jar" use-physical-code-source="true"/>
</resources>
<!-- exclude-subsystem prevents a subsystems deployment unit processors running
on a deployment --> <!-- which gives basically the same effect as removing the subsystem, but
it only affects single deployment -->
<exclusions>
<module name="org.javassist" />
<module name="org.hibernate" />
<module name="org.hibernate.validator" />
<module name="org.jboss.msc" />
<module name="javax.faces.api" />
<module name="com.sun.jsf-impl" />
<module name="org.apache.log4j" />
<module name="org.slf4j" />
<module name="org.slf4j.impl" />
<module name="org.apache.commons.logging" />
<module name="org.jboss.resteasy.resteasy-hibernatevalidator-provider" />
</exclusions>
<!-- This allows you to define additional dependencies, it is the same as
using the Dependencies: manifest attribute -->
<dependencies>
<module name="com.company.app.config" optional="TRUE"/>
<module name="deployment.module.nested.app"/>
</dependencies>
</deployment>
<module name="deployment.module.nested.app">
<resources>
<resource-root path="../contextroot.war"/>
</resources>
</module>
This is my jboss-web.xml
<!DOCTYPE jboss-web PUBLIC
"-//JBoss//DTD Web Application 4.2//EN"
"http://www.jboss.org/j2ee/dtd/jboss-web_4_2.dtd">
<jboss-web>
<security-domain>UserModule</security-domain>
<security-domain>ServiceModule</security-domain>
</jboss-web>
This is my config in standalone-ha.xml for security subsystem
<security-domain name="UserModule" cache-type="default">
<authentication>
<login-module code="com.company.uas.service.authentication.loginmodule.UserLoginModule" flag="required"/>
</authentication>
</security-domain>
<security-domain name="ServiceModule" cache-type="default">
<authentication>
<login-module code="com.company.uas.service.authentication.loginmodule.ServiceLoginModule" flag="required"/>
</authentication>
</security-domain>
I have been working on it for couple of days now but could not find anything online related to this issue.
I am not sure if I consider this an answer but I understood why my /contextroot was changing to /contextroot.war-345rdser34dwwe. This was because, I was deploying a war file to JBoss and JBoss was pointing to the exploded version of my war file which was present in the tmp folder for some reason.
I deployed an exploded version of my war file with the name contextroot.war as the name of the folder and it worked.
Wildfly Version: 21.0.2.Final
JDK Version: openjdk-11.0.2
Eclipselink: Migrating from 2.7.8 to 3.0.0 ( 2.7.8 working fine)
When I try to deploy EJB 3.2 (JPA 2.2) project I am getting the below issue
10:29:59,261 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7) MSC000001: Failed to start service jboss.deployment.unit."AAA-EAR.ear".FIRST_MODULE_USE: org.jboss.msc.service.StartException in service jboss.deployment.unit."AAA-EAR.ear".FIRST_MODULE_USE: WFLYSRV0153: Failed to process phase FIRST_MODULE_USE of deployment "AAA-EAR.ear"
at org.jboss.as.server#13.0.3.Final//org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:189)
at org.jboss.msc#1.4.12.Final//org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1739)
at org.jboss.msc#1.4.12.Final//org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1701)
at org.jboss.msc#1.4.12.Final//org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1559)
at org.jboss.threads#2.4.0.Final//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads#2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990)
at org.jboss.threads#2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
at org.jboss.threads#2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1363)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: javax.persistence.PersistenceException: WFLYJPA0057: PersistenceProvider 'org.eclipse.persistence.jpa.PersistenceProvider' not found
at org.jboss.as.jpa#21.0.2.Final//org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.lookupProvider(PersistenceUnitServiceHandler.java:1001)
at org.jboss.as.jpa#21.0.2.Final//org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.nextPhaseDependsOnPersistenceUnit(PersistenceUnitServiceHandler.java:1044)
at org.jboss.as.jpa#21.0.2.Final//org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.deploy(PersistenceUnitServiceHandler.java:137)
at org.jboss.as.jpa#21.0.2.Final//org.jboss.as.jpa.processor.PersistenceBeginInstallProcessor.deploy(PersistenceBeginInstallProcessor.java:52)
at org.jboss.as.server#13.0.3.Final//org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:182)
... 8 more
Eclipselink 2.7.8 working fine, so I just updated eclipselink version to 3.0 in below module.xml.
Also I think no need to exclude javax as this folder does not in eclipselink 3.0 jar.
wildfly-21.0.2.Final/modules/system/layers/base/org/eclipse/persistence/main/module.xml
<module name="org.eclipse.persistence" xmlns="urn:jboss:module:1.5">
<properties>
<property name="jboss.api" value="public"/>
</properties>
<resources>
<resource-root path="jipijapa-eclipselink-21.0.2.Final.jar"/>
<resource-root path="eclipselink-3.0.0.jar">
<filter>
<exclude path="javax/**" />
</filter>
</resource-root>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.annotation.api"/>
<module name="javax.enterprise.api"/>
<module name="javax.persistence.api"/>
<module name="javax.transaction.api"/>
<module name="javax.validation.api"/>
<module name="javax.xml.bind.api"/>
<module name="org.antlr"/>
<module name="org.dom4j"/>
<module name="org.jboss.as.jpa.spi"/>
<module name="org.jboss.logging"/>
<module name="org.jboss.vfs"/>
</dependencies>
</module>
Below is my META-INF/persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="AAA-EJB" transaction-type="JTA">
<provider>**org.eclipse.persistence.jpa.PersistenceProvider**</provider>
<jta-data-source>java:/Test</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="eclipselink.jpa.uppercase-column-names" value="true"/>
<property name="eclipselink.query-results-cache" value="false"/>
<property name="eclipselink.refresh" value="true"/>
<property name="eclipselink.cache.shared.default" value="false"/>
<property name="eclipselink.deploy-on-startup" value="true" />
</properties>
</persistence-unit>
</persistence>
Eclipselink 2.7.8 working fine but getting issue for Eclipselink 3.0.
Please help. Thanks.
I have migrated my application from jboss5.1.2-eap to jboss-7.2-eapand java6 to java8 but after migration it is starting giving me exception while starting the server.
Caused by: java.lang.NoClassDefFoundError: Lorg/apache/commons/dbcp/BasicDataSource
we have a datasource.xml file present in the classpath of the server, having the following line of code.
<bean id="beanName" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="oracle.jdbc.OracleDriver"/>
<property name="maxActive" value="10"/>
Also we have commons-dbcp-1.2.2.jar present in the classpath but it is not working for jboss-7.2-eap.
Now I am not sure if commons-dbcp-1.2.2.jar is supported by jboss7-eap. as it is present in the classpath of the application(present in the loaded module), but still spring is not able to create the bean for datasource.
I suppose that datasource in Jboss EAP should be placed in standalone.xml configuration file and looks like here:
<datasource jndi-name="java:jboss/datasources/Altis" pool-name="Altis" enabled="true">
<connection-url>jdbc:oracle:thin:#255.255.255.255:1521:sid</connection-url>
<driver-class>oracle.jdbc.OracleDriver</driver-class>
<driver>oracle</driver>
<security>
<user-name>username</user-name>
<password>passwd</password>
</security>
</datasource>
Given module information in the jboss-deployment-structure.xml inside the WEB-INF directory of the war file.
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="com.oracle.sql" export="true"/>
<module name="org.apache.commons.dbcp" export="true"/>
</dependencies>
</deployment>
</jboss-deployment-structure>
Also the module directories should also follow the same naming convention as per the availability of your .class files inside the jar, like in my case I have created module org.apache.commons.dbcp as while opening commons-dbcp-1.2.2.jar file, .class files are present inside org/apache/commons/dbcp folder.
Note: In case of multiple modules, you need to identify there dependency if a module is dependent on other and that information will be given inside module.xml file. like
<module xmlns="urn:jboss:module:1.1" name="org.apache.commons.dbcp">
<resources>
<resource-root path="commons-dbcp-1.2.2.jar"/>
</resources>
<dependencies>
<module name="org.apache.commons.pool"/>
<module name="com.oracle.jdbc.driver"/>
</dependencies>
</module>
I am trying to deploy an application configured with eclipse link as jpa provider on jbosss eap 6.3
but it seems there is an issue between EclipseLink and jboss because i get a stackoverflow error while deploying
Failed to define class org.eclipse.persistence.internal.weaving.WeaverLogger in Module "deployment.test-service.war:main" from Service Module Loader: java.lang.StackOverflowError
at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.8.0_74]
at org.jboss.as.server.deployment.module.VFSResourceLoader.getClassSpec(VFSResourceLoader.java:131) [jboss-as-server-7.4.1.Final-redhat-3.jar:7.4.1.Final-redhat-3]
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:268) [jboss-modules.jar:1.3.4.Final-redhat-1]
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:92) [jboss-modules.jar:1.3.4.Final-redhat-1]
at org.jboss.modules.Module.loadModuleClass(Module.java:568) [jboss-modules.jar:1.3.4.Final-redhat-1]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:205) [jboss-modules.jar:1.3.4.Final-redhat-1]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459) [jboss-modules.jar:1.3.4.Final-redhat-1]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408) [jboss-modules.jar:1.3.4.Final-redhat-1]
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389) [jboss-modules.jar:1.3.4.Final-redhat-1]
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134) [jboss-modules.jar:1.3.4.Final-redhat-1]
at org.eclipse.persistence.internal.jpa.weaving.PersistenceWeaver.transform(PersistenceWeaver.java:100)
at org.jboss.as.jpa.classloader.JPADelegatingClassFileTransformer.transform(JPADelegatingClassFileTransformer.java:48) [jboss-as-jpa-7.4.1.Final-redhat-3.jar:7.4.1.Final-redhat-3]
at org.jboss.as.server.deployment.module.DelegatingClassFileTransformer.transform(DelegatingClassFileTransformer.java:60) [jboss-as-server-7.4.1.Final-redhat-3.jar:7.4.1.Final-redhat-3]
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:474) [jboss-modules.jar:1.3.4.Final-redhat-1]
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:277) [jboss-modules.jar:1.3.4.Final-redhat-1]
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:92) [jboss-modules.jar:1.3.4.Final-redhat-1]
at org.jboss.modules.Module.loadModuleClass(Module.java:568) [jboss-modules.jar:1.3.4.Final-redhat-1]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:205) [jboss-modules.jar:1.3.4.Final-redhat-1]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459) [jboss-modules.jar:1.3.4.Final-redhat-1]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408) [jboss-modules.jar:1.3.4.Final-redhat-1]
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389) [jboss-modules.jar:1.3.4.Final-redhat-1]
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134) [jboss-modules.jar:1.3.4.Final-redhat-1]
at org.eclipse.persistence.internal.jpa.weaving.PersistenceWeaver.transform(PersistenceWeaver.java:100)
Do i need to add some configuration to jboss(standalone.xml)?
There is my persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="unit" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver" />
<property name="javax.persistence.jdbc.url" value="jdbc:postgresql://*****" />
<property name="javax.persistence.jdbc.user" value="*****" />
<property name="javax.persistence.jdbc.password" value="****" />
<!-- EclipseLink should create the database schema automatically -->
<property name="eclipselink.ddl-generation" value="create-tables" />
<property name="eclipselink.ddl-generation.output-mode" value="database" />
<property name="eclipselink.logging.level" value="SEVERE"/>
</properties>
</persistence-unit>
</persistence>
My pom.xml(this project will be a dependency of another)
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.maventest</groupId>
<artifactId>test-app</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../test-app</relativePath>
</parent>
<artifactId>test-repository</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>apache-log4j-extras</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.jpa</artifactId>
<version>2.6.2</version>
</dependency>
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.1-901-1.jdbc4</version>
</dependency>
</dependencies>
</project>
Any advices will be appreciated
Thank you very much
Thanks to Chris answer , i managed to run jboss eap 6 and EclipseLink by integrating eclipse link module inside jboss eap
I needed to create a new folder : JBOSS_ HOME\modules\org\eclipse\persistence\main and copy eclipselink.jar inside. Then i needed to create the module.xml associated
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="org.eclipse.persistence">
<resources>
<resource-root path="eclipselink.jar" />
</resources>
<dependencies>
<module name="javax.api" />
<module name="javax.persistence.api" />
<module name="javax.transaction.api" />
<module name="javax.validation.api" />
<module name="javax.xml.bind.api" />
<module name="org.antlr" />
<module name="org.apache.commons.collections" />
<module name="org.dom4j" />
<module name="org.javassist" />
<module name="org.jboss.logging" />
</dependencies>
</module>
Complete tutorial : https://docs.jboss.org/author/display/WFLY8/JPA+Reference+Guide#JPAReferenceGuide-UsingEclipseLink and http://www.eclipse.org/eclipselink/documentation/2.5/solutions/jboss002.htm
Moreover despites my server ran smoothly after that but i got a new error after trying persisting any data "object is not a known entity type"
The problem was because in the persistence.xml i had the line <exclude-unlisted-classes>false</exclude-unlisted-classes>
It seems there is a classloading issue between eclipselink and jboss eap
I needed to declare explicitely entities by <class> attributes
I am trying to deploy a Spring-JPA-Hibernate web application on Wildfly. First, I had problems with Hibernate which seemed to go away with
<jboss-deployment-structure>
<deployment>
<exclusions>
<module name="org.hibernate" slot="main" />
</exclusions>
<dependencies>
<module name="org.hibernate" />
</dependencies>
</deployment>
</jboss-deployment-structure>
then however, my org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean tried to parse its mappingResources (xml file), and I got the exception
Error while parsing (.... etc)
org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.buildHibernateConfiguration(EntityManagerFactoryBuilderImpl.java:1163)
... 44 more
Caused by: org.dom4j.DocumentException: org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory
which seems to suggest there is another dom4j on the classpath.
At this point I got lost, since tinkering again with jboss-deployment-structure.xml only made the server freeze with no error message soon after startup.
Is there a simple way just to tell Wildfly not to put on the classpath at least its dom4j (or better, not to add anything at all automatically)?
I think that you must choose a strategy to use the classes from Wildfly or to use the classes you provide in your application.
I have the similar issue with Liferay 6.2 GA3 deployed in Wildfly 8.2. I solved it using a deployment descriptor similar to:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
<deployment>
<exclusions>
<module name="org.apache.log4j"/>
<module name="org.hibernate"/>
<module name="org.hibernate.validator"/>
<module name="org.jboss.as.jpa"/>
<module name="org.javassist"/>
<module name="javaee.api"/>
</exclusions>
<dependencies>
<!-- add the module and remove the dom4j in your application
or exclude the module and add the jar in your application -->
<module name="org.dom4j"/>
<module name="javax.mail.api"/>
<module name="org.apache.xerces"/>
<module name="org.jboss.modules"/>
</dependencies>
</deployment>
</jboss-deployment-structure>
https://www.liferay.com/community/forums/-/message_boards/view_message/40321431#_19_message_47754919
If you want to use the Wildfly classes and deploy the JPA entities in Wildfly container, use a similar persitence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="MyApp" transaction-type="JTA" >
<!-- Data Source -->
<jta-data-source>java:jboss/datasources/MyApplicationPool</jta-data-source>
<!-- Class -->
<class>entities here </class>
<!-- Properties -->
<properties>
<!-- the persitence unit will be deployed in Wildfly and linked to spring
using JNDI https://docs.jboss.org/author/display/WFLY8/JPA+Reference+Guide#JPAReferenceGuide-BindingEntityManagerFactory%2FEntityManagertoJNDI -->
<property name="jboss.entity.manager.factory.jndi.name" value="java:jboss/WildflyEntityManagerFactory" />
<property name="jboss.entity.manager.jndi.name" value="java:/WildflyEntityManagerVMS" />
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect" />
<!-- for the JODA datetime -->
<property name="jadira.usertype.autoRegisterUserTypes" value="true" />
</properties>
</persistence-unit>
Make reference to the Wildfly persitence unit in your Spring application:
<bean id="transactionManager"
class="org.springframework.transaction.jta.JtaTransactionManager">
</bean>
<tx:annotation-driven transaction-manager="transactionManager" />
<jee:jndi-lookup id="entityManagerFactory"
jndi-name="java:jboss/WildflyEntityManagerFactory" expected-type="javax.persistence.EntityManagerFactory" />
And you should not need any specific jboss-deployment-structure.