You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Jenni P <je...@gmail.com> on 2010/05/04 15:22:24 UTC

Getting noSuchMethodError in jackrabbit session.login() method

Hi All,

    I am getting NoSuchMethodError at Session session = repository.login(*
new* SimpleCredentials("username", "password".toCharArray())); when running
my below application. I have added below jar files to my application.Below
is the sample application downloaded from the location
http://jackrabbit.apache.org/first-hops.html

I am new to the Jackrabbit. Please guide me to run the application
successfully.

Thanks in advance.



*JAR FILES ADDED TO APPLICATION*:
jackrabbit-jcr-commons-2.0.0.jar,jackrabbit-api-2.0.0.jar,
jackrabbit-core-2.0.0.jar, jackrabbit-jca-2.0.0.jar, jcr-1.0.jar,
lucene-core-3.0.1.jar.



*ERROR* :

Exception in thread "main" java.lang.NoSuchMethodError:
org.apache.lucene.analysis.standard.StandardAnalyzer.<init>([Ljava/lang/String;)V

at org.apache.jackrabbit.core.query.lucene.JackrabbitAnalyzer.<init>(*
JackrabbitAnalyzer.java:41*)

at org.apache.jackrabbit.core.query.lucene.SearchIndex.<init>(*
SearchIndex.java:205*)

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(*Native Method*)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)

at java.lang.reflect.Constructor.newInstance(Unknown Source)

at java.lang.Class.newInstance0(Unknown Source)

at java.lang.Class.newInstance(Unknown Source)

at org.apache.jackrabbit.core.config.BeanConfig.newInstance(*
BeanConfig.java:186*)

at
org.apache.jackrabbit.core.config.RepositoryConfigurationParser$1.getQueryHandler(
*RepositoryConfigurationParser.java:627*)

at org.apache.jackrabbit.core.config.RepositoryConfig.getQueryHandler(*
RepositoryConfig.java:930*)

at org.apache.jackrabbit.core.SearchManager.<init>(*SearchManager.java:173*)

at org.apache.jackrabbit.core.RepositoryImpl.getSystemSearchManager(*
RepositoryImpl.java:698*)

at org.apache.jackrabbit.core.RepositoryImpl.access$400(*
RepositoryImpl.java:125*)

at org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.getSearchManager(
*RepositoryImpl.java:1868*)

at org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.doPostInitialize(
*RepositoryImpl.java:2077*)

at org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.initialize(*
RepositoryImpl.java:1996*)

at org.apache.jackrabbit.core.RepositoryImpl.initStartupWorkspaces(*
RepositoryImpl.java:535*)

at org.apache.jackrabbit.core.RepositoryImpl.<init>(*RepositoryImpl.java:366
*)

at org.apache.jackrabbit.core.RepositoryImpl.create(*RepositoryImpl.java:673
*)

at org.apache.jackrabbit.core.TransientRepository$2.getRepository(*
TransientRepository.java:231*)

at org.apache.jackrabbit.core.TransientRepository.startRepository(*
TransientRepository.java:259*)

at org.apache.jackrabbit.core.TransientRepository.login(*
TransientRepository.java:355*)

at org.apache.jackrabbit.commons.AbstractRepository.login(*
AbstractRepository.java:123*)

at FirstHop.main(*FirstHop.java:20*)

*APPLICATION CODE:*



*import* javax.jcr.Repository;

*import* javax.jcr.Session;

*import* javax.jcr.SimpleCredentials;

*import* javax.jcr.Node;

*import* org.apache.jackrabbit.core.TransientRepository;

/**

* Second hop example. Stores, retrieves, and removes example content.

*/

*public* *class* SecondHop {

*public* *static* *void* main(String[] args) *throws* Exception {

Repository repository = *new* TransientRepository();

Session session = repository.login(*new* SimpleCredentials("username",
"password".toCharArray()));

*try* {

Node root = session.getRootNode();

// Store content

Node hello = root.addNode("hello");

Node world = hello.addNode("world");

world.setProperty("message", "Hello, World!");

session.save();

// Retrieve content

Node node = root.getNode("hello/world");

System.*out*.println(node.getPath());

System.*out*.println(node.getProperty("message").getString());

// Remove content

root.getNode("hello").remove();

session.save();

String name = repository.getDescriptor(Repository.*REP_VENDOR_URL_DESC*);

System.*out*.println("name "+name);

} *finally* {

session.logout();

}

}

}



Thanks,

Jenni

RE: Getting noSuchMethodError in jackrabbit session.login() method [SEC=UNCLASSIFIED]

Posted by Jenni Pothu <Je...@virtusa.com>.
Hi Ross,

        Thank you very much Ross. I removed all the jar files except
jackrabbit-standalone-2.0.1.jar.  Now my application is working.
Actually my application is at location "C:\eclipse-workspace\Web" in my
machine. So  repository is created in the same location. But the nodes
are not added.  Where the nodes will get added. How to view the nodes.
Do you have any idea how to add the txt files to repository using
jackrabbit. 

 

public static void main(String[] args) throws Exception {

        Repository repository = new TransientRepository();

       Session session = repository.login(new
SimpleCredentials("username", "password".toCharArray()));

        try {

            Node root = session.getRootNode();

            // Store content

            Node sampleNode = root.addNode("sampleNode");

Node childNode = sampleNode.addNode("childNode");

            sampleNode.setProperty("message", "Hello jackrabbit world");

            session.save();

            System.out.println("rootnode:"+session.getRootNode()+":");

            // Retrieve content

            Node node = root.getNode("sampleNode");

            System.out.println(node.getPath());

            System.out.println(node.getProperty("message").getString());

 

            // Remove content

            //root.getNode("hello").remove();

            session.save();

       

        } catch (Exception e) {

            e.printStackTrace();

            //session.logout();

        }

Thanks,

Jenni

 

From: Ross.Dyson@ipaustralia.gov.au
[mailto:Ross.Dyson@ipaustralia.gov.au] 
Sent: Wednesday, May 05, 2010 10:47 AM
To: users@jackrabbit.apache.org
Subject: RE: Getting noSuchMethodError in jackrabbit session.login()
method [SEC=UNCLASSIFIED]

 

Jenni 

I think you need to look again at your classpath and the instructions in
the First Hops example. 

The only jar file you need in your path is
jackrabbit-standalone-2.x.x.jar, it contains unjarred classes from all
of the dependent libraries. 


Give that a shot and see how it goes. 


Ross. 


--------------------------------------------------------------------------------------------

This message, including any attachments, contains confidential information 
intended for a specific individual and purpose, and is intended for the addressee only. Any unauthorized disclosure, use, dissemination, copying, or distribution of 
this message or any of its attachments or the information contained in this e-mail, or the taking of any action based on it, is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return e-mail and delete this message.

--------------------------------------------------------------------------------------------

RE: Getting noSuchMethodError in jackrabbit session.login() method [SEC=UNCLASSIFIED]

Posted by Ro...@ipaustralia.gov.au.
Jenni

I think you need to look again at your classpath and the instructions in 
the First Hops example.

The only jar file you need in your path is 
jackrabbit-standalone-2.x.x.jar, it contains unjarred classes from all of 
the dependent libraries.


Give that a shot and see how it goes.


Ross.


RE: Getting noSuchMethodError in jackrabbit session.login() method

Posted by Jenni Pothu <Je...@virtusa.com>.
Hi Justin,
      Thanks for your reply Justin. I have download the jar files from
location http://jackrabbit.apache.org/downloads.html. And tried my
application by adding the lucene-core-2.4.1.jar and removed the
lucene-core-3.0.1.jar. Still getting error but it is different from
previous error. Below is the error. Do I need to change anything in
repository.xml for my application. Please help me to run the application
successfully.

Exception in thread "main" java.lang.NullPointerException: dispatcher
	at
org.apache.jackrabbit.core.observation.ObservationManagerImpl.<init>(Obs
ervationManagerImpl.java:97)
	at
org.apache.jackrabbit.core.WorkspaceImpl.getObservationManager(Workspace
Impl.java:748)
	at
org.apache.jackrabbit.core.SessionImpl.removeRegisteredEventListeners(Se
ssionImpl.java:1189)
	at
org.apache.jackrabbit.core.SessionImpl.logout(SessionImpl.java:1217)
	at
org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.doDispose(Reposi
toryImpl.java:2183)
	at
org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.dispose(Reposito
ryImpl.java:2138)
	at
org.apache.jackrabbit.core.RepositoryImpl.doShutdown(RepositoryImpl.java
:1175)
	at
org.apache.jackrabbit.core.RepositoryImpl.shutdown(RepositoryImpl.java:1
127)
	at
org.apache.jackrabbit.core.RepositoryImpl.initStartupWorkspaces(Reposito
ryImpl.java:544)
	at
org.apache.jackrabbit.core.RepositoryImpl.<init>(RepositoryImpl.java:366
)
	at
org.apache.jackrabbit.core.RepositoryImpl.create(RepositoryImpl.java:673
)
	at
org.apache.jackrabbit.core.TransientRepository$2.getRepository(Transient
Repository.java:231)
	at
org.apache.jackrabbit.core.TransientRepository.startRepository(Transient
Repository.java:259)
	at
org.apache.jackrabbit.core.TransientRepository.login(TransientRepository
.java:355)
	at
org.apache.jackrabbit.commons.AbstractRepository.login(AbstractRepositor
y.java:123)
	at FirstHop.main(FirstHop.java:20)

Thanks,
Jenni

	

-----Original Message-----
From: Justin Edelson [mailto:justinedelson@gmail.com] 
Sent: Tuesday, May 04, 2010 7:01 PM
To: users@jackrabbit.apache.org
Subject: Re: Getting noSuchMethodError in jackrabbit session.login()
method

Where'd you derive that list of JAR files from? AFAIK, Jackrabbit
depends upon lucene-core-2.4.1, not 3.0.1. Also, you should be using the
JCR 2.0 JAR (although this wouldn't be the cause of this exception).

Justin

On 5/4/10 9:22 AM, Jenni P wrote:
> Hi All,
> 
>     I am getting NoSuchMethodError at Session session =
repository.login(*
> new* SimpleCredentials("username", "password".toCharArray())); when
running
> my below application. I have added below jar files to my
application.Below
> is the sample application downloaded from the location
> http://jackrabbit.apache.org/first-hops.html
> 
> I am new to the Jackrabbit. Please guide me to run the application
> successfully.
> 
> Thanks in advance.
> 
> 
> 
> *JAR FILES ADDED TO APPLICATION*:
> jackrabbit-jcr-commons-2.0.0.jar,jackrabbit-api-2.0.0.jar,
> jackrabbit-core-2.0.0.jar, jackrabbit-jca-2.0.0.jar, jcr-1.0.jar,
> lucene-core-3.0.1.jar.
> 
> 
> 
> *ERROR* :
> 
> Exception in thread "main" java.lang.NoSuchMethodError:
>
org.apache.lucene.analysis.standard.StandardAnalyzer.<init>([Ljava/lang/
String;)V
> 
> at org.apache.jackrabbit.core.query.lucene.JackrabbitAnalyzer.<init>(*
> JackrabbitAnalyzer.java:41*)
> 
> at org.apache.jackrabbit.core.query.lucene.SearchIndex.<init>(*
> SearchIndex.java:205*)
> 
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(*Native
Method*)
> 
> at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown
Source)
> 
> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
Source)
> 
> at java.lang.reflect.Constructor.newInstance(Unknown Source)
> 
> at java.lang.Class.newInstance0(Unknown Source)
> 
> at java.lang.Class.newInstance(Unknown Source)
> 
> at org.apache.jackrabbit.core.config.BeanConfig.newInstance(*
> BeanConfig.java:186*)
> 
> at
>
org.apache.jackrabbit.core.config.RepositoryConfigurationParser$1.getQue
ryHandler(
> *RepositoryConfigurationParser.java:627*)
> 
> at
org.apache.jackrabbit.core.config.RepositoryConfig.getQueryHandler(*
> RepositoryConfig.java:930*)
> 
> at
org.apache.jackrabbit.core.SearchManager.<init>(*SearchManager.java:173*
)
> 
> at org.apache.jackrabbit.core.RepositoryImpl.getSystemSearchManager(*
> RepositoryImpl.java:698*)
> 
> at org.apache.jackrabbit.core.RepositoryImpl.access$400(*
> RepositoryImpl.java:125*)
> 
> at
org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.getSearchManager
(
> *RepositoryImpl.java:1868*)
> 
> at
org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.doPostInitialize
(
> *RepositoryImpl.java:2077*)
> 
> at
org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.initialize(*
> RepositoryImpl.java:1996*)
> 
> at org.apache.jackrabbit.core.RepositoryImpl.initStartupWorkspaces(*
> RepositoryImpl.java:535*)
> 
> at
org.apache.jackrabbit.core.RepositoryImpl.<init>(*RepositoryImpl.java:36
6
> *)
> 
> at
org.apache.jackrabbit.core.RepositoryImpl.create(*RepositoryImpl.java:67
3
> *)
> 
> at org.apache.jackrabbit.core.TransientRepository$2.getRepository(*
> TransientRepository.java:231*)
> 
> at org.apache.jackrabbit.core.TransientRepository.startRepository(*
> TransientRepository.java:259*)
> 
> at org.apache.jackrabbit.core.TransientRepository.login(*
> TransientRepository.java:355*)
> 
> at org.apache.jackrabbit.commons.AbstractRepository.login(*
> AbstractRepository.java:123*)
> 
> at FirstHop.main(*FirstHop.java:20*)
> 
> *APPLICATION CODE:*
> 
> 
> 
> *import* javax.jcr.Repository;
> 
> *import* javax.jcr.Session;
> 
> *import* javax.jcr.SimpleCredentials;
> 
> *import* javax.jcr.Node;
> 
> *import* org.apache.jackrabbit.core.TransientRepository;
> 
> /**
> 
> * Second hop example. Stores, retrieves, and removes example content.
> 
> */
> 
> *public* *class* SecondHop {
> 
> *public* *static* *void* main(String[] args) *throws* Exception {
> 
> Repository repository = *new* TransientRepository();
> 
> Session session = repository.login(*new* SimpleCredentials("username",
> "password".toCharArray()));
> 
> *try* {
> 
> Node root = session.getRootNode();
> 
> // Store content
> 
> Node hello = root.addNode("hello");
> 
> Node world = hello.addNode("world");
> 
> world.setProperty("message", "Hello, World!");
> 
> session.save();
> 
> // Retrieve content
> 
> Node node = root.getNode("hello/world");
> 
> System.*out*.println(node.getPath());
> 
> System.*out*.println(node.getProperty("message").getString());
> 
> // Remove content
> 
> root.getNode("hello").remove();
> 
> session.save();
> 
> String name =
repository.getDescriptor(Repository.*REP_VENDOR_URL_DESC*);
> 
> System.*out*.println("name "+name);
> 
> } *finally* {
> 
> session.logout();
> 
> }
> 
> }
> 
> }
> 
> 
> 
> Thanks,
> 
> Jenni
> 


--------------------------------------------------------------------------------------------

This message, including any attachments, contains confidential information 
intended for a specific individual and purpose, and is intended for the addressee only. Any unauthorized disclosure, use, dissemination, copying, or distribution of 
this message or any of its attachments or the information contained in this e-mail, or the taking of any action based on it, is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return e-mail and delete this message.

--------------------------------------------------------------------------------------------

Re: Getting noSuchMethodError in jackrabbit session.login() method

Posted by Justin Edelson <ju...@gmail.com>.
Where'd you derive that list of JAR files from? AFAIK, Jackrabbit
depends upon lucene-core-2.4.1, not 3.0.1. Also, you should be using the
JCR 2.0 JAR (although this wouldn't be the cause of this exception).

Justin

On 5/4/10 9:22 AM, Jenni P wrote:
> Hi All,
> 
>     I am getting NoSuchMethodError at Session session = repository.login(*
> new* SimpleCredentials("username", "password".toCharArray())); when running
> my below application. I have added below jar files to my application.Below
> is the sample application downloaded from the location
> http://jackrabbit.apache.org/first-hops.html
> 
> I am new to the Jackrabbit. Please guide me to run the application
> successfully.
> 
> Thanks in advance.
> 
> 
> 
> *JAR FILES ADDED TO APPLICATION*:
> jackrabbit-jcr-commons-2.0.0.jar,jackrabbit-api-2.0.0.jar,
> jackrabbit-core-2.0.0.jar, jackrabbit-jca-2.0.0.jar, jcr-1.0.jar,
> lucene-core-3.0.1.jar.
> 
> 
> 
> *ERROR* :
> 
> Exception in thread "main" java.lang.NoSuchMethodError:
> org.apache.lucene.analysis.standard.StandardAnalyzer.<init>([Ljava/lang/String;)V
> 
> at org.apache.jackrabbit.core.query.lucene.JackrabbitAnalyzer.<init>(*
> JackrabbitAnalyzer.java:41*)
> 
> at org.apache.jackrabbit.core.query.lucene.SearchIndex.<init>(*
> SearchIndex.java:205*)
> 
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(*Native Method*)
> 
> at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
> 
> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
> 
> at java.lang.reflect.Constructor.newInstance(Unknown Source)
> 
> at java.lang.Class.newInstance0(Unknown Source)
> 
> at java.lang.Class.newInstance(Unknown Source)
> 
> at org.apache.jackrabbit.core.config.BeanConfig.newInstance(*
> BeanConfig.java:186*)
> 
> at
> org.apache.jackrabbit.core.config.RepositoryConfigurationParser$1.getQueryHandler(
> *RepositoryConfigurationParser.java:627*)
> 
> at org.apache.jackrabbit.core.config.RepositoryConfig.getQueryHandler(*
> RepositoryConfig.java:930*)
> 
> at org.apache.jackrabbit.core.SearchManager.<init>(*SearchManager.java:173*)
> 
> at org.apache.jackrabbit.core.RepositoryImpl.getSystemSearchManager(*
> RepositoryImpl.java:698*)
> 
> at org.apache.jackrabbit.core.RepositoryImpl.access$400(*
> RepositoryImpl.java:125*)
> 
> at org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.getSearchManager(
> *RepositoryImpl.java:1868*)
> 
> at org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.doPostInitialize(
> *RepositoryImpl.java:2077*)
> 
> at org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.initialize(*
> RepositoryImpl.java:1996*)
> 
> at org.apache.jackrabbit.core.RepositoryImpl.initStartupWorkspaces(*
> RepositoryImpl.java:535*)
> 
> at org.apache.jackrabbit.core.RepositoryImpl.<init>(*RepositoryImpl.java:366
> *)
> 
> at org.apache.jackrabbit.core.RepositoryImpl.create(*RepositoryImpl.java:673
> *)
> 
> at org.apache.jackrabbit.core.TransientRepository$2.getRepository(*
> TransientRepository.java:231*)
> 
> at org.apache.jackrabbit.core.TransientRepository.startRepository(*
> TransientRepository.java:259*)
> 
> at org.apache.jackrabbit.core.TransientRepository.login(*
> TransientRepository.java:355*)
> 
> at org.apache.jackrabbit.commons.AbstractRepository.login(*
> AbstractRepository.java:123*)
> 
> at FirstHop.main(*FirstHop.java:20*)
> 
> *APPLICATION CODE:*
> 
> 
> 
> *import* javax.jcr.Repository;
> 
> *import* javax.jcr.Session;
> 
> *import* javax.jcr.SimpleCredentials;
> 
> *import* javax.jcr.Node;
> 
> *import* org.apache.jackrabbit.core.TransientRepository;
> 
> /**
> 
> * Second hop example. Stores, retrieves, and removes example content.
> 
> */
> 
> *public* *class* SecondHop {
> 
> *public* *static* *void* main(String[] args) *throws* Exception {
> 
> Repository repository = *new* TransientRepository();
> 
> Session session = repository.login(*new* SimpleCredentials("username",
> "password".toCharArray()));
> 
> *try* {
> 
> Node root = session.getRootNode();
> 
> // Store content
> 
> Node hello = root.addNode("hello");
> 
> Node world = hello.addNode("world");
> 
> world.setProperty("message", "Hello, World!");
> 
> session.save();
> 
> // Retrieve content
> 
> Node node = root.getNode("hello/world");
> 
> System.*out*.println(node.getPath());
> 
> System.*out*.println(node.getProperty("message").getString());
> 
> // Remove content
> 
> root.getNode("hello").remove();
> 
> session.save();
> 
> String name = repository.getDescriptor(Repository.*REP_VENDOR_URL_DESC*);
> 
> System.*out*.println("name "+name);
> 
> } *finally* {
> 
> session.logout();
> 
> }
> 
> }
> 
> }
> 
> 
> 
> Thanks,
> 
> Jenni
>