Getting org.apache.jackrabbit.core.state.ItemStateException while working with jackrabbit repository - jackrabbit

class="org.apache.jackrabbit.core.persistence.bundle.PostgreSQLPersistenceManager">
<param name="driver" value="org.postgresql.Driver" />
<param name="url" value="jdbc:postgresql://192.168.1.200:5433/NEWDMS" />
<param name="user" value="postgres" />
<param name="password" value="eminence" />
<param name="schema" value="postgresql" />
<param name="schemaObjectPrefix" value="${wsp.name}_" />
<param name="externalBLOBs" value="false" />
</PersistenceManager>
I have created a transient Repository and done changes in repository.xml file
while accessing jackrabbit repository i am getting following exception : org.apache.jackrabbit.core.state.ItemStateException: failed to read bundle: deadbeef-face-babe-cafe-babecafebabe
java.lang.IllegalArgumentException: Invalid namespace index: 3158064

The "failed to read bundle: deadbeef-face-babe..." message is a symptom of a repository inconsistency. Start with these knowledge base articles: Fix the "jcr:system" node, Consistency Check, and Tar Data File Rotation. The third link highlights this configuration parameter of the persistence manager that might be of interest (although I see that you are not using the default TPM persistence manager, so it might not be relevant):
<param name="maxFileSize" value="512" />

Related

Why does Sling/Jackrabbit use twice the disc space to store a file?

Why does Sling/Jackrabbit use twice the disc space to store a file and what can I do to prevent it from doing this?
I'm working on a project where we're storing files and associated data in Sling. For operational reasons we would like to avoid excessive disc usage. We've hit a problem where anytime we store a file in Sling the amount of disc space used appears to be double.
For instance, I have 47 megs of files. When uploaded to Sling I have 53 megs in the datastore, there's a lot of different files so I can accept that amount of inflation. However if we look at the total size of the Jackrabbit repository we see a different story ...
jackrabbit]# du -s
118688 .
jackrabbit]# du -s repository/datastore/
53296 repository/datastore/
jackrabbit]# du -s workspaces/default/blobs/
53464 workspaces/default/blobs/
Now the data associated with these files is quite small (<1 meg) so I don't see why the workspace is storing so much data when it's supposed to be all stored in the datastore. This problem gets worse when I upload a larger file, here I've added a 277 meg file to the above repository.
jackrabbit]# du -s
686508 .
jackrabbit]# du -s repository/datastore/
337152 repository/datastore/
jackrabbit]# du -s workspaces/default/blobs/
337320 workspaces/default/blobs/
I've uploaded sets of multi gigabyte files and this behaviour seems to be consistent.
I'm using the default repository.xml file created by the Sling standalone 6 when its run, this does appear to have the FileDataStore configured (see below). I was under the impression that with the FileDataStore configured Jackrabbit wouldn't store its files in blobs but that appears to be the case here. Can anyone provide me with a reason why this behaviour is exibited or a way to disable it? It seems exceedingly strange that a system would essentially store a file twice.
<Repository>
<FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
<param name="path" value="${rep.home}/repository"/>
</FileSystem>
<DataStore class="org.apache.jackrabbit.core.data.FileDataStore"/>
<Security appName="Jackrabbit">
<SecurityManager class="org.apache.jackrabbit.core.DefaultSecurityManager" workspaceName="security">
</SecurityManager>
<AccessManager class="org.apache.sling.jcr.jackrabbit.server.impl.security.PluggableDefaultAccessManager">
</AccessManager>
<LoginModule class="org.apache.sling.jcr.jackrabbit.server.impl.security.PluggableDefaultLoginModule">
<param name="anonymousId" value="anonymous"/>
<param name="adminId" value="admin"/>
</LoginModule>
</Security>
<Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default"/>
<Workspace name="${wsp.name}">
<FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
<param name="path" value="${wsp.home}"/>
</FileSystem>
<PersistenceManager class="org.apache.jackrabbit.core.persistence.db.DerbyPersistenceManager">
<param name="url" value="jdbc:derby:${wsp.home}/db;create=true"/>
<param name="schemaObjectPrefix" value="${wsp.name}_"/>
<param name="shutdownOnClose" value="false"/>
</PersistenceManager>
<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
<param name="path" value="${wsp.home}/index"/>
<param name="supportHighlighting" value="true"/>
</SearchIndex>
</Workspace>
<Versioning rootPath="${rep.home}/version">
<FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
<param name="path" value="${rep.home}/version" />
</FileSystem>
<PersistenceManager class="org.apache.jackrabbit.core.persistence.db.DerbyPersistenceManager">
<param name="url" value="jdbc:derby:${rep.home}/version/db;create=true"/>
<param name="schemaObjectPrefix" value="version_"/>
<param name="shutdownOnClose" value="false"/>
</PersistenceManager>
</Versioning>
<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
<param name="path" value="${rep.home}/repository/index"/>
<param name="supportHighlighting" value="true"/>
</SearchIndex>
</Repository>

Struts 2 Passing Parameter with dot in Google App Engine

I can pass parameter in Struts 2 (GAE app) Url something like below:
http://localhost:8888/user/jr
http://localhost:8888/user/jr#jrgalia
But i got an error for
http://localhost:8888/user/jr#jrgalia.com
How to allow to pass parameter with dot character?
Below is in struts.xml
....
<constant name="struts.enable.SlashesInActionNames" value="true"/>
<constant name="struts.mapper.alwaysSelectFullNamespace" value="false"/>
...
<action name="/user/*" class="LinkAction" method="usersLink">
<param name="userName">{1}</param>
<result>
<param name="location">/index.jsp</param>
<param name="parse">false</param>
<param name="encode">false</param>
</result>
</action>
Below is the error:
HTTP ERROR 404
Problem accessing /user/jr#jrgalia.com. Reason:
NOT_FOUND
Powered by Jetty://

GAE log on localhost to file

when i debug my GAE application on localhost, how can i save the log created with Logger class to file? I can see it in console now(stderr) but dont want to redirct console to file. I found some solutions for python but cant make it work for java. Please can you help me?
Add an ApplicationAppender in your log.xml setting file:
<appender name="applicationAppender" class="org.apache.log4j.DailyRollingFileAppender">
<param name="encoding" value="UTF-8"/>
<param name="file" value="C:/logs/yourlogname.log"/>
<param name="DatePattern" value="'.'yyyy-MM-dd" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{HH:mm:ss} %-5p %l - %m%n" />
</layout>
</appender>
This is for log4j, but it is a standard logging paradigm. Also you need to have your logger definition use the appender you create.
In Linux and OSX, you can use tee to direct output to a file while still making it visible on standard out:
my_command | tee filename

How do I prevent SimpleSecurityManager being used in JackRabbit?

How I stop Jackrabbit using SimpleSecurityManager?
I'm trying to call session.getUserManager() but I get a repository exception as SimpleSecurityManager.getUserManager() explicity throws it.
<Security appName="Jackrabbit">
<SecurityManager class="org.apache.jackrabbit.core.DefaultSecurityManager" workspaceName="security">
</SecurityManager>
<AccessManager class="org.apache.jackrabbit.core.security.simple.SimpleAccessManager">
<!-- <param name="config" value="${rep.home}/access.xml"/> -->
</AccessManager>
<LoginModule class="org.apache.jackrabbit.core.security.authentication.DefaultLoginModule">
<param name="anonymousId" value="anonymous"/>
<param name="adminId" value="admin"/>
</LoginModule>
</Security>
Rest of code for those that will ask...
Repository repository = new TransientRepository();
Session jackrabbitSession = repository.login(credentials);
UserManager userManager = session.getUserManager();
The user manager is a Jackrabbit extension. It's not a part of the JCR. So, you need to use a JackrabbitSession, not just a Session. Here's a link to the wiki:
http://wiki.apache.org/jackrabbit/UserManagement

Problem with execAndWait interceptor, SESSION lost

I am using execAndWait interceptor and it seems the session is lost after the interceptor..
my code is - struts-lcms.xml
...
<action name="testAction" class="com.lcms.presentation.TestAction">
<interceptor-ref name="execAndWait"></interceptor-ref>
<param name="delay">3000</param>
<param name="delaySleepInterval">50</param>
<result name="wait" type="tiles">tiles.ques</result>
<result name="success" type="tiles">tiles.ques</result>
<result name="diag" type="redirectAction">diagnosticAction</result>
</action>
...
If I remove the interceptor code then it takes me to the question page (tiles.ques) .. However, with the interceptor the session is null..
This code in execute method in the TestAction file
SessionObject sess = (SessionObject)getSession().getAttribute(LcmsConstants.SESSION_OBJECT);
it gives the session correctly if the interceptor is not used.. however, if the interceptor code is used then it throws NULL pointer exception..
Please tell me how to overcome this problem..
implements SessionAware
http://struts.apache.org/2.0.6/struts2-core/apidocs/org/apache/struts2/interceptor/ExecuteAndWaitInterceptor.html
Important: Because the action will be running in a seperate thread, you can't use ActionContext because it is a ThreadLocal. This means if you need to access, for example, session data, you need to implement SessionAware rather than calling ActionContext.getSesion().
mention in struts.xml as
<interceptor-stack name="loadingStack">
<interceptor-ref name="completeStack" />
<interceptor-ref name="execAndWait">
<param name="delay">1000</param>
<param name="delaySleepInterval">500</param>
</interceptor-ref>
</interceptor-stack>
<interceptor-ref name="loadingStack"/>
<result name="wait">ETAX/TDS/wait.jsp</result>
it is working fine on my machine

Resources