Configuring new workspace

5 messages Options
Embed this post
Permalink
mmmkkk

Configuring new workspace

Reply Threaded More More options
Print post
Permalink
Hi,

> I tried generating a new workspace programmatically using the
> following line of code :
>
> ((JackrabbitWorkspace)session.getWorkspace()).createWorkspace("my_new_
> workspace");
>
> It creates the requested workspace folder and appropriate
> workspace.xml within it. I then try obtaining a session on the new
> workspace like the following:
>
> session = repository.login(new SimpleCredentials(username, password
> .toCharArray()),
> "my_new_workspace");
>  
> It throws javax.jcr.NoSuchWorkspaceException. And the underlying error
> is:
>
> ERROR [org.apache.jackrabbit.core.fs.db.DatabaseFileSyst
> em] - failed to initialize file system
> com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error
> in your S
> QL syntax; check the manual that corresponds to your MySQL server
> version for th
> e right syntax to use near 'not null, FSENTRY_NAME varchar not null,
> FSENTRY_DAT
> A varbinary null, FSENTRY_LA' at line 1
>         at
> com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1026)
>         at
> com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
>         at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3491)
>         at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3423)
>         at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936)
>         at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
>         at
> com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2536)
>         at
> com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1564)
>         at
> com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1485)
>         at
> org.apache.jackrabbit.core.fs.db.DatabaseFileSystem.checkSchema(Datab
> aseFileSystem.java:1180)
>         at
> org.apache.jackrabbit.core.fs.db.DatabaseFileSystem.init(DatabaseFile
> System.java:190)
>         at
> org.apache.jackrabbit.core.config.RepositoryConfigurationParser$2.get
> FileSystem(RepositoryConfigurationParser.java:762)
>         at
> org.apache.jackrabbit.core.config.WorkspaceConfig.getFileSystem(Works
> paceConfig.java:147)
>         at
> org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.doInitialize(
> RepositoryImpl.java:1849)
>         at
> org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.initialize(Re
> positoryImpl.java:1834)
>         at
> org.apache.jackrabbit.core.RepositoryImpl.getWorkspaceInfo(Repository
> Impl.java:729)
>         at
> org.apache.jackrabbit.core.RepositoryImpl.login(RepositoryImpl.java:1
> 341)
>         at
> org.apache.jackrabbit.core.jndi.BindableRepository.login(BindableRepo
> sitory.java:161)
>         at
> com.idearc.contentmanagement.jackrabbit.service.ContentService.<init>
> (ContentService.java:102)
>         at
> com.idearc.contentmanagement.jackrabbit.web.ContentPage.<init>(Conten
> tPage.java:148)
>         at
> sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>
>         at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct
> orAccessorImpl.java:39)
>         at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC
> onstructorAccessorImpl.java:27)
>         at
> java.lang.reflect.Constructor.newInstance(Constructor.java:494)
>         at java.lang.Class.newInstance0(Class.java:350)
>         at java.lang.Class.newInstance(Class.java:303)
>         at
> org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFacto
> ry.java:58)
>         at
> org.apache.wicket.request.target.component.BookmarkablePageRequestTar
> get.newPage(BookmarkablePageRequestTarget.java:256)
>         at
> org.apache.wicket.request.target.component.BookmarkablePageRequestTar
> get.getPage(BookmarkablePageRequestTarget.java:277)
>         at
> org.apache.wicket.request.target.component.BookmarkablePageRequestTar
> get.processEvents(BookmarkablePageRequestTarget.java:205)
>         at
> org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents
> (AbstractRequestCycleProcessor.java:90)
>         at
> org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.j
> ava:1031)
>         at org.apache.wicket.RequestCycle.step(RequestCycle.java:1107)
>         at
> org.apache.wicket.RequestCycle.steps(RequestCycle.java:1176)
>         at
> org.apache.wicket.RequestCycle.request(RequestCycle.java:499)
>         at
> org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:
> 257)
>         at
> org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.jav
> a:126)
>         at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
>         at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
>         at
> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:491
> )
>         at
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:3
> 67)
>         at
> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.jav
> a:185)
>         at
> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:1
> 81)
>         at
> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:6
> 89)
>         at
> org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:391)
>
>         at
> org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHand
> lerCollection.java:146)
>         at
> org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.
> java:114)
>         at
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:1
> 39)
>         at org.mortbay.jetty.Server.handle(Server.java:285)
>         at
> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:45
> 7)
>         at
> org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpCo
> nnection.java:751)
>         at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:500)
>         at
> org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:209)
>         at
> org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:357)
>         at
> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.ja
> va:329)
>         at
> org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool
> .java:475)
>
> Am I missing something here? Please advise.
>
> Thanks!
> _____________________________________________
> From: Khanapurkar, Mona A.  
> Sent: Monday, June 29, 2009 3:20 PM
> To: '[hidden email]'
> Subject: Configuring new workspace
>
> Hello,
>
> How can I configure an additional workspace in jackrabbit content
> repository? I tried adding a new directory under "workspaces" by the
> name of the new workspace. I copied the old workspace.xml from the
> existing workspace directory and modified it's name, <Workspace
> name="my_new_workspace">. But, when I try accessing the new workspace
> like this,
>
> repository.login(new SimpleCredentials("username", "password"
> .toCharArray()), "my_new_workspace");)
>
> it throws me this exception : javax.jcr.NoSuchWorkspaceException.
>
> Restarting server does not help. I am using Jackrabbit 1.5.6. Any
> advice?
>
> Thanks!
>
>
Alexander Klimetschek

Re: Configuring new workspace

Reply Threaded More More options
Print post
Permalink
On Thu, Jul 2, 2009 at 4:24 PM, Khanapurkar, Mona
A.<[hidden email]> wrote:

>> I tried generating a new workspace programmatically using the
>> following line of code :
>>
>> ((JackrabbitWorkspace)session.getWorkspace()).createWorkspace("my_new_
>> workspace");
>>
>> It creates the requested workspace folder and appropriate
>> workspace.xml within it. I then try obtaining a session on the new
>> workspace like the following:
>>
>> session = repository.login(new SimpleCredentials(username, password
>>                                               .toCharArray()),
>> "my_new_workspace");
>>
>> It throws javax.jcr.NoSuchWorkspaceException. And the underlying error
>> is:
>>
>> ERROR [org.apache.jackrabbit.core.fs.db.DatabaseFileSyst
>> em] - failed to initialize file system
>> com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error
>> in your S
>> QL syntax; check the manual that corresponds to your MySQL server
>> version for th
>> e right syntax to use near 'not null, FSENTRY_NAME varchar not null,
>> FSENTRY_DAT
>> A varbinary null, FSENTRY_LA' at line 1

This means the database file system for the new workspace couldn't be
created, due to this SQL syntax error. This could be a
misconfiguration of the db file system, ie. the wrong implementation
or the wrong schema. What does your config look like? Are you using
the latest version of Jackrabbit (1.5.x)?

Regards,
Alex

--
Alexander Klimetschek
[hidden email]
mmmkkk

RE: Configuring new workspace

Reply Threaded More More options
Print post
Permalink
Hi Alex,

Thanks for your response. I am using jackrabbit 1.3.1, but even when I switch to 1.5.6 I get the same issue. I have attached repository.xml and the generated workspace.xml for your reference. For security reasons, I have changed the db url, username and password from my original config file.

Please let me know if I've missed anything.



Thanks,
Mona

-----Original Message-----
From: Alexander Klimetschek [mailto:[hidden email]]
Sent: Thursday, July 02, 2009 10:16 AM
To: [hidden email]
Subject: Re: Configuring new workspace

On Thu, Jul 2, 2009 at 4:24 PM, Khanapurkar, Mona
A.<[hidden email]> wrote:

>> I tried generating a new workspace programmatically using the
>> following line of code :
>>
>> ((JackrabbitWorkspace)session.getWorkspace()).createWorkspace("my_new_
>> workspace");
>>
>> It creates the requested workspace folder and appropriate
>> workspace.xml within it. I then try obtaining a session on the new
>> workspace like the following:
>>
>> session = repository.login(new SimpleCredentials(username, password
>>                                               .toCharArray()),
>> "my_new_workspace");
>>
>> It throws javax.jcr.NoSuchWorkspaceException. And the underlying error
>> is:
>>
>> ERROR [org.apache.jackrabbit.core.fs.db.DatabaseFileSyst
>> em] - failed to initialize file system
>> com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error
>> in your S
>> QL syntax; check the manual that corresponds to your MySQL server
>> version for th
>> e right syntax to use near 'not null, FSENTRY_NAME varchar not null,
>> FSENTRY_DAT
>> A varbinary null, FSENTRY_LA' at line 1
This means the database file system for the new workspace couldn't be
created, due to this SQL syntax error. This could be a
misconfiguration of the db file system, ie. the wrong implementation
or the wrong schema. What does your config look like? Are you using
the latest version of Jackrabbit (1.5.x)?

Regards,
Alex

--
Alexander Klimetschek
[hidden email]

<?xml version="1.0"?>
<!DOCTYPE Repository PUBLIC "-//The Apache Software Foundation//DTD Jackrabbit 1.2//EN"
                            "http://jackrabbit.apache.org/dtd/repository-1.2.dtd">
<Repository>
   
    <FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem">
        <param name="driver" value="com.mysql.jdbc.Driver"/>
        <param name="url" value="jdbc:mysql://test.com:3309/opencms_admin?user=abc&password=abc"/>
        <param name="schemaObjectPrefix" value="jcr_fs_"/>
    </FileSystem>
   
    <Security appName="Jackrabbit">
        <AccessManager class="org.apache.jackrabbit.core.security.SimpleAccessManager">
        </AccessManager>

        <LoginModule class="org.apache.jackrabbit.core.security.SimpleLoginModule">
           <param name="anonymousId" value="anonymous"/>
        </LoginModule>
    </Security>
   
    <Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default"/>
     
    <Workspace name="${wsp.name}">
        <FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem">
                        <param name="driver" value="com.mysql.jdbc.Driver"/>
                        <param name="url" value="jdbc:mysql://test.com:3309/opencms_admin?user=abc&password=abc"/>    
                        <param name="schemaObjectPrefix" value="jcr_fs_${wsp.name}_"/>
                </FileSystem>
       
        <PersistenceManager class="org.apache.jackrabbit.core.persistence.db.SimpleDbPersistenceManager">
            <param name="driver" value="com.mysql.jdbc.Driver"/>
                        <param name="url" value="jdbc:mysql://test.com:3309/opencms_admin?user=abc&password=abc"/>    
                        <param name="schemaObjectPrefix" value="jcr_pm_${wsp.name}_"/>  
                        <param name="externalBLOBs" value="false"/>
        </PersistenceManager>
    </Workspace>
   
    <Versioning rootPath="${rep.home}/version">
        <FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem">
                        <param name="driver" value="com.mysql.jdbc.Driver"/>
                        <param name="url" value="jdbc:mysql://test.com:3309/opencms_admin?user=abc&password=abc"/>    
                        <param name="schemaObjectPrefix" value="jcr_fs_ver_"/>
                </FileSystem>
       
        <PersistenceManager class="org.apache.jackrabbit.core.persistence.db.SimpleDbPersistenceManager">
            <param name="driver" value="com.mysql.jdbc.Driver"/>
                        <param name="url" value="jdbc:mysql://test.com:3309/opencms_admin?user=abc&password=abc"/>    
                        <param name="schemaObjectPrefix" value="jcr_pm_ver_"/>
                        <param name="externalBLOBs" value="false"/>
        </PersistenceManager>
    </Versioning>
   
</Repository>

<?xml version="1.0" encoding="UTF-8"?>
<Workspace name="my_new_workspace">
        <FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem">
                        <param name="driver" value="com.mysql.jdbc.Driver"/>
                        <param name="url" value="jdbc:mysql://test.com:3309/opencms_admin?user=abc&password=abc"/>    
                        <param name="schemaObjectPrefix" value="jcr_fs_${wsp.name}_"/>
                </FileSystem>
       
        <PersistenceManager class="org.apache.jackrabbit.core.persistence.db.SimpleDbPersistenceManager">
            <param name="driver" value="com.mysql.jdbc.Driver"/>
                        <param name="url" value="jdbc:mysql://test.com:3309/opencms_admin?user=abc&password=abc"/>    
                        <param name="schemaObjectPrefix" value="jcr_pm_${wsp.name}_"/>  
                        <param name="externalBLOBs" value="false"/>
        </PersistenceManager>
    </Workspace>
Alexander Klimetschek

Re: Configuring new workspace

Reply Threaded More More options
Print post
Permalink
On Thu, Jul 2, 2009 at 6:17 PM, Khanapurkar, Mona
A.<[hidden email]> wrote:
> Hi Alex,
>
> Thanks for your response. I am using jackrabbit 1.3.1, but even when I switch to 1.5.6 I get the same issue. I have attached repository.xml and the generated workspace.xml for your reference. For security reasons, I have changed the db url, username and password from my original config file.

You need to set the schema to MySQL (if this is the database type you
are using) - the SQL statements for creating the tables for the
filesystem and the persistence manager are different from db to db and
Jackrabbit includes schemas for most common dbs. For the persistence
manager there are even different implementations, since they try to
optimize queries and such for the specific database.

Hence, for the DB file system config, add this (see config here [1]):

    <param name="schema" value="mysql"/>

And the persistence manager should be the (bundle) MySqlPersistenceManager [2].

For more info, see the configuration manual [3] and the persistence
manager documentation [4].

[1] http://jackrabbit.apache.org/api/1.5/org/apache/jackrabbit/core/fs/db/DbFileSystem.html
[2] http://jackrabbit.apache.org/api/1.5/org/apache/jackrabbit/core/persistence/bundle/MySqlPersistenceManager.html

[3] http://jackrabbit.apache.org/jackrabbit-configuration.html
[4] http://wiki.apache.org/jackrabbit/PersistenceManagerFAQ

Regards,
Alex

--
Alexander Klimetschek
[hidden email]
mmmkkk

RE: Configuring new workspace

Reply Threaded More More options
Print post
Permalink
Thanks, Alex! It works after adding <param name="schema"
value="mysql"/>.

Appreciate your quick help!
Mona

-----Original Message-----
From: Alexander Klimetschek [mailto:[hidden email]]
Sent: Thursday, July 02, 2009 1:06 PM
To: [hidden email]
Subject: Re: Configuring new workspace

On Thu, Jul 2, 2009 at 6:17 PM, Khanapurkar, Mona
A.<[hidden email]> wrote:
> Hi Alex,
>
> Thanks for your response. I am using jackrabbit 1.3.1, but even when I
switch to 1.5.6 I get the same issue. I have attached repository.xml and
the generated workspace.xml for your reference. For security reasons, I
have changed the db url, username and password from my original config
file.

You need to set the schema to MySQL (if this is the database type you
are using) - the SQL statements for creating the tables for the
filesystem and the persistence manager are different from db to db and
Jackrabbit includes schemas for most common dbs. For the persistence
manager there are even different implementations, since they try to
optimize queries and such for the specific database.

Hence, for the DB file system config, add this (see config here [1]):

    <param name="schema" value="mysql"/>

And the persistence manager should be the (bundle)
MySqlPersistenceManager [2].

For more info, see the configuration manual [3] and the persistence
manager documentation [4].

[1]
http://jackrabbit.apache.org/api/1.5/org/apache/jackrabbit/core/fs/db/Db
FileSystem.html
[2]
http://jackrabbit.apache.org/api/1.5/org/apache/jackrabbit/core/persiste
nce/bundle/MySqlPersistenceManager.html

[3] http://jackrabbit.apache.org/jackrabbit-configuration.html
[4] http://wiki.apache.org/jackrabbit/PersistenceManagerFAQ

Regards,
Alex

--
Alexander Klimetschek
[hidden email]