[JNDI and Naming] - Re: javax.naming.NameNotFoundException: persistence not bound
by Derya Altuntas
Derya Altuntas [http://community.jboss.org/people/deryaaltuntas] created the discussion
"Re: javax.naming.NameNotFoundException: persistence not bound"
To view the discussion, visit: http://community.jboss.org/message/599641#599641
--------------------------------------------------------------
rac-tech I am not using Hibernate in my application.But I am getting same error.I also tried to add property as you specified.
But error still exists.What Can I do? I need help.This is my first EJB try.But I could not deployed
20:41:52,968 ERROR [AbstractKernelController] Error installing to Start: name=persistence.unit:unitName=SiguardEJB.jar#SiguardEJBPU state=Create: javax.naming.NameNotFoundException: SiguardEJBJNDI not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:771) [:5.0.5.Final]
at org.jnp.server.NamingServer.getBinding(NamingServer.java:779) [:5.0.5.Final]
at org.jnp.server.NamingServer.getObject(NamingServer.java:785) [:5.0.5.Final]
at org.jnp.server.NamingServer.lookup(NamingServer.java:443) [:5.0.5.Final]
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:728) [:5.0.5.Final]
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:688) [:5.0.5.Final]
at javax.naming.InitialContext.lookup(InitialContext.java:392) [:1.6.0_13]
at org.jboss.jpa.impl.deployment.PersistenceUnitInfoImpl.<init>(PersistenceUnitInfoImpl.java:120) [:2.0.0]
at org.jboss.jpa.deployment.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:252) [:1.0.2-alpha-3]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_13]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_13]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_13]
at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_13]
at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:60) [jboss-reflect.jar:2.2.0.GA]
at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:168) [jboss-reflect.jar:2.2.0.GA]
at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66) [jboss-reflect.jar:2.2.0.GA]
at org.jboss.kernel.plugins.dependency.KernelControllerContextAction$JoinpointDispatchWrapper.execute(KernelControllerContextAction.java:257) [jboss-kernel.jar:2.2.0.GA]
at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:47) [jboss-kernel.jar:2.2.0.GA]
at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:125) [jboss-kernel.jar:2.2.0.GA]
at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:72) [jboss-kernel.jar:2.2.0.GA]
at org.jboss.kernel.plugins.dependency.LifecycleAction.installActionInternal(LifecycleAction.java:202) [jboss-kernel.jar:2.2.0.GA]
at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54) [jboss-kernel.jar:2.2.0.GA]
at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:42) [jboss-kernel.jar:2.2.0.GA]
at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:379) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:2044) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:1083) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.executeOrIncrementStateDirectly(AbstractController.java:1322) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1246) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1139) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:894) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:641) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:182) [:2.2.0.GA]
at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:58) [:2.2.0.GA]
at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62) [:2.2.0.GA]
at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:55) [:2.2.0.GA]
at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:179) [:2.2.0.GA]
at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1832) [:2.2.0.GA]
at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1550) [:2.2.0.GA]
at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1571) [:2.2.0.GA]
at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1491) [:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:379) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:2044) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:1083) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.executeOrIncrementStateDirectly(AbstractController.java:1322) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1246) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1139) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:939) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:654) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.deployers.plugins.deployers.DeployersImpl.change(DeployersImpl.java:1983) [:2.2.0.GA]
at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:1076) [:2.2.0.GA]
at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:679) [:2.2.0.GA]
at org.jboss.system.server.profileservice.deployers.MainDeployerPlugin.process(MainDeployerPlugin.java:106) [:6.0.0.Final]
at org.jboss.profileservice.dependency.ProfileControllerContext$DelegateDeployer.process(ProfileControllerContext.java:143) [:0.2.2]
at org.jboss.profileservice.dependency.ProfileDeployAction.deploy(ProfileDeployAction.java:151) [:0.2.2]
at org.jboss.profileservice.dependency.ProfileDeployAction.installActionInternal(ProfileDeployAction.java:94) [:0.2.2]
at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54) [jboss-kernel.jar:2.2.0.GA]
at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:42) [jboss-kernel.jar:2.2.0.GA]
at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:379) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:2044) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:1083) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.executeOrIncrementStateDirectly(AbstractController.java:1322) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1246) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1139) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:939) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:654) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.profileservice.dependency.ProfileActivationWrapper$BasicProfileActivation.start(ProfileActivationWrapper.java:190) [:0.2.2]
at org.jboss.profileservice.dependency.ProfileActivationWrapper.start(ProfileActivationWrapper.java:87) [:0.2.2]
at org.jboss.profileservice.dependency.ProfileActivationService.activateProfile(ProfileActivationService.java:215) [:0.2.2]
at org.jboss.profileservice.dependency.ProfileActivationService.activate(ProfileActivationService.java:159) [:0.2.2]
at org.jboss.profileservice.bootstrap.AbstractProfileServiceBootstrap.activate(AbstractProfileServiceBootstrap.java:112) [:0.2.2]
at org.jboss.profileservice.resolver.BasicResolverFactory$ProfileResolverFacade.deploy(BasicResolverFactory.java:87) [:0.2.2]
at org.jboss.profileservice.bootstrap.AbstractProfileServiceBootstrap.start(AbstractProfileServiceBootstrap.java:91) [:0.2.2]
at org.jboss.system.server.profileservice.bootstrap.BasicProfileServiceBootstrap.start(BasicProfileServiceBootstrap.java:132) [:6.0.0.Final]
at org.jboss.system.server.profileservice.bootstrap.BasicProfileServiceBootstrap.start(BasicProfileServiceBootstrap.java:56) [:6.0.0.Final]
at org.jboss.bootstrap.impl.base.server.AbstractServer.startBootstraps(AbstractServer.java:827) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-5]
at org.jboss.bootstrap.impl.base.server.AbstractServer$StartServerTask.run(AbstractServer.java:417) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-5]
at java.lang.Thread.run(Thread.java:619) [:1.6.0_13]
20:41:53,000 INFO [SessionSpecContainer] Starting jboss.j2ee:jar=SiguardEJB.jar,name=FileManager,service=EJB3
20:41:53,015 INFO [EJBContainer] STARTED EJB: com.siemens.SessionBean.FileManager.FileManager ejbName: FileManager
20:41:53,015 INFO [JndiSessionRegistrarBase] Binding the following Entries in Global JNDI:
20:41:53,015 WARN [TimerServiceContainer] EJBTHREE-2193: using deprecated TimerServiceFactory for restoring timers
20:41:53,562 INFO [AbstractNoInterfaceViewBinder] Binding the following entry in Global JNDI for bean:FileManager
FileManager/no-interface -> EJB3.1 no-interface view
20:41:53,718 INFO [xnio] XNIO Version 2.1.0.CR2
20:41:53,734 INFO [nio] XNIO NIO Implementation Version 2.1.0.CR2
20:41:54,187 INFO [remoting] JBoss Remoting version 3.1.0.Beta2
20:41:54,421 INFO [TomcatDeployment] deploy, ctxPath=/
20:41:54,500 INFO [service] Removing bootstrap log handlers
20:41:54,609 ERROR [ProfileServiceBootstrap] Failed to load profile:: org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):
DEPLOYMENTS IN ERROR:
Deployment "persistence.unit:unitName=SiguardEJB.jar#SiguardEJBPU" is in error due to the following reason(s): javax.naming.NameNotFoundException: SiguardEJBJNDI not bound
at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:1228) [:2.2.0.GA]
at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:905) [:2.2.0.GA]
at org.jboss.system.server.profileservice.deployers.MainDeployerPlugin.checkComplete(MainDeployerPlugin.java:87) [:6.0.0.Final]
at org.jboss.profileservice.deployment.ProfileDeployerPluginRegistry.checkAllComplete(ProfileDeployerPluginRegistry.java:107) [:0.2.2]
at org.jboss.system.server.profileservice.bootstrap.BasicProfileServiceBootstrap.start(BasicProfileServiceBootstrap.java:135) [:6.0.0.Final]
at org.jboss.system.server.profileservice.bootstrap.BasicProfileServiceBootstrap.start(BasicProfileServiceBootstrap.java:56) [:6.0.0.Final]
at org.jboss.bootstrap.impl.base.server.AbstractServer.startBootstraps(AbstractServer.java:827) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-5]
at org.jboss.bootstrap.impl.base.server.AbstractServer$StartServerTask.run(AbstractServer.java:417) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-5]
at java.lang.Thread.run(Thread.java:619) [:1.6.0_13]
20:41:54,671 INFO [org.apache.coyote.http11.Http11Protocol] Starting Coyote HTTP/1.1 on http-127.0.0.1-8080
20:41:54,671 INFO [org.apache.coyote.ajp.AjpProtocol] Starting Coyote AJP/1.3 on ajp-127.0.0.1-8009
20:41:54,671 INFO [org.jboss.bootstrap.impl.base.server.AbstractServer] JBossAS [6.0.0.Final "Neo"] Started in 3m:42s:468ms
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/599641#599641]
Start a new discussion in JNDI and Naming at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
15 years
[JBoss Tools] - Hacking AS7 using Eclipse
by Rob Stryker
Rob Stryker [http://community.jboss.org/people/rob.stryker] modified the document:
"Hacking AS7 using Eclipse"
To view the document, visit: http://community.jboss.org/docs/DOC-16718
--------------------------------------------------------------
h1. Preface
There's already an article that shows you very well how to checkout and build the AS7 code base using command line tools. Unfortunately using Eclipse on top of those steps shows some gotchas that are not obvious. This article will show you how to import the AS7 projects to Eclipse.
h1. Solution
h2. Checkout the AS7 code base
The reference documentation may be reached at http://community.jboss.org/docs/DOC-15596 http://community.jboss.org/wiki/HackingonAS7. It shows you extensively what steps need to be achieved to get things up and running on the command line. Please follow these steps. I'll try to add the corresponding steps for http://www.eclipse.org/egit/ EGit later on
h6. +TODO: add instructions using EGit+
h2. Install M2Eclipse and EGit
The next step involves installing the appropriate plug ins for Eclipse. The easiest way to achieve that is to install them from the Eclipse Marketplace. If your build does not have the eclipse market place installed, you should consider using the Eclipse 3.7 M6 Developer Build, or, installing egit and m2eclipse directly from the following update site: http://download.eclipse.org/releases/indigo http://download.eclipse.org/releases/indigo
However, using the Eclipse Marketplace can be accomplished as follows:
http://community.jboss.org/servlet/JiveServlet/showImage/16140/install-fr... http://community.jboss.org/servlet/JiveServlet/downloadImage/16140/instal...
http://community.jboss.org/servlet/JiveServlet/showImage/16139/install-eg... http://community.jboss.org/servlet/JiveServlet/downloadImage/16139/instal...
h1. http://community.jboss.org/servlet/JiveServlet/showImage/16138/install-m2... http://community.jboss.org/servlet/JiveServlet/downloadImage/16138/instal...
h2. Add your local git Repository
After rebooting Eclipse, you'll now be able to import the local git repository.
http://community.jboss.org/servlet/JiveServlet/showImage/102-16718-9-1613... http://community.jboss.org/servlet/JiveServlet/downloadImage/102-16718-9-...
http://community.jboss.org/servlet/JiveServlet/showImage/102-16718-9-1613... http://community.jboss.org/servlet/JiveServlet/downloadImage/102-16718-9-...
h2. Import Maven Project
You'll then finally be able to import your AS7 sub-project into Eclilpse. Pick it in the list of available folders in the *Working Directory* and choose *Import Maven Project* from the context menu.
http://community.jboss.org/servlet/JiveServlet/showImage/102-16718-9-1614... http://community.jboss.org/servlet/JiveServlet/downloadImage/102-16718-9-...
You'll then end up with an project in your package explorer, that holds the name given to it in the maven pom.
h2. Correct compilation errors
h3. Run the maven build in eclipse
You may eventually have to run the maven build in a first place so that all required maven artifacts get installed to the local maven repo.
h3. Quick fix the M2Eclipse lifecycle errors
You may also experience maven related probles when using the latest *m2eclipse 0.13*. M2eclipse speeds up the build cycle by stripping it down to the bare minimum needed in Eclipse (you may read detailed documentation about in the https://docs.sonatype.org/display/M2ECLIPSE/Project+build+lifecycle+mapping m2eclipse wiki). M2eclipse will therefore report you that specific plugins are not covered by the build lifecycle. Those errors are easily fixable with quick fixes that are offered to you in the pom editor.
h3. Correct build path precedence errors
You may experience compilation errors that are not related to m2eclipse. Most of them are due to the fact, that the build setup in Eclipse differs from what is used with bare Maven on the command line.
In my particular case, where I imported the AS7 demos, I ended up with the odd case where the Eclipse compiler complained about an illegal attribute to the *@Resource* annotation.
http://community.jboss.org/servlet/JiveServlet/showImage/102-16718-9-1614... http://community.jboss.org/servlet/JiveServlet/downloadImage/102-16718-9-...
The compilation error that is reported is due to a bad resolution of the *@Resource* annotation.
If you use Eclipse with m2eclipse you'll end up with at least 2 *compilation containers* that resolve required classes. Eclipse will lookup in the *JRE System Library* in a first place and fall back to the *Maven dependencies* in a second step.
http://community.jboss.org/servlet/JiveServlet/showImage/102-16718-9-1614... http://community.jboss.org/servlet/JiveServlet/downloadImage/102-16718-9-...
The Eclipse compiler actually applies the annotation that may be found in the *jdk*. This jdk annotation does not support the lookup attribute and compilation therefore fails. On the other hand the *maven dependencies* hold the correct, extended annotation which knows about a lookup attribute. So this basically boils down to the precendece of the compilation containers in Eclipse. You may fix the above error in the project build path:
> Remove the *JRE System Library* and add it back again.
The GUI will actually not show any change, it will still show the JRE System Library in first and the *Maven Dependencies* in second place. Behind the scenes though, their order was inverted. Eclipse now resolves artifacts from the Maven container and will fall back to the JRE if needed.
http://community.jboss.org/servlet/JiveServlet/showImage/102-16718-9-1613... http://community.jboss.org/servlet/JiveServlet/downloadImage/102-16718-9-...
The root cause is adressed in the following Eclipse bugzilla: https://bugs.eclipse.org/bugs/show_bug.cgi?id=342128 https://bugs.eclipse.org/bugs/show_bug.cgi?id=342128
The basic problem behind this is that the lookup attribute was introduced in Java EE6 and the current jdk can't handle it. The basic hack that allows maven to compile this is to put the EE jar into the endorsed directory. You may have an extensive read about this here: http://jaitechwriteups.blogspot.com/2011/02/resource-and-new-lookup-attri... http://jaitechwriteups.blogspot.com/2011/02/resource-and-new-lookup-attri...
--------------------------------------------------------------
Comment by going to Community
[http://community.jboss.org/docs/DOC-16718]
Create a new document in JBoss Tools at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=102&co...]
15 years
[JBoss Cache] - CacheLoader store not recreating keys/values
by jaysmith
jaysmith [http://community.jboss.org/people/jaysmith] created the discussion
"CacheLoader store not recreating keys/values"
To view the discussion, visit: http://community.jboss.org/message/599443#599443
--------------------------------------------------------------
Hi there,
I have a simple proof of concept JUnit that creates a cache, creates a node, creates a test object and adds this object to the node. The cache is configured with a FileCacheLoader, passivation disabled and eviction happens after 2 seconds.
What I would expect to see is that when the object is added to the node, both RAM and disk are written to, after 2 seconds then memory should be cleared. After that time, a read should load the node and the object that the node contains back into memory.
However, what I'm actually seeing is different. After 2 seconds has elapsed and the node has been evicted from RAM, a read recreates the node from the persistent store but it is empty i.e. the object that the node orginally stored is no longer there.
My configuration:
<?xml version="1.0" encoding="UTF-8"?>
<jbosscache xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:jbosscache-core:config:3.2">
<!--
isolation levels supported: READ_COMMITTED and REPEATABLE_READ
nodeLockingSchemes: mvcc, pessimistic (deprecated), optimistic (deprecated)
-->
<locking
isolationLevel="REPEATABLE_READ"
lockParentForChildInsertRemove="false"
lockAcquisitionTimeout="20000"
nodeLockingScheme="mvcc"
writeSkewCheck="false"
useLockStriping="true"
concurrencyLevel="500"/>
<!--
Used to register a transaction manager and participate in ongoing transactions.
-->
<transaction
transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"
syncRollbackPhase="false"
syncCommitPhase="false"/>
<!--
Used to register JMX statistics in any available MBean server
-->
<jmxStatistics enabled="false"/>
<!--
If region based marshalling is used, defines whether new regions are inactive on startup.
-->
<startup regionsInactiveOnStartup="true"/>
<!--
Used to register JVM shutdown hooks.
hookBehavior: DEFAULT, REGISTER, DONT_REGISTER
-->
<shutdown hookBehavior="DEFAULT"/>
<!--
Used to define async listener notification thread pool size
-->
<listeners asyncPoolSize="1" asyncQueueSize="100000"/>
<!--
Used to enable invocation batching and allow the use of Cache.startBatch()/endBatch() methods.
-->
<invocationBatching enabled="false"/>
<!--
serialization related configuration, used for replication and cache loading
-->
<serialization objectInputStreamPoolSize="12" objectOutputStreamPoolSize="14" version="3.0.0"
marshallerClass="org.jboss.cache.marshall.VersionAwareMarshaller" useLazyDeserialization="false"
useRegionBasedMarshalling="false"/>
<!--
Eviction configuration. WakeupInterval defines how often the eviction thread runs, in milliseconds. 0 means
the eviction thread will never run.
-->
<eviction wakeUpInterval="500">
<default algorithmClass="org.jboss.cache.eviction.LRUAlgorithm" eventQueueSize="200000">
<property name="maxNodes" value="5000" />
<property name="timeToLive" value="1000" />
</default>
<region name="/griffin_peter">
<property name="timeToLive" value="2000" />
<!--<property name="maxAge" value="10000" />-->
</region>
<region name="/org/jboss/data2" algorithmClass="org.jboss.cache.eviction.FIFOAlgorithm" eventQueueSize="100000">
<property name="maxNodes" value="3000" />
<property name="minTimeToLive" value="4000" />
</region>
</eviction>
<!--
Cache loaders.
If passivation is enabled, state is offloaded to the cache loaders ONLY when evicted. Similarly, when the state
is accessed again, it is removed from the cache loader and loaded into memory.
Otherwise, state is always maintained in the cache loader as well as in memory.
Set 'shared' to true if all instances in the cluster use the same cache loader instance, e.g., are talking to the
same database.
-->
<loaders passivation="false" shared="false">
<preload>
<node fqn="/griffin_peter"/>
</preload>
<loader class="org.jboss.cache.loader.FileCacheLoader" async="true" fetchPersistentState="true"
ignoreModifications="false" purgeOnStartup="true">
<properties>
check.character.portability=false
location=/web/dev/jboss-cache
</properties>
<singletonStore enabled="false" class="org.jboss.cache.loader.SingletonStoreCacheLoader">
<properties>
pushStateWhenCoordinator=true
pushStateWhenCoordinatorTimeout=20000
</properties>
</singletonStore>
</loader>
</loaders>
</jbosscache>
Here is the code I have (based on code in JBoss Cache User Guide 3.x.x)
package tests.cache.loader;
import org.jboss.cache.Cache;
import org.jboss.cache.CacheFactory;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.Node;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
public class CustomCacheLoaderTest {
/** cache. */
private static Cache<String, Object> cache = null;
class TestTO {
private String field1;
public String toString() {
return this.getClass().getSimpleName() + ": field1=" + field1;
}
}
@AfterClass
public final static void afterClass() throws Exception {
cache.stop();
cache.destroy();
cache = null;
}
@BeforeClass
public final static void beforeClass() throws Exception {
CacheFactory cacheFactory = new DefaultCacheFactory();
cache = cacheFactory.createCache("jboss-cache-configuration.xml");
cache.create();
cache.start();
}
@Test
public final void put() throws Exception {
Object listener = new CustomCacheListener();
cache.addCacheListener(listener);
Node rootNode = cache.getRoot();
Fqn peterGriffinFqn = Fqn.fromString("/griffin_peter");
Node peterGriffinNode = rootNode.addChild(peterGriffinFqn);
TestTO testTO = new TestTO();
testTO.field1 = "This is a test string!";
peterGriffinNode.put("testTO", testTO);
System.out.println("Fqn: /griffin_peter: Key=testTO; Value="
+ cache.get("/griffin_peter", "testTO"));
System.out.println("\nWaiting for 4000 milliseconds ...");
Thread.sleep(4000);
java.util.Map data = cache.getData(Fqn.fromString("/griffin_peter"));
System.out.println("data.size()=" + data.size());
System.out.println("Fqn: /griffin_peter: Key=testTO; Value="
+ cache.get("/griffin_peter", "testTO"));
}
}
this outputs:
Fqn: /griffin_peter: Key=testTO; Value=TestTO: field1=This is a test string!
Waiting for 4000 milliseconds ...
data.size()=0
Fqn: /griffin_peter: Key=testTO; Value=null
When I plug a Cache Listener in, the output is:
09:04:07.678 [CustomCacheListener] Created node: /griffin_peter09:04:07.803 [CustomCacheListener] Created node: /griffin_peter
09:04:07.819 [CustomCacheListener] Visited node: /griffin_peter
09:04:07.819 [CustomCacheListener] Visited node: /griffin_peter
Fqn: /griffin_peter: Key=testTO; Value=TestTO: field1=This is a test string!
Waiting for 4000 milliseconds ...
09:04:09.866 [CustomCacheListener] Evicted node: /griffin_peter
09:04:09.866 [CustomCacheListener] Evicted node: /griffin_peter
09:04:11.819 [CustomCacheListener] Created node: /griffin_peter
09:04:11.819 [CustomCacheListener] Created node: /griffin_peter
data.size()=0
09:04:11.819 [CustomCacheListener] Visited node: /griffin_peter
09:04:11.819 [CustomCacheListener] Visited node: /griffin_peter
Fqn: /griffin_peter: Key=testTO; Value=null
So, the RAM is evicted at 09:04:09.866, node is recreated from backend store at 09:04:11.819 but the value for key testTO is null when it should be a TestTO object with field1 populated.
Any ideas why the backend store isn't storing keys and values?
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/599443#599443]
Start a new discussion in JBoss Cache at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
15 years