jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sowmi <sow...@telenav.com>
Subject Re: java.lang.IllegalStateException: workspace 'default' not initialized
Date Thu, 27 Jul 2006 17:13:03 GMT

Here's the log and the code below that. Looks like "Thread-0" dies after the
exception is thrown while all other threads continue. Even though I see the
"Repository was not shut down properly" warning, this does not seem to be
the reason, as sometimes the execution is fine even after the warning. The
thread in question, seems to be able to retrieve the session ok, but its the
getSearchManager() call that fails.




[2006-07-27 10:04:07,846](Thread-4-iter0-ContentSearch.java) Location not
provided for search!!
[2006-07-27 10:04:07,847](Thread-1-iter0-ContentSearch.java) Location not
provided for search!!
[2006-07-27 10:04:07,847](Thread-2-iter0-ContentSearch.java) Location not
provided for search!!
[2006-07-27 10:04:07,847](Thread-0-iter0-ContentSearch.java) Location not
provided for search!!
[2006-07-27 10:04:07,846](Thread-3-iter0-ContentSearch.java) Location not
provided for search!!
[2006-07-27 10:04:07,860](Thread-0-iter0-QueryFormatter.java) No location
constraints specified.
[2006-07-27 10:04:07,860](Thread-1-iter0-QueryFormatter.java) No location
constraints specified.
[2006-07-27 10:04:07,860](Thread-4-iter0-QueryFormatter.java) No location
constraints specified.
[2006-07-27 10:04:07,860](Thread-2-iter0-QueryFormatter.java) No location
constraints specified.
[2006-07-27 10:04:07,860](Thread-3-iter0-QueryFormatter.java) No location
constraints specified.
[2006-07-27 10:04:08,282](Thread-0-iter0-RepositoryImpl.java) Existing lock
file at /home/contentuser/mgmt/repository/.lock deteteced. Repository was
not shut down properly.
[2006-07-27 10:04:09,529](Thread-0-iter0-SessionManager.java)
Thread-0-iter0:Created new session:true
[2006-07-27 10:04:09,530](Thread-0-iter0-SessionManager.java) Getting
session took: 1603 ms.
[2006-07-27 10:04:09,530](Thread-2-iter0-SessionManager.java)
Thread-2-iter0:Created new session:true
java.lang.IllegalStateException: workspace 'default' not initialized
        at
org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.getSearchManager(RepositoryImpl.java:1477)
        at
org.apache.jackrabbit.core.RepositoryImpl.getSearchManager(RepositoryImpl.java:740)
        at
org.apache.jackrabbit.core.WorkspaceImpl.getQueryManager(WorkspaceImpl.java:566)
        at
com.telenav.contentEngine.jackrabbit.prototype.search.RepositorySearch.performSearch(RepositorySearch.java:105)
        at
com.telenav.contentEngine.jackrabbit.prototype.search.RepositorySearch.search(RepositorySearch.java:76)
[2006-07-27 10:04:09,531](Thread-2-iter0-SessionManager.java) Getting
session took: 1604 ms.
        at
com.telenav.contentEngine.jackrabbit.prototype.search.RepositorySearch.search(RepositorySearch.java:63)
[2006-07-27 10:04:09,531](Thread-4-iter0-SessionManager.java)
Thread-4-iter0:Created new session:true
        at
com.telenav.contentEngine.client.ContentSearch.fuzzySearch(ContentSearch.java:117)
        at
MultiThreadedTest$RunnerThread.testAirportSearch(MultiThreadedTest.java:64)
        at MultiThreadedTest$RunnerThread.run(MultiThreadedTest.java:55)
[2006-07-27 10:04:09,532](Thread-4-iter0-SessionManager.java) Getting
session took: 1605 ms.
[2006-07-27 10:04:09,532](Thread-3-iter0-SessionManager.java)
Thread-3-iter0:Created new session:true
[2006-07-27 10:04:09,531](Thread-1-iter0-SessionManager.java)
Thread-1-iter0:Created new session:true
[2006-07-27 10:04:09,537](Thread-1-iter0-SessionManager.java) Getting
session took: 1610 ms.
[2006-07-27 10:04:09,537](Thread-3-iter0-SessionManager.java) Getting
session took: 1610 ms.
[2006-07-27 10:04:10,906](Thread-3-iter0-TNSearchIndex.java) Lucene Search
took: 1008 ms.
[2006-07-27 10:04:10,906](Thread-1-iter0-TNSearchIndex.java) Lucene Search
took: 1008 ms.
[2006-07-27 10:04:10,907](Thread-4-iter0-TNSearchIndex.java) Lucene Search
took: 1009 ms.
[2006-07-27 10:04:10,906](Thread-2-iter0-TNSearchIndex.java) Lucene Search
took: 1008 ms.




public class MultiThreadedTest {

        private int numThreads;
        private int numIterations;

        private List results;

        public MultiThreadedTest(int numThreads, int numIterations) {
                this.numThreads = numThreads;
                this.numIterations = numIterations;
                this.results = new ArrayList(numThreads);
        }

        public void run() {
                for (int i = 0; i < numThreads; i++) {
                        RunnerThread newThread = new
RunnerThread(numIterations);
                        newThread.start();
                }
        }

        static class RunnerThread extends Thread {
                private long time;
                private int numIterations;

                public RunnerThread(int num) {
                        this.numIterations = num;
                }

                public void run() {
                        String name = getName();
                        for (int i = 0; i < numIterations; i++) {
                                Thread.currentThread().setName(name +
"-iter" + i);
                                performSearch();
                        }
                }

                public void performSearch() {
                	// Each thread has a separate session object.
                	// Internally ContentSearch retrieves a session object in
the 
                	// ThreadLocal for this thread, and does the search getting
                	// the QueryManager from the workspace of the session.
                        ContentSearch search = new ContentSearch(null);
                        time = System.currentTimeMillis();
                        List list = search.fuzzySearch("test search");
                        Utils.print(list);
                        time = System.currentTimeMillis() - time;
                        System.out.println("[" +
Thread.currentThread().getName() + "]Time taken:  " + time);
                }
        }

        public static void main(String[] args) throws Exception {
        	// Opening 5 threads, 2 iterations each.
                MultiThreadedTest test = new MultiThreadedTest(5, 2);
                test.run();
        }
}
-- 
View this message in context: http://www.nabble.com/java.lang.IllegalStateException%3A-workspace-%27default%27-not-initialized-tf2006499.html#a5525269
Sent from the Jackrabbit - Users forum at Nabble.com.


Mime
View raw message