My Java EE 6 application uses slf4j with logback as logging framework. I have openjpa custom logging which is not working on Weblogic while it was ok on glassfish before (whit openjpa 1.2).
When I add my custom log factory to "openjpa.log" property in persistence.xml, weblogic ignores this and doesn't work.
my custom log factory:
<property name="openjpa.Log" value="com.kishware.core.log.openjpa.CustomSLF4JLogFactory"/>
Here is the weblogic console output when ignores the property:
<Aug 17, 2013 11:29:35 AM GMT+04:30> <Warning> <J2EE> <BEA-160202> <You have specified a openjpa.Log setting in your configuration for persistence unit banco-product#pu-channel-manager. This setting will be ignored and all log messages will be sent to the WebLogic Server logging subsystem. Trace-level logging is controlled by the various JPA-specific debug settings in config.xml, or through the WebLogic Server Administration Console.>
I should mention that I'm using JPA 2.1 with Toplink implementation.
I would be happy to get some hints, how this could be solved.
I should mention that I'm using JPA 2.1 with Toplink implementation
Right there is your problem. You're trying to configure Toplink (and I think you mean EclipseLink) with OpenJPA configuration properties.
Related
I have a Spring boot app I'm trying to add database logging to which is better than
spring.jpa.properties.hibernate.show_sql=true
log4jdbc, from
https://github.com/marcosemiao/log4jdbc
seems to be the most up to date fork around, seems to format nicely, fills in parameters and adds timing, exactly what I want.
But when I configure it as stated in the readme, changing
spring.datasource.url=jdbc:mysql://localhost:3306/coindatabase?useSSL=false
to
spring.datasource.url=jdbc:log4jdbc:mysql://localhost:3306/coindatabase?useSSL=false
something seems to not like my reference to mysql and seems to try to fall back to H2:
Caused by: java.lang.RuntimeException: Driver org.h2.Driver claims to not accept jdbcUrl, jdbc:log4jdbc:mysql://localhost:3306/coindatabase?useSSL=false
at com.zaxxer.hikari.util.DriverDataSource.<init>(DriverDataSource.java:106)
Is there some easy way to make this work together?
log4jdbc for spring boot wrapper:
<groupId>com.integralblue</groupId>
<artifactId>log4jdbc-spring-boot-starter</artifactId>
which seems to pull in the implementation from:
<groupId>org.bgee.log4jdbc-log4j2</groupId>
<artifactId>log4jdbc-log4j2-jdbc4.1</artifactId>
Additional info:
Don't modify the spring.datasource.url property in your Spring Boot application.properties file; leave the URL as previously defined to access your MYSQL instance.
Instead, after grabbing the com.integralblue maven target, simply set the logging level of choice (ex logging.level.jdbc.sqltiming=info) and your previously defined log4j log will have the DB stuff in it.
See here as was well
You need to use this library in your build.gradle:
// https://mvnrepository.com/artifact/com.integralblue/log4jdbc-spring-boot-starter
compile group: 'com.integralblue', name: 'log4jdbc-spring-boot-starter', version: '2.0.0'
If you get the warning:
"Loading class 'com.mysql.jdbc.Driver'. This is deprecated. The new driver class is 'com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary."
you can set the correct Driver yourself via properties:
log4jdbc.drivers=com.mysql.cj.jdbc.Driver
log4jdbc.auto.load.popular.drivers=false
The documentation for configuration can be found on Github
Looking for help for some solutions on switching out the default data provider for the project from MS SQL to mySQL. Eventually with the intent of deploying the solution to Auruora on AWS.
After installing the nuget package I get something along the lines of :
System.TypeLoadException: Method 'Clone' in type 'MySql.Data.EntityFrameworkCore.Infraestructure.MySQLOptionsExtension' from assembly 'MySql.Data.EntityFrameworkCore, Version=6.10.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' does not have an implementation.
This lead me to believe that there is no .NET 2.0 Entity Framework Core extention that runs for MySQL. Do I have to rollback to a different version?
For EntityFrameworkCore, it's suggested to use Pomelo.EntityFrameworkCore.MySql.
You may refer to their Getting Started documentation.
A fellow member of the community has kindly summarised the essential steps here:
Put Pomelo.EntityFrameworkCore.MySql into the xxx.EntityFrameworkCore project's .csproj file (see step 2 in the Pomelo getting started guide)
In your xxxDbContextConfigurer class put builder.UseMySql(...) rather than builder.UseSqlServer(...)
Change the connection string found in the appsettings.json file in the xxx.Web.Host project
I have two Spring MVC applications that share a commons.jar library. This library includes logback logging library (logback 1.2.3 and slf4j 1.7.25) and the logback.xml file.
Both wars include this line in their web.xml file:
<env-entry>
<env-entry-name>applicationName</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>nameOfApplicationA|nameOfApplicationB</env-entry-value>
</env-entry>
Each application generates its own log file including hostname, for example: HOST1-nameOfApplicationA.log. Logback configuration is as follows:
<insertFromJNDI env-entry-name="java:comp/env/applicationName" as="APP_NAME" />
<appender name="ROLLING_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_PATH}/${HOSTNAME}-${APP_NAME}.log</file>
...
</appender>
Everything was working OK (Spring MVC 4.3.7.RELEASE, Hibernate 4, C3P0 latest), but we decided to upgrade to Hibernate 5.2.10 and change to HikariCP 2.6.1. After that, logback was no longer able to resolve java:comp/env/applicationName:
ERROR in ch.qos.logback.classic.joran.action.InsertFromJNDIAction - [java:comp/env/applicationName] has null or empty value
Resulting in both applications using the same file name HOST1-APP_NAME_IS_UNDEFINED.log.
As we changed at the same time Hibernate and HikariCP we went back to C3P0 to check the root cause, and can confirm that the new version of Hibernate has nothing to do. The change was developed in its own branch so no other change seems to affect (anyway, when returning to C3P0 it works).
I've been doing some tracing in Hikari's and Logback's code but I'm not able to see anything. I'm stuck, no idea of what to look.
Plan B is insert in each war its own logback.xml but I would like to avoid it and understand the problem as it may affect other parts of the application.
Both wars are deployed together in an Apache Tomcat/8.0.38 server. Tried also 8.5.12. It also happens if only one of the wars is deployed alone.
Although I found no solution, #brettw identified the problem (see https://github.com/brettwooldridge/HikariCP/issues/873), and got a workaround.
It seems that because HikariCP depends on slf4j, and HikariCP is also being initialized and registered into JNDI, is that causing Logback to initialize before the <env-entry> entries have registered.
The test made was initalize Hikari datasource with "org.apache.naming.factory.BeanFactory" factory instead of "com.zaxxer.hikari.HikariJNDIFactory". This way it works correctly.
I had previously set my project up to use hibernate3-maven-plugin with org.hibernate.dialect.SQLServerDialect as the hibernate.dialect and everything was working fine.
But when I changed the dialect to org.hibernate.dialect.SQLServer2005Dialect, hibernate3-maven-plugin encounters the following error:
An API incompatibility was encountered while executing org.codehaus.mojo:hibernate3-maven-plugin:2.2:hbm2ddl: java.land.NoSuchMethodError: org.hibernate.dialect.SQLServer2005Dialect.registerColumnType(IJLjava/lang/String;)V
Does hbm2ddl support SQLServer2005Dialect or SQLServer2008Dialect (I also get the same error with 2008)?
I am using version 2.2 of the plugin and hibernate.4.1.0.Final and JPA 2.0.
Just lost a few days to the same error with gradle and glassfish. I added my own SqlServer2005Dialect from source, and commented out the registerColumnType() lines. From here, the error changed to "java.lang.NoSuchFieldError: INSTANCE"
This is a much more google-able error, and basically means you have 2 sets of hibernate jars.
In my case, I had installed hibernate via glassfish before hibernate was put into the gradle build. Uninstalling hibernate from glassfish fixed my error, and I can now run the 2008 or 2005 dialects.
Can anybody please help me with a link or document to run jbpm-5.2 on tomcat 7 using mysql as database ? Does jbpm deployment to tomcat require some other tool or repository or something else ? I am a complete novice to jbpm... Please help me.
Thanks in advance...
I had same problem and have posted a solution here (there is an ANT script referenced which can be downloaded):
http://ironclaws.wordpress.com/2012/06/18/jbpm-5-2-tomcat-7-mysql-ant-script-18-2/
To summarize what is required in order to install jbpm 5.2 onto tomcat 7 using the final full distribution:
Bitronix Transaction Manager : The distribution does not attempt to deploy / configure this despite the requirement. The above Ant installer will install Bitronix at the Tomcat Server level – advantageous as at this point BTM may be integrated into other projects on the platform.
The jBPM distribution is designed for JBoss AS server and the console / console-server packages include EL (expression language) libraries. These will conflict with those which are installed with Tomcat – the Tomcat EL should be preserved.
There is some confusion with respect to javassist jar in the config / config-server distributions.
The included jars should be dropped – and included into both config / config-server javassist-3.4.GA
The reason for this dependency is that Hibernate 3.4 is deployed as persistence layer in this distribution.
There is a conflicting dom4j library – dom4j-1.6.jar deployed with the console / console-server packages. This should also be removed.
It is not mentioned clearly that the parameter:
-Dreporting.needcontext=true needs to be passed to the Tomcat JVM in order to allow the gtw-server to correctly instantiate the report module loader.
For the ‘Demo’ it is important to configure the human-server persistence correctly, and additionally address the includeantruntime issue during starting of this service.