Infinispan write behind? What am i doing wrong - scala

I have a small test in which I am trying to chalk out the time taken by Infinispan in a local cache and then in a local cache with a write behind.
Surprisingly, the time taken in a local cache to put 8M entries is around 27 sec and to do a get it is 1 millisec. That is good. However, as soon as I enable the write behind the does not even end in 30 minutes. I am sure there is something which is terribly wrong with the configuration.
I have used 5.3.0 Final and 5.2.7 final.
The configurations are pasted here
<namedCache name="LocalWithWriteBehind">
<loaders shared="false">
<loader class="org.infinispan.loaders.file.FileCacheStore"
fetchPersistentState="true" ignoreModifications="false"
purgeOnStartup="false">
<properties>
<property name="location" value="${java.io.tmpdir}" />
</properties>
<!-- write-behind configuration starts here -->
<async enabled="true" threadPoolSize="500" />
<!-- write-behind configuration ends here -->
</loader>
</loaders>
</namedCache>
If you would like to see the Scala App, see the code here http://pastebin.com/PSiJFFiZ

The file cache store before Infinispan 6.0 was very slow. Please upgrade to Infinispan 6.0.0.Final, and enable the single file cache store as indicated here.

Related

Moqui 1.4.1 Postgresql Configuration

I am trying to get the Moqui 1.4.1 release up and running but using Postgres as the database platform. Here are the platform details.
Ubuntu 12.04
Postgres 9.4 using JDBC driver postgresql-9.3-1102.jdbc41.jar (sitting in /runtime/lib. Hope that's the right place)
Firstly, I can't find MoquiDefaultConf.xml anywhere so I assume this is only applicable to development?
Under runtime/conf, I have MoquiDevConf.xml, MoquiDevTestConf.xml, MoquiProductionConf.xml, MoquiStagingConf.xml. In all four, I have added the following entity-facade entry.
<entity-facade crypt-pass="MoquiDefaultPassword:CHANGEME">
<!--
<datasource group-name="transactional" database-conf-name="postgresql" schema-name="">
<inline-jdbc jdbc-uri="jdbc:postgresql://127.0.0.1:5432/MoquiDEFAULT?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8" jdbc-username="moqui" jdbc-password="moqui" pool-minsize="2" pool-maxsize="50"/>
</datasource>
-->
<datasource group-name="transactional" database-conf-name="postgres" schema-name="public">
<!--
<inline-jdbc pool-minsize="5" pool-maxsize="50">
<xa-properties user="moqui" password="moqui" serverName="localhost" portNumber="5432"
databaseName="MoquiDEFAULT"/>
</inline-jdbc>
-->
<inline-jdbc jdbc-uri="jdbc:postgresql://127.0.0.1:5432/MoquiDEFAULT"
jdbc-username="moqui" jdbc-password="moqui"
pool-minsize="2" pool-maxsize="50"/>
</datasource>
</entity-facade>
<!-- end snippet -->
The Problem:
When I run gradle load, the load target
creates a bunch of derby databases which I don't understand given that it is now configured for Postgres.
The tables enumeration_type and enumeration are created in Postgres.
Then the process gets stuck.
Here is the output at the point.
> --- 12304 [main] INFO org.moqui.impl.entity.EntityDbMeta
Created table [ENUMERATION_TYPE] for entity [moqui.basic.EnumerationType]
> --- 12788 [main] INFO org.moqui.impl.entity.EntityDbMeta
Created table [ENUMERATION] for entity [moqui.basic.Enumeration]
> --- 611953 [-task-scheduler] WARN Bitronix.tm.BitronixTransaction
transaction timed out: a Bitronix Transaction with GTRID [3132372E302E312E3100000000002E270D00000001], status=MARKED_ROLLBACK, 1 resource(s) enlisted (started Thu Jan 01 02:50:24 SAST 1970)
So Bitronix isn't happy about something.
If I terminate the load and restart, then it creates the next table geo and then gets stuck again although this time, it doesn't show the Bitronix warning.
> --- 12268 [main] INFO org.moqui.impl.entity.EntityDbMeta
Created table [GEO] for entity [moqui.basic.Geo]
Help appreciated.
Additional info in response to answers:
I downloaded this for the purposes of assessing functionality so I just want to run the application not extend it. As you've pointed out, this only has the pre-built WAR file in it. However, if I browse the contents of the WAR file, I find no MoquiDefaultConf.xml file. In fact, the only XML file in the whole WAR file is web.xml.
Upon discovering this, and after reading the chapter in the book regarding setup, I googled MoquiDefaultConf.xml and found the file on github. I then copied the datasource element out of that and simply pasted that into the entity-facade of ALL the listed Moqui*Conf.xml to make sure it got picked up....which it finally did but with the halting issue. I tried both inline jdbc options; once with the one with the xa-properties tag and once with the one without.
Sorry. I am from a Microsoft background so this is all a bit foreign to me , but in my defence I was technically capable of getting OFBiz up and running by fumbling around like this.
UPDATE:
OK. Progress.
Turns out I was running Postgres 9.1 not 9.4 (Oops. Linux noob) with postgresql-9.3-1102.jdbc4.jar driver. Not sure if that was contributing to the halting but I upgraded to Postgres 9.4 with postgresql-9.3-1102.jdbc41.jar driver, and the halting was still happening.
David, you correctly pointed out the missing startup-add-missing and runtime-add-missing attributes. The reason this happened was because I had initially tried to cobble the datasource element together from OFBiz equivalent, and when I eventually found the MoquiDefaultConf.xml online, I only copied the inline-jdbc elements into the datasource elements I used from OFBiz and didn't copy the whole datasource element. Silly. Anyway, after adding the datasource element to ONLY the MoquiDevConf.xml and "gradle load"ing, 91 tables were created in Postgres so the build completed successfully....well sort of.
A derby database called MoquiDEFAULT is still created in the derby folder in the db folder. I can confirm that the webapp is talking to Postgres because I created an entry in the Example grid and it appeared in the example table in Postgres. I don't know enough about the internals to know if queries are duplicating on the derby database.
Lastly, after using a process of elimination, I determined that the build was using MoquiDevConfig.xml and not MoquiProductionConf.xml. I.e. when I put the datasource in only the MoquiProductionConf.xml entity-facade element, it has no effect and creates tables only in derby (well...over 100 .dat files) and none in Postgres. This is confusing given that MoquiInit.properties only ever references MoquiProductionConf.xml. I can confirm that building using MoquiDevConfig.xml generates about 20 fewer .dat files than does MoquiProductionConf.xml. I don't know enough about Gradle build files to know what to change.
MoquiDevConf.xml
<?xml version="1.0" encoding="UTF-8" ?>
<tools enable-elasticsearch="true" enable-camel="false"/>
<cache-list>
<!-- Development Mode - don't use these for production, load testing, etc.
Cleared by default every 20 seconds from when loaded into cache. -->
<cache name="entity.definition" expire-time-idle="30"/>
<!-- longer timeout since this basically looks through all files to check for new or moved entity defs -->
<cache name="entity.location" expire-time-idle="300"/>
<cache name="entity.data.feed.info" expire-time-idle="30"/>
<cache name="service.location" expire-time-idle="5"/>
<cache name="service.java.class" expire-time-idle="5"/>
<cache name="kie.component.releaseId" expire-time-idle="5"/>
<cache name="screen.location" expire-time-idle="5"/>
<cache name="screen.template.mode" expire-time-idle="5"/>
<cache name="screen.template.location" expire-time-idle="5"/>
<cache name="resource.xml-actions.location" expire-time-idle="5"/>
<cache name="resource.groovy.location" expire-time-idle="5"/>
<!-- longer timeout because these are cached by the expression text itself, so changed text is a new entry -->
<cache name="resource.groovy.expression" expire-time-idle="600"/>
<cache name="resource.javascript.location" expire-time-idle="5"/>
<cache name="resource.ftl.location" expire-time-idle="5"/>
<cache name="resource.gstring.location" expire-time-idle="5"/>
<cache name="resource.wiki.location" expire-time-idle="5"/>
<cache name="resource.markdown.location" expire-time-idle="5"/>
<cache name="resource.text.location" expire-time-idle="5"/>
<cache name="resource.reference.location" expire-time-idle="5"/>
<cache name="l10n.message" expire-time-idle="600"/>
</cache-list>
<server-stats stats-skip-condition="ec.web?.request?.pathInfo?.startsWith('/rpc') || ec.web?.request?.pathInfo?.startsWith('/status')">
<!-- For development, track everything! It'll run slow through... -->
<artifact-stats type="screen" persist-bin="true" persist-hit="true"/>
<artifact-stats type="screen-content" persist-bin="true" persist-hit="true"/>
<artifact-stats type="transition" persist-bin="true" persist-hit="true"/>
<artifact-stats type="service" persist-bin="true" persist-hit="true"/>
<artifact-stats type="service" sub-type="entity-auto" persist-bin="true" persist-hit="false"/>
<artifact-stats type="service" sub-type="entity-implicit" persist-bin="true" persist-hit="false"/>
<artifact-stats type="entity" persist-bin="true"/>
</server-stats>
<webapp-list>
<webapp name="webroot" http-port="8080" https-enabled="false">
<root-screen host=".*" location="component://webroot/screen/webroot.xml"/>
</webapp>
</webapp-list>
<screen-facade boundary-comments="true">
<!-- The default conf file has a macro location defined for html already, but this is an example of how to
refer to a file to override the default macros. -->
<screen-text-output type="html" mime-type="text/html"
macro-template-location="template/screen-macro/ScreenHtmlMacros.ftl"/>
</screen-facade>
<entity-facade crypt-pass="MoquiDefaultPassword:CHANGEME">
<datasource group-name="transactional" database-conf-name="postgres" schema-name="public" startup-add-missing="true" runtime-add-missing="false">
<inline-jdbc pool-minsize="5" pool-maxsize="50">
<xa-properties user="moqui" password="moqui" serverName="localhost" portNumber="5432"
databaseName="MoquiDEFAULT"/>
</inline-jdbc>
<!-- <inline-jdbc jdbc-uri="jdbc:postgresql://127.0.0.1/MoquiDEFAULT"
jdbc-username="moqui" jdbc-password="moqui" pool-minsize="2" pool-maxsize="50"/> -->
</datasource>
</entity-facade>
<repository-list>
<!-- <repository name="main" location="http://localhost:8081/rmi" type="rmi" workspace="default"
username="admin" password="admin"/> -->
</repository-list>
<component-list>
<!-- This loads the tools component over top of the default one, which will result in a warning but works
fine. Use something like this to refer to components in a JCR repository. -->
<component name="tools" location="component/tools"/>
</component-list>
The MoquiDefaultConf.xml file is in the pre-built executable war file if you downloaded the binary release, though you can see it here in the source repo:
https://github.com/moqui/moqui/blob/master/framework/src/main/resources/MoquiDefaultConf.xml
In there you will see an example configuration for Postgres:
<datasource group-name="transactional" database-conf-name="postgres" schema-name="public" startup-add-missing="true" runtime-add-missing="false">
<inline-jdbc pool-minsize="5" pool-maxsize="50">
<xa-properties user="moqui" password="moqui" serverName="localhost" portNumber="5432"
databaseName="MoquiDEFAULT"/>
</inline-jdbc>
<!-- <inline-jdbc jdbc-uri="jdbc:postgresql://127.0.0.1/MoquiDEFAULT"
jdbc-username="moqui" jdbc-password="moqui" pool-minsize="2" pool-maxsize="50"/> -->
</datasource>
Note especially these two attributes on the datasource element: startup-add-missing="true" runtime-add-missing="false". Postgres does not support creating tables on the fly, so they all have to be created before the system gets running instead of the default mode which is to create tables only as they are needed (when the first write is done).
The MoquiDefaultConf.xml file also has a definition for the "tenantcommon" entity group, pointing it to Derby:
<datasource group-name="tenantcommon" database-conf-name="derby" schema-name="MOQUI">
<inline-jdbc pool-minsize="2" pool-maxsize="10">
<xa-properties databaseName="${moqui.runtime}/db/derby/MoquiDEFAULT" createDatabase="create"/>
</inline-jdbc>
</datasource>
To put those entities in Postgres as well you'll need to add a similar definition to the Moqui Conf XML file used at runtime.
Use this config inside entity-facade tag in MoquiDevConf.xml or MoquiProductionConf.xml
<datasource group-name="transactional" database-conf-name="postgres" schema-name="public" startup-add-missing="true" runtime-add-missing="false">
<inline-jdbc jdbc-uri="jdbc:postgresql://localhost/dbname" jdbc-username="postgres" jdbc-password="pass"/>
</datasource>

Quartz trigger state is not persisting on server start

We have a requirement to pause a job before application maintenance. We are using Quartz 2.2.1 in cluster. Database is oracle.
I have developed a screen with "Pause" functionality. I observed that "pause" works fine until I start the server again. The moment I start server, TRIGGER_STATE of QRTZ_TRIGGERS table resets to "WAITING".
Can anyone please provide a hint.
Thanks a lot in advance.
Rgds - Roy
If you have set overwriteExistingJobs=true (note that default value is false) then each time server starts, it loads the jobs/triggers from the configuration file and replaces existing ones (that have the same job/trigger names), therefore overwriting triggers and their states too as in your case.
You could try to set overwriteExistingJobs=false in the SchedulerFactoryBean. This however may not be convenient for you, since if you ever change job configuration in the server, the existing jobs with old configuration will remain in the database.
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
....
<property name="overwriteExistingJobs" value="false"/>
<property name="triggers">
<list>
....
</list>
</property>
....
</bean>

Problem changing Database in Hibernate

i'm having a problem with hibernate and don't know exactly what's going on, i have this project at work where i connect to an Oracle 10g Database using the following settings:
Host Name: localhost
port:1521
SID:orcl
user:anfxi
password:password
Now i'm at home trying to work with the same database remotely, im connected via VPN and the database ip is now 10.73.98.230 , i imported my WAR and changed the settings in my
hibernate.cfg.xml from:
<property name="hibernate.connection.driver_class">oracle.jdbc.OracleDriver</property>
<property name="hibernate.connection.url">jdbc:oracle:thin://localhost:1521:orcl</property>
<property name="hibernate.connection.username">anfexi</property>
<property name="connection.password">password</property>
<property name="connection.pool_size">1</property>
<property name="hibernate.dialect">org.hibernate.dialect.OracleDialect</property>
<property name="show_sql">true</property>
<property name="hbm2ddl.auto">validate</property>
<property name="current_session_context_class">thread</property>
to:
<property name="hibernate.connection.driver_class">oracle.jdbc.OracleDriver</property>
<property name="hibernate.connection.url">jdbc:oracle:thin://10.73.98.230:1521:orcl</property>
<property name="hibernate.connection.username">anfexi</property>
<property name="connection.password">password</property>
<property name="connection.pool_size">1</property>
<property name="hibernate.dialect">org.hibernate.dialect.OracleDialect</property>
<property name="show_sql">true</property>
<property name="hbm2ddl.auto">validate</property>
<property name="current_session_context_class">thread</property>
but i keep getting this error:
ERROR [main] (SchemaValidator.java:135) - could not get database metadata
java.sql.SQLException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
The Connection descriptor used by the client was:
localhost:1521:orcl
so it seems to be still using localhost as the DB address, i cleaned my project and rebuilt, still with no luck, is there something else that i could be missing? does the hibernate configuration gets cached in some file i have to erase or something?
EDIT
For what it may serve, i can connect using SQL developer,the problem is just hibernate still using the old localhost:1521:orcl Connection descriptor.
Thanks for your help!
Verify that the xml file you are changing in Eclipse is actually being deployed to the server. I run into problems every once in awhile where Eclipse doesn't know it needs to redeploy certain files for my webapp.
If you are using Tomcat and deploying using the workspace metadata (the default), you can check what the actual deployed WAR files look like by looking at your filesystem under:
WORKSPACE/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/APPNAME/.../path/to/hibernate.cfg.xml
If you find the config file is NOT being updated, I would recommend undeploying you app in Eclipse, deleting the entire APPNAME directory in the above path, and redeploying clean.
If none of that works, do a project-wide search for "localhost" and see if there could possible be any hardcoded connections strings anywhere.
This kind of problem is usually due to the wrong configuration file being present. Maybe you have two copies of the file and you changed one but the system is using the other
Typically when building/compiling, resources get copied to a target/build folder. Check source folders and build target folders etc.
Search the file system for all files with the name hibernate.cfg.xml or with the contents localhost:1521:orcl
Check the classpath, or try explicitly putting the folder with the configuration file you want first in the classpath.
It can also be a case of some other configuration overriding your configuration, for instance a datasource filer or a persistence.xml-file. Check those if you have them as well.
How are you running your application? Through a test case, standalone console application, servlet/j2ee container?
It is unable to understand the "orcl" SID. May be the SID is present on your "localhost" but not on the server "10.73.98.230". verify you are using the correct SID available on "10.73.98.230".
Try changing this line in your config file.
<property name="hibernate.connection.url">jdbc:oracle:thin:#10.73.98.230:1521:orcl</property>
replace // with #
you can follow the link the have infomation http://www.cryer.co.uk/brian/oracle/ORA12505.htm
Hope this will help

WCF Web Service Metadata Publishing Disabled Error

I modified my web.config to add a custom binding in order to increase the buffer and message size, and it seems like in creating the service element explicitly, it has somehow broken the reference to my behavior element.
When I try to run my web service from VS using the WCF Test Client, or I go to the service page, I get the error:
Metadata publishing for this service is currently disabled.
I've compared my web.config to a few different sources on this and everything seems to match. I've no idea what the issue is.
Here is the System.serviceModel element:
<system.serviceModel>
<services>
<service name="BIMIntegrationWS.BIMIntegrationService" behaviorConfiguration="metadataBehavior">
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<endpoint address="http://localhost:1895/BIMIntegrationService.svc"
binding="customBinding" bindingConfiguration="customBinding0"
contract="BIMIntegrationWS.IBIMIntegrationService"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="metadataBehavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<customBinding>
<binding name="customBinding0">
<binaryMessageEncoding />
<httpTransport maxReceivedMessageSize="262064"
maxBufferSize="262064"
maxBufferPoolSize="262064" />
</binding>
</customBinding>
</bindings>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true"/>
It almost seems like either the web service page is not finding the element. I don't get an error complaining that the target behaviorConfiguration doesn't exist, or anything like that, just that Metadata publishing is not enabled.
Any help would be greatly appreciated.
Thanks.
I think i've "fixed" the issue. More coming later.
EDIT:
In order to "fix" my issue, I basically added a new WCF service to my application, and had it implement my previous interface, I then copied all the code from my original service and when I tweaked the .config file (to look pretty much like the one posted in the question), everything worked fine.
Ofcourse, I know, like we all know, that there is no magic here, that there must be some discrepancy. This is when I noticed/remembered, that after I had created my original service, called "BIMIntegrationService.svc", I had decided that this was too long of a name, so I renamed/refactored my class to "BIMIntegrationWS". Doing this, however, does not change the name of the service file (and therefore the name of the file in the http:// address).
Long story short, I made 2 changes to my .config and everything worked:
1) I changed:
<service name="BIMIntegrationWS.BIMIntegrationService" behaviorConfiguration="metadataBehavior">
to
<service name="BIMIntegrationWS.BIMIntegrationWS" behaviorConfiguration="metadataBehavior">
After running the service like this, I got an error (a helpful one this time) complaining that if multipleSiteBindings was enabled, the endpoint address had to be relative. So:
2) I set that to false (because I don't remember why it was in there in the first place) and everything worked fine.
I guess I should have taken a hint when it seemed like my web service was not using my "service" element at all. :\
EDIT 2:
Actually, you can see in my second comment, in the original question, that the auto-generated tag was pointing to: , as opposed to "BIMIntegrationService".
That should have given it away.
I doubt many other people will have this same issue, but just in case.
I've had the same trouble; I've gotten everything configured correctly (even copied the code from a previous service I have running) and yet no change on allowing the service to expose metadata. yet, if I make a spelling error, parse error, etc. to the app.config I'm given exceptions telling me to correct the problem (which tells me the service is reading the config, just disregarding it.
I was able to bypass it by generating the config settings in the host application:
System.ServiceModel.Description.ServiceMetadataBehavior smb = new System.ServiceModel.Description.ServiceMetadataBehavior();
smb.HttpGetEnabled = true;
ServiceBase host = new Servicebase(typeof(MyService), new Uri("http://localhost:1234/"));
host.Description.Behaviors.Add(smb);
host.Open();
...
host.Close();
Basically allow the code to override and push the config file changes i wanted applied. I know it's not ideal, but I was exposing the service through a windows service which made this do-able. if you do get your problem resolved, please pass along the solution though as I'd be curious to know why (at least in yours, if not both our cases) it's failing.

making server.log append=true

How do I make the log server\\log\serve.log to be appended. i.e. whenver I restart JBoss it should not override the content of the log but continue from the end of it?
Add <param name="Append" value="true"/> to the <Appender> in your conf/jboss-log4j.xml file. There may be multiple appenders defined, so make sure you get the one that handles server.log.
Try setting <param name="Append" value="true"/> in your log4j.xml. This may be on a FileAppender och RollingFileAppender section. Just look for the appender that writes to server.log.
Short answer: change the log file name (e.g. myapp.log)
Longer answer: We've also seen a case where the server.log got truncated in jboss. Somewhere, someone is truncating the server.log file in some static initialization block we couldn't find. Changing the file name seems to work and the contents was appended to.
we had the same issue on our remote Ubuntu 16.04 Linuxes running Jboss EAP 6.4.0 but not when we ran our Jboss server locally in Eclipse/Windows.
The append property was already set to true.
I finally made it work by declaring the property append before the filename in the standalone-full.xml.
<properties>
<property name="append" value="true"/>
<property name="fileName" value="${jboss.server.log.dir}/server.log"/>