Hi all,

I am trying a java program to insert an item into DSpace but i am getting
the below exceptions:

*java program:*
*

public
**class* Test {

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

Context context;

*try*{

Connection conn=DatabaseManager.*getConnection*();

context=
*new* Context();

Community community=Community.*create*(
*null*, context);

community.setMetadata(
"Description", "This is a test Community" );

community.update();

Collection collection=community.createCollection();

collection.setMetadata(
"DspaceCollection", "This is test Collection" );

collection.update();

File f=
*new* File("c:/example-insert2.xml" );

InputStream is=
*new* FileInputStream(f);

WorkspaceItem wsi=WorkspaceItem.*create*(context,collection,
*false* );

Item item=wsi.getItem();

item.createSingleBitstream(is);

System.
*out*.println("SUCCESS" );

}

*catch*(Exception e){e.printStackTrace();}

 }

}

*log4j:WARN No appenders could be found for logger (
org.dspace.storage.rdbms.DatabaseManager).*

*log4j:WARN Please initialize the log4j system properly.*
*

java.sql.SQLException
**: java.lang.NullPointerException*

*at org.dspace.storage.rdbms.DatabaseManager.initialize(*
*DatabaseManager.java:1694**)*

*at org.dspace.storage.rdbms.DatabaseManager.getConnection(*
*DatabaseManager.java:715**)*

*at Test.main(*
*Test.java:19)*

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

--> I have properly installed DSpace and Postgres database on windowsXP..i
could able to insert items through the DSpase
UserInterface(http:\\localhost:8080\dspace)

can u guys plz help me how to insert items from a java program ...

Krishna
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
DSpace-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspace-tech

Reply via email to