Java Install,  Cannot insert a key value pair into the secure store fails,

Dear All,
I'm doing Java Intallaion in BI7 on CI and in the midle of installtions we encounter,
TRACE      [iaxxejsexp.cpp:199]
           EJS_Installer::writeTraceToLogBook()
NWException thrown: nw.secureStore.cannotInsertIntoSecureStore:
Cannot insert a key value pair into the secure store fails; see output of log file SecureStoreInsert.log:
SAP Secure Store in the File System - Copyright (c) 2003 SAP AG
A key/value pair with this key already exists in the store..
ERROR      2008-04-23 11:36:21
           CJSlibModule::writeError_impl()
CJS-30051  Cannot insert a key value pair into the secure store fails; see output of log file SecureStoreInsert.log:
SAP Secure Store in the File System - Copyright (c) 2003 SAP AG
A key/value pair with this key already exists in the store..
TRACE      [iaxxejsbas.hpp:460]
           EJS_Base::dispatchFunctionCall()
JS Callback has thrown unknown exception. Rethrowing.
ERROR      2008-04-23 11:36:21 [iaxxgenimp.cpp:731]
           showDialog()
FCO-00011  The step insertAdminDataInSecStore with step key |NW_Addin_CI|ind|ind|ind|ind|0|0|NW_CI_Instance|ind|ind|ind|ind|8|0|NW_CI_Instance_Configure_Java|ind|ind|ind|ind|4|0|insertAdminDataInSecStore was executed with status ERROR .
TRACE      [iaxxgenimp.cpp:719]
           showDialog()
There's any want in here can help us Please,
Thanks and Best Regards,
Chrisna

The clean way to Uninstall JAVA is through SAPINST. 
Make user you drop only the JAVA Schema ID (SAPSR3DB)
If you want to uninstall manually, follow as mentioned below :
1. Stop the central services instance and all dialog instances of your SAP system:
a) Log on to the corresponding instance host as user <sapsid>adm.
b) Execute the following commands:
   To stop the central services instance:
             stopsap r3 <SCSinstanceName>
   To stop a dialog instance:
            stopsap r3 <DialogInstanceName>
2. Stop the J2EE Engine of the central instance:
a) Log on to your SAP system.
b) Call transaction SMICM.
c) Choose Administration J2EE Instance (local) Send Hard Shutdown
2. Drop the J2EE DB schema (the db schema for this one SAP SID) BE VERY CAREFUL, do not drop the DB schema for another existing system or
the ABAP schema.
a. Log on as user ora<dbsid>.
b. Start sqlplus and connect to the database. Enter:
sqlplus /nolog
c. SQLPLUS>connect / as sysdba
d. Enter the following command to delete the database objects of the database schema:
SQLPLUS> drop user SAP<SCHEMA_ID>DB cascade;
e. Enter the following command to get the file name of the corresponding data file in the file system:
SQLPLUS> select file_name from dba_data_files where \
tablespace_name = ’PSAP<SCHEMA_ID>DB’;
f. Enter the following command to delete the tablespace of the database schema:
SQLPLUS> drop tablespace PSAP<SCHEMA_ID>DB including contents;
g. Exit sqlplus:
SQLPLUS> exit
3. Remove folder "data" at: /sapmnt/QO1/global/security/data
4. Remove folder "SDM" at: /usr/sap/<sid>/<Central instance>/SDM
5. Remove folder "j2ee" at:  /usr/sap/<sid>/<Central instance>/j2ee
6. Revert CI instance profile to their original state (backup copies should exist) # they should be in the state before the start of the JavaAdd In
7. If lines beginning with the following parameters appear, delete these lines from the default profile, /usr/sap/<SAPSID>/SYS/profile/DEFAULT.PFL:
j2ee/dbname =
j2ee/dbtype =
j2ee/dbhost =
j2ee/dbadminurl =
j2ee/scs/host =
j2ee/scs/system =
j2ee/ms/port =
8. If lines beginning with the following parameters appear, delete these lines from the central instance pro?le and from all dialog instance pro?les,
/usr/sap/<SAPSID>/SYS/profile/<SAPSID>_<INSTANCE_NAME>_<host_name>:
exe/j2ee =
exe/jlaunch =
rdisp/j2ee_start_control =
rdisp/j2ee_start =
rdisp/j2ee_timeout =
rdisp/j2ee_libpath =
rdisp/frfc_fallback =
jstartup/trimming_properties =
jstartup/instance_properties =
jstartup/protocol =
jstartup/vm/home =
jstartup/max_caches =
jstartup/release =
j2ee/dbdriver =
9. Delete the central services instance
10. Restart ABAP and Install JAVA Add-in
Edited by: Shaji Jacob on Apr 27, 2008 11:46 AM

Similar Messages

  • Cannot insert a key value pair into the secure store fails; see output of l

    Hi,
    how can I fix this problem ?
    SAPNW2004sJavaSP9_Trial\SAP_NetWeaver_2004s_SR_1
    jdkversion 142_09 .
    ERROR 2008-07-10 13:13:31
    CJS-30051  Cannot insert a key value pair into the secure store fails; see output of log file SecureStoreInsert.log: SAP Secure Store in the File System - Copyright (c) 2003 SAP AG
    Regds
    sas

    Hi Arzu,
    thank you for your replying.
    The current OS I am using is Microsoft Windows XP
    Service Pack 2.
    The very last installation was made with JDK version 142_12.
    However it was pointless. I can try to reinstall with
    the mentioned newest JCE policy files .
    Can tell me from where I can obtain these above
    JCE policy files ?
    Regards
    Erdem Sas

  • Is it possible to load 1 billion key-value pairs into BerkeleyDB database?

    Hello,
    I experiment with loading huge datasets into BerkeleyDB database. The procedure is as follows:
    1. Generate a dump-like file using a script. The file contains key-value pairs (on separate lines, exactly in the format of the dump file, that can be produced by db_dump). The index is hash.
    2. Use db_load to create a database. The OS is windows server 2003.
    Both key and values are 64-bit longs.
    Using this procedure, I succeeded to load 25 million pairs in the database. It took about 1-2 hours.
    Next, I tried to load 250 million pairs into an empty database. db_loader runs already 15 hours. It's memory consumption is very low: private bytes ~2M, working set ~2M, virtual size ~13M. db_loader already read all the pairs from disk, as IO is very low now: ~4M per second. I am not sure if db_loader will finish in next 24h hours.
    My goal is to load eventually 3 billion key-value pairs into one DB.
    I will appreciate if someone will advise me:
    1. If BerkeleyDB is capable of dealing with such database volume.
    2. Is my procedure good, how to optimize it. Is it possible to allocate more RAM to db_load? Are there other ways to optimize loading time?
    Thank you,
    Gregory.

    Hello Sandra,
    The version is: Berkeley DB 5.0.21: (March 30, 2010).
    The data: keys and values are random 64 bit numbers.
    The header of the "dump" file that I am trying to load is (there are 256 * 1e6 key-value pairs in the file):
    VERSION=3
    format=bytevalue
    type=hash
    h_nelem=512000000
    db_pagesize=8192
    HEADER=END
    The db_load allocates 1G memory cache.
    Thank you,
    Gregory.

  • Store XML data in java cache (hashmap as a key value pair)

    Hi,
    I have to store a xml file in java cache so that I can resue it .The flow is like this :
    DAO layer reads database ,create an xml and sends to --> IBM MQ-->our java code should read this xml file over MQ and store it in a cache (preferably hashmap).The file contain unique id for every customer.
    How can we achieve this.One way is to store the xml as an string as key is "id" and value is whole xml.Is this a good way or any other way is available.Please suggest.
    Sample xml:
    <Client>
    <ClientId>1234</ClientId>
    <ClientName>STechnology</ClientName>
    <ID>10</ID>
    <ClientStatus>ACTIVE</ClientStatus>
    - <LEAccount>
    <ClientLE>678989</ClientLE>
    <LEId>56743</LEId>
    - <Account>
    <AccountNumber>9876543678</AccountNumber>
    </Account>
    </LEAccount>
    - <Service>
    <Cindicator>Y2Y</Cindicator>
    <PrefCode>980</PrefCode>
    <BSCode>876</BSCode>
    <MandatoryContent>MSP</MandatoryContent>
    </Service>
    </Client>
    Thanks
    Sumit

    A HashMap can work, but then still store the customer related data in a bean (and perhaps it will have some child objects as well, if for example the service subelement can repeat). So you get a HashMap of Customer objects, with the clientID as the index into the hashmap.

  • A key/value pair with this key already exists in the store

    Hi all,
    In the installation of PI components on the AS ABAP+ AS JAVA with finalization of the Java Addin the iam facing this problem :
    In short it mentioning that the " A key/value pair with this key already exists in the store.", Please see below for more information....:
    CJSlibModule::writeWarning_impl()
    Execution of the command "/opt/java1.4/bin/java -classpath
    /oracle/stage/PIDtemp/sapinst_instdir/NW04S/LM/AS-JAVA/ADDIN/ORA/CENTRAL/CI/install/sharedli
    b/launcher.jar -Xmx256m -d64 com.sap.engine.offline.OfflineToolStart
    com.sap.security.core.server.secstorefs.SecStoreFS
    /usr/sap/PID/SYS/global/security/lib/tools/iaik_jce.jar:/usr/sap/PID/SYS/global/security/lib
    /tools/iaik_jsse.jar:/usr/sap/PID/SYS/global/security/lib/tools/iaik_smime.jar:/usr/sap/PID/
    SYS/global/security/lib/tools/iaik_ssl.jar:/usr/sap/PID/SYS/global/security/lib/tools/w3c_ht
    tp.jar:/oracle/stage/PIDtemp/sapinst_instdir/NW04S/LM/AS-JAVA/ADDIN/ORA/CENTRAL/CI/install/l
    ib:/oracle/stage/PIDtemp/sapinst_instdir/NW04S/LM/AS-JAVA/ADDIN/ORA/CENTRAL/CI/install/share
    dlib:/oracle/client/10x_64/instantclient/ojdbc14.jar insert -s PID -f
    /usr/sap/PID/SYS/global/security/data/SecStore.properties -k
    /usr/sap/PID/SYS/global/security/data/SecStore.key admin/host/PID tern" finished with return
    code 2. Output:
    SAP Secure Store in the File System - Copyright (c) 2003 SAP AG
    A key/value pair with this key already exists in the store.
    ERROR      2007-02-15 18:35:29
               CJSlibModule::writeError_impl()
    CJS-30051  Cannot insert a key value pair into the secure store fails; see output of log
    file SecureStoreInsert.log:
    SAP Secure Store in the File System - Copyright (c) 2003 SAP AG
    A key/value pair with this key already exists in the store..
    ERROR      2007-02-15 18:35:29 [iaxxgenimp.cpp:731]
               showDialog()
    FCO-00011  The step insertAdminDataInSecStore with step key
    |NW_Addin_CI|ind|ind|ind|ind|0|0|NW_CI_Instance|ind|ind|ind|ind|8|0|NW_CI_Instance_Configure
    _Java|ind|ind|ind|ind|4|0|insertAdminDataInSecStore was executed with status ERROR

    Hi Kamalakar
    I think this problem happens due to wrong content of SDMKIT.JAR - incorrect crypto SDA is deployed.I dont know the installation procedure you followed because normally this error wont come.
    I would rather suggest a work around seeing your problem
    <b>Edit the keydb.xml exchanging [ERROR] with [OK]</b>
    Follow the above step and restart your installation.
    Do not forget to reward points:

  • Key value pair error

    Hello
    how can I fix this problem ?
    SAPNW2004sJavaSP9_Trial\SAP_NetWeaver_2004s_SR_1
    jdkversion 142_09 .
    ERROR 2008-07-09 23:56:30
    CJS-30051  Cannot insert a key value pair into the secure store fails; see output of log file SecureStoreInsert.log: SAP Secure Store in the File System - Copyright (c) 2003 SAP AG
    ERROR 2008-07-09 23:56:30
    FCO-00011  The step insertAdminDataInSecStore with step key |NW_Java_OneHost|ind|ind|ind|ind|0|0|NW_Onehost_System|ind|ind|ind|ind|1|0|NW_CI_Instance|ind|ind|ind|ind|11|0|NW_CI_Instance_Configure_Java|ind|ind|ind|ind|3|0|insertAdminDataInSecStore was executed with status ERROR .
    Thanks
    sas

    Hi this the content of  SecureStoreInsert .
    com.sap.security.core.server.secstorefs.NoEncryptionException: Encryption or decryption is not possible because the full version of the SAP Java Crypto Toolkit was not found (iaik_jce.jar is required, iaik_jce_export.jar is not sufficient) or the JCE Jurisdiction Policy Files don't allow the use of the "PbeWithSHAAnd3_KeyTripleDES_CBC" algorithm.
    at com.sap.security.core.server.secstorefs.SecStoreFS.openExistingStore(SecStoreFS.java:1975)
    at com.sap.security.core.server.secstorefs.SecStoreFS.handleInsert(SecStoreFS.java:963)
    at com.sap.security.core.server.secstorefs.SecStoreFS.main(SecStoreFS.java:1276)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at com.sap.engine.offline.OfflineToolStart.main(OfflineToolStart.java:81)
    Caused by: java.lang.SecurityException: The provider IAIK may not be signed by a trusted party
    at javax.crypto.SunJCE_b.a(DashoA12275)
    at javax.crypto.Cipher.a(DashoA12275)
    at javax.crypto.Cipher.getInstance(DashoA12275)
    at com.sap.security.core.server.secstorefs.Crypt.<init>(Crypt.java:220)
    at com.sap.security.core.server.secstorefs.SecStoreFS.<init>(SecStoreFS.java:1346)
    at com.sap.security.core.server.secstorefs.SecStoreFS.handleInsert(SecStoreFS.java:954)
    ... 6 more

  • *** [23000][2627][Microsoft][SQL Server Native Client 11.0][SQL Server]Violation of UNIQUE KEY constraint 'ClientPushMachine_G_AK'. Cannot insert duplicate key in object 'dbo.ClientPushMachine_G'. The duplicate key value is (16777412). : sp_CP_CheckNewAss

    *** [23000][2627][Microsoft][SQL Server Native Client 11.0][SQL Server]Violation of UNIQUE KEY constraint 'ClientPushMachine_G_AK'. Cannot insert duplicate key in object 'dbo.ClientPushMachine_G'. The duplicate key value is (16777412). : sp_CP_CheckNewAssignedMachine
    CCCRT::RunSQLStoredProc - Failed to execute SQL cmd exec [sp_CP_CheckNewAssignedMachine] N'xxx', 1
    CCRQueueRequest::GetRequestFromQueue - Failed to execute SQL cmd sp_CP_CheckNewAssignedMachine
    I get the above issue and the one below at a client site; the error started with the error below then changed to the one reported above and back to the one below. Everything is working as it should but the issues
    started when one of the admins at the data-centre incorrectly applied a gpo which affected a number of service accounts (sccm inclusive) and they expired....hence reporting in sccm got broke as well as this error in the ccm.log file appeared.
    Remote client install still works but I believe this error affects new client discovered by sccm, so in other words devices discovered by sccm do not get the client installed automatically....but if all access and permissions are in place...pushing out the
    client to the new discovered system works, it just not done automatically, which kinda defeats one the reasons for using sccm.
    I have searched the breadth of the tinternet and I can only find two technet reference to the same error  - one says to edit the stored procedure on the sql server which I don't think should be done... Like Jason said and I concur....its bad joo joos.
    The second suggestion, said you should select all the options in the Client Push Installation properties, I have tried this but hasn't solved the problem.
    I am planning to upgrade the site to the R2 CU3 before the end of the year but I would like to resolve this error before the upgrade.
    The site is currently sccm 2012 sp1 
    Any idea?> Resolution? sil vous plait!
    Merci

    Hi ,
    Please back up the database of the SCCM site. Then run the following query against the Site DB and see how it goes.
    DELETE FROM System_SMS_Resident_ARR
    WHERE ItemKey IN (
    SELECT ItemKey FROM vSystem_SMS_Resident_ARR
    GROUP BY ItemKey
    HAVING COUNT(ItemKey) > 1
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

  • Msg 2601, Level 14, State 1, Procedure sp_flush_commit_table, Line 15 Cannot insert duplicate key row in object 'sys.syscommittab' with unique index 'si_xdes_id'. The duplicate key value is (2238926153). The statement has been terminated.

    I am using SQL server 2008 R1 SP3. And when we are doing back up operations we are facing the below error
    Msg 2601, Level 14, State 1, Procedure sp_flush_commit_table, Line 15
    Cannot insert duplicate key row in object 'sys.syscommittab' with unique index 'si_xdes_id'. The
    duplicate key value is (2238926153).
    The statement has been terminated.
    Please assist me with your inputs.
    Thanks,
    Rakesh.

    Hello,
    Did you enable change tracking on the database? If so, please try to disable and re-enable the change tracking.
    The following thread is about the similar issue, please refer to:
    http://social.msdn.microsoft.com/forums/sqlserver/en-US/c2294c73-4fdf-46e9-be97-8fade702e331/backup-fails-after-installing-sql2012-sp1-cu1-build-3321
    Regards,
    Fanny Liu
    Fanny Liu
    TechNet Community Support

  • [SQL Server]Violation of PRIMARY KEY constraint 'DeploymentSummary_PK'. Cannot insert duplicate key in object 'dbo.DeploymentSummary'. The duplicate key value is

    I have migrated my SCCm 2007 environment to SCCM 2012 SP1 CU4.
    I noticed in the System Status\Component Status\SMS_STATE_SYSTEM a lot of errors like the one below:
    Microsoft SQL Server reported SQL message 2627, severity 14: [23000][2627][Microsoft][SQL Server Native Client 11.0][SQL Server]Violation of PRIMARY KEY constraint 'DeploymentSummary_PK'. Cannot insert duplicate key in object 'dbo.DeploymentSummary'. The duplicate key value is (1, 0, S0220438, 0). : spUpdateClassi
    Please refer to your Configuration Manager documentation, SQL Server documentation, or the Microsoft Knowledge Base for further troubleshooting information.
    When looking up the deployment ID and recreate the Deployment the problem is solved. But I have 700 packages and don't want to manually do this action on all packages. I think it is related to the migration i did and something went wrong there :-(
    Besides it will retriggers the deployment to the clients which is also not preferred.
    Is there another way to solve this by e.e.g do something directly in the SQL database tables ?

    Hi,
    It is not supported by Microsoft that do something directly in SQL database.
    If you want to do that, you could make a call to CSS.
    Best Regards,
    Joyce
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • SSIS - "Violation of PRIMARY KEY constraint. Cannot insert duplicate key in object ' tablename '. The duplicate key value is 1234 . Though there are no duplicate records.

    Hi,
    I am providing support to one of our clients, where we have jobs scheduled to load the data from the tables in the source database to the destination database via SSIS packages. The first time load is a full load where we truncate all the tables in the destination
    and load them from the source tables. But from the next day, we perform the incremental load from source to destination, i.e., only modified records fetched using changed tracking concept will be loaded to the destination. After full load, if we run the incremental
    load, the job is failing with the error on one of the packages "Violation of PRIMARY KEY constraint. Cannot insert duplicate key in object '<tablename>'. The duplicate key value is <1234>, even though there are no duplicate records. When we
    try debugging and running the failing package, it runs successfully. We are not able to figure out why the package fails and when we run the next day it runs successfully. Request you to help me in this regard.
    Thank you,
    Bala Murali Krishna Medipally.

    Hi,
    I am providing support to one of our clients, where we have jobs scheduled to load the data from the tables in the source database to the destination database via SSIS packages. The first time load is a full load where we truncate all the tables in the destination
    and load them from the source tables. But from the next day, we perform the incremental load from source to destination, i.e., only modified records fetched using changed tracking concept will be loaded to the destination. After full load, if we run the incremental
    load, the job is failing with the error on one of the packages "Violation of PRIMARY KEY constraint. Cannot insert duplicate key in object '<tablename>'. The duplicate key value is <1234>, even though there are no duplicate records. When we
    try debugging and running the failing package, it runs successfully. We are not able to figure out why the package fails and when we run the next day it runs successfully. Request you to help me in this regard.
    Thank you,
    Bala Murali Krishna Medipally.
    I suspect you are trying to insert modified records instead of updating.

  • Violation of PRIMARY KEY constraint 'PK_test'. Cannot insert duplicate key in object 'dbo.test'. The duplicate key value is (12610). (Source: MSSQLServer, Error number: 2627) ?

    Hi team,
    How resolve the below error 
    Violation of PRIMARY KEY constraint 'PK_test'. Cannot insert duplicate key in object 'dbo.test'. The duplicate key value is (12610). (Source: MSSQLServer, Error number: 2627) ?
    Thanks,
    Ram
    RAM

    Hi team,
    How resolve the below error 
    Violation of PRIMARY KEY constraint 'PK_test'. Cannot insert duplicate key in object 'dbo.test'. The duplicate key value is (12610). (Source: MSSQLServer, Error number: 2627) ?
    Thanks,
    Ram
    RAM
    There can be two reasons
    1. The insert script used is having multiple instances of the records with Key as 12610 returned from the source query. If this is the issue add a logic to include only the unique set of id values for records by avoiding duplicates. There are several approaches
    for this like using ROW_NUMBER with PARTITION BY, using a join with derived table etc
    2. The record with Key 12610 already exist in your destination table and your script is again trying to insert another instances of record with same key. This can be avoided by adding a NOT EXISTS condition with a subquery which will check and return only
    those records which doesnt already exist in the source
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Cannot insert duplicate key row in object

    This is a JPA question. The tbHardware table has a PK identity column and a unique non-clustered index on CoxBarcode column.
    I have a SFSB in a Seam2.0.0.GA app running on JBoss 4.2.1.GA. I am using flushMode=FlushModeType.MANUAL (Seam specific when beginning a conversation) and that's why you see the flush() reference at the end of the following code snippet.
    Query query = entityManager.createNativeQuery("INSERT INTO tbHardware "+
                                                 "VALUES (:coxBarCode, :serialNo, :currentStatus, :currentLocationNo, "+
                                                 ":desc, :hardwareModelId, :ownerTypeCode, :firstEnteredDate, :enteredByUser, :lastAuditDate, :hardwarePrice, null)")
                                              .setParameter("coxBarCode", coxBarcode)
                                              .setParameter("serialNo", serialNo)
                                              .setParameter("currentStatus", curstatus)
                                              .setParameter("currentLocationNo", curloc)
                                              .setParameter("desc", desc)
                                              .setParameter("hardwareModelId", selmodid)
                                              .setParameter("ownerTypeCode", selectedOwner)
                                              .setParameter("firstEnteredDate", firstEnteredDate)
                                              .setParameter("enteredByUser", enteredByUser)
                                              .setParameter("lastAuditDate", lastAuditedDate)
                                              .setParameter("hardwarePrice", unitPrice);
                             query.executeUpdate();
                             query = entityManager.createNativeQuery("INSERT INTO TbHardwareHistory "+
                                            "VALUES (:hardwareId, :currentStatus, :currentLocationNo, :firstEnteredDate, null, :enteredByUser, :ownerTypeCode)")
                                             .setParameter("hardwareId", findHardwareId(coxBarcode))                                        
                                             .setParameter("currentStatus", curstatus)
                                             .setParameter("currentLocationNo", curloc)          
                                             .setParameter("firstEnteredDate", firstEnteredDate)
                                             .setParameter("enteredByUser", enteredByUser)
                                             .setParameter("ownerTypeCode", selectedOwner);
                             query.executeUpdate();
                             //TO DO: following query should return only one entity, need to refactor and remove the for loop below
                             TbHardware hw = (TbHardware)entityManager.createNativeQuery("SELECT t FROM tbHardware t WHERE t.coxBarCode = :coxBarCode AND t.serialNo = :serialNo", TbHardware.class)
                                                                                    .setParameter("coxBarCode", coxBarcode)
                                                                                    .setParameter("serialNo", serialNo)
                                                                                    .getSingleResult();
                             Integer hardwareId = hw.getHardwareId();
                             query = entityManager.createNativeQuery("INSERT INTO tbHardwareNote VALUES (:hardwareId, :hardwareNote)")
                                                   .setParameter("hardwareId", hardwareId).setParameter("hardwareNote", hardwareNote);
                             query.executeUpdate();
                             entityManager.flush();I am getting the following in the server.log:
    10:10:57,552 ERROR [STDERR] Caused by: org.hibernate.exception.SQLGrammarException: could not execute native bulk manipulation query
    10:10:57,552 ERROR [STDERR]      at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
    10:10:57,552 ERROR [STDERR]      at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
    10:10:57,552 ERROR [STDERR]      at org.hibernate.engine.query.NativeSQLQueryPlan.performExecuteUpdate(NativeSQLQueryPlan.java:174)
    10:10:57,552 ERROR [STDERR]      at org.hibernate.impl.SessionImpl.executeNativeUpdate(SessionImpl.java:1163)
    10:10:57,552 ERROR [STDERR]      at org.hibernate.impl.SQLQueryImpl.executeUpdate(SQLQueryImpl.java:334)
    10:10:57,552 ERROR [STDERR]      at org.hibernate.ejb.QueryImpl.executeUpdate(QueryImpl.java:48)
    10:10:57,552 ERROR [STDERR]      ... 138 more
    10:10:57,552 ERROR [STDERR] Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Cannot insert duplicate key row in object 'dbo.tbHardware' with unique index 'IX_tbHardwar_coxBarCode_UNIQUE'.
    10:10:57,552 ERROR [STDERR]      at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown Source)
    10:10:57,552 ERROR [STDERR]      at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(Unknown Source)
    10:10:57,552 ERROR [STDERR]      at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(Unknown Source)
    10:10:57,552 ERROR [STDERR]      at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(Unknown Source)
    10:10:57,552 ERROR [STDERR]      at com.microsoft.sqlserver.jdbc.TDSCommand.execute(Unknown Source)
    10:10:57,552 ERROR [STDERR]      at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(Unknown Source)
    10:10:57,552 ERROR [STDERR]      at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(Unknown Source)
    10:10:57,552 ERROR [STDERR]      at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(Unknown Source)
    10:10:57,552 ERROR [STDERR]      at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(Unknown Source)
    10:10:57,552 ERROR [STDERR]      at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:251)
    10:10:57,552 ERROR [STDERR]      at org.hibernate.engine.query.NativeSQLQueryPlan.performExecuteUpdate(NativeSQLQueryPlan.java:165)
    10:10:57,552 ERROR [STDERR]      ... 141 moreHow should I handle this SQLServerException? What is the best practice regarding this from a JPA perspective? I thought about executing a select query prior to the insert in tbHardware to check to see if a record with that particular coxBarCode exists or not. Would the exception be handled differently if I used the persist() method instead of the createNativeQuery() and executeUpdate() combination? thx.
    Edited by: asookazian on May 7, 2008 11:07 AM

    kajbj wrote:
    What do you mean by control? Yes, you can find duplicates and remove them (by e.g. implementing a Comparator and adding them to a Set)
    KajI mean to say replace the duplication with just a single value for insert!
    Any psuedo for the comparactor suggested?

  • Cannot insert duplicate key row in object 'dbo.NavNodes' with unique index 'NavNodes_PK' when trying to update quick launch menu sharepoint 2013

    When we try to deploy a wsp to sharepoint containing code to generate quick launch menu we get the following error messages when running the last enable-spfeature command in powershell. The same code is working in the development environment, but when we
    deploy to a test server the following error occurs:
    Add-SPSolution "C:\temp\ImpactSharePoint.wsp"
    Install-SPSolution -Identity impactsharepoint.wsp  -GACDeployment
    Enable-SPFeature impactsharepoint_branding -url http://im-sp1/sites/impact/
    Enable-SPFeature impactsharepoint_pages -url http://im-sp1/sites/impact/
    From UlsViewer.exe:
    03.12.2014 15:21:25.45 PowerShell.exe (0x1620)
    0x11F4 SharePoint Foundation
    Database 880i
    High System.Data.SqlClient.SqlException (0x80131904): Cannot insert duplicate key row in object 'dbo.NavNodes' with unique index 'NavNodes_PK'. The duplicate key value is (6323df8a-5c57-4d3e-a477-09aa8b66100a, 7ae114df-9d52-4b08-affa-8c544cbc27b6,
    1000).  The statement has been terminated.     at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)     at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject
    stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)     at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj,
    Boolean& dataReady)     at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()     at System.Data.SqlClient.SqlDataReader.get_MetaData()     at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior
    runBehavior, String resetOptionsString)     at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite)  
      at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite)     at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior
    cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)     at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)     at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior
    behavior)     at Microsoft.SharePoint.Utilities.SqlSession.ExecuteReader(SqlCommand command, CommandBehavior behavior, SqlQueryData monitoringData, Boolean retryForDeadLock)  ClientConnectionId:2bb4004c-aa75-470e-b11e-dbf1c476aaed
    5b7e05f7-49df-42ca-b7c9-8ae5b06b464f
    03.12.2014 15:21:25.45 PowerShell.exe (0x1620)
    0x11F4 SharePoint Foundation
    Database 880k
    High at Microsoft.SharePoint.SPSqlClient.ExecuteQueryInternal(Boolean retryfordeadlock)     at Microsoft.SharePoint.SPSqlClient.ExecuteQuery(Boolean retryfordeadlock)     at Microsoft.SharePoint.Library.SPRequestInternalClass.AddNavigationNode(String
    bstrUrl, String bstrName, String bstrNameResource, String bstrNodeUrl, Int32 lType, Int32 lParentId, Int32 lPreviousSiblingId, Boolean bAddToQuickLaunch, Boolean bAddToSearchNav, String& pbstrDateModified)     at Microsoft.SharePoint.Library.SPRequestInternalClass.AddNavigationNode(String
    bstrUrl, String bstrName, String bstrNameResource, String bstrNodeUrl, Int32 lType, Int32 lParentId, Int32 lPreviousSiblingId, Boolean bAddToQuickLaunch, Boolean bAddToSearchNav, String& pbstrDateModified)     at Microsoft.SharePoint.Library.SPRequest.AddNavigationNode(String
    bstrUrl, String bstrName, String bstrNameResource, String bstrNodeUrl, Int32 lType, Int32 lParentId, Int32 lPreviousSiblingId, Boolean bAddToQuickLaunch, Boolean bAddToSearchNav, String& pbstrDateModified)     at Microsoft.SharePoint.Navigation.SPNavigationNode.AddInternal(Int32
    iPreviousNodeId, Int32 iParentId, Boolean bAddToQuickLaunch, Boolean bAddToSearchNav)     at Microsoft.SharePoint.Navigation.SPNavigationNodeCollection.AddInternal(SPNavigationNode node, Int32 iPreviousNodeId)     at ImpactSharePoint.ConfigureSharePointInstance.NavigationConfig.<ConfigureQuickLaunchBar>b__0()
        at Microsoft.SharePoint.SPSecurity.<>c__DisplayClass5.<RunWithElevatedPrivileges>b__3()     at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode)     at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback
    secureCode, Object param)     at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated secureCode)     at ImpactSharePoint.ConfigureSharePointInstance.NavigationConfig.ConfigureQuickLaunchBar()     at ImpactSharePoint.Features.Pages.PagesEventReceiver.FeatureActivated(SPFeatureReceiverProperties
    properties)     at Microsoft.SharePoint.SPFeature.DoActivationCallout(Boolean fActivate, Boolean fForce)     at Microsoft.SharePoint.SPFeature.Activate(SPSite siteParent, SPWeb webParent, SPFeaturePropertyCollection props, SPFeatureActivateFlags
    activateFlags, Boolean fForce)     at Microsoft.SharePoint.SPFeatureCollection.AddInternal(SPFeatureDefinition featdef, Version version, SPFeaturePropertyCollection properties, SPFeatureActivateFlags activateFlags, Boolean force, Boolean fMarkOnly)
        at Microsoft.SharePoint.SPFeature.ActivateDeactivateFeatureAtWeb(Boolean fActivate, Boolean fEnsure, Guid featid, SPFeatureDefinition featdef, String urlScope, String sProperties, Boolean fForce)     at Microsoft.SharePoint.SPFeature.ActivateDeactivateFeatureAtScope(Boolean
    fActivate, Guid featid, SPFeatureDefinition featdef, String urlScope, Boolean fForce)     at Microsoft.SharePoint.PowerShell.SPCmdletEnableFeature.UpdateDataObject()     at Microsoft.SharePoint.PowerShell.SPCmdlet.ProcessRecord()  
      at System.Management.Automation.CommandProcessor.ProcessRecord()     at System.Management.Automation.CommandProcessorBase.DoExecute()     at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object
    input, Hashtable errorResults, Boolean enumerate)     at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][]
    commandRedirections, FunctionContext funcContext)     at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)     at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame
    frame)     at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)     at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)     at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0
    arg0)     at System.Management.Automation.DlrScriptCommandProcessor.RunClause(Action`1 clause, Object dollarUnderbar, Object inputToProcess)     at System.Management.Automation.CommandProcessorBase.DoComplete()     at System.Management.Automation.Internal.PipelineProcessor.DoCompleteCore(CommandProcessorBase
    commandRequestingUpstreamCommandsToStop)     at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input, Hashtable errorResults, Boolean enumerate)     at System.Management.Automation.Runspaces.LocalPipeline.InvokeHelper()
        at System.Management.Automation.Runspaces.LocalPipeline.InvokeThreadProc()     at System.Management.Automation.Runspaces.PipelineThread.WorkerProc()     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext,
    ContextCallback callback, Object state, Boolean preserveSyncCtx)     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)     at System.Threading.ExecutionContext.Run(ExecutionContext
    executionContext, ContextCallback callback, Object state)     at System.Threading.ThreadHelper.ThreadStart()
    5b7e05f7-49df-42ca-b7c9-8ae5b06b464f
    03.12.2014 15:21:25.45 PowerShell.exe (0x1620)
    0x11F4 SharePoint Foundation
    Database 880j
    High SqlError: 'Cannot insert duplicate key row in object 'dbo.NavNodes' with unique index 'NavNodes_PK'. The duplicate key value is (6323df8a-5c57-4d3e-a477-09aa8b66100a, 7ae114df-9d52-4b08-affa-8c544cbc27b6, 1000).'
       Source: '.Net SqlClient Data Provider' Number: 2601 State: 1 Class: 14 Procedure: 'proc_NavStructAddNewNode' LineNumber: 92 Server: 'IMPACTCLUSTER\IMPACTDB'
    5b7e05f7-49df-42ca-b7c9-8ae5b06b464f
    03.12.2014 15:21:25.45 PowerShell.exe (0x1620)
    0x11F4 SharePoint Foundation
    Database 880j
    High SqlError: 'The statement has been terminated.'    Source: '.Net SqlClient Data Provider' Number: 3621 State: 0 Class: 0 Procedure: 'proc_NavStructAddNewNode' LineNumber: 92 Server: 'IMPACTCLUSTER\IMPACTDB'
    5b7e05f7-49df-42ca-b7c9-8ae5b06b464f
    03.12.2014 15:21:25.45 PowerShell.exe (0x1620)
    0x11F4 SharePoint Foundation
    Database tzku
    High ConnectionString: 'Data Source=IMPACTCLUSTER\IMPACTDB;Initial Catalog=WSS_Content;Integrated Security=True;Enlist=False;Pooling=True;Min Pool Size=0;Max Pool Size=100;Connect Timeout=15;Application Name=SharePoint[powershell][1][WSS_Content]'
       Partition: 6323df8a-5c57-4d3e-a477-09aa8b66100a ConnectionState: Closed ConnectionTimeout: 15
    5b7e05f7-49df-42ca-b7c9-8ae5b06b464f
    03.12.2014 15:21:25.45 PowerShell.exe (0x1620)
    0x11F4 SharePoint Foundation
    Database tzkv
    High SqlCommand: 'BEGIN TRAN DECLARE @abort int SET @abort = 0 DECLARE @EidBase int,@EidHome int SET @EidBase = 0 SET @EidHome = NULL IF @abort = 0 BEGIN EXEC @abort = proc_NavStructAllocateEidBlockWebId @wssp0, @wssp1,
    @wssp2, @wssp3, @EidBase OUTPUT SELECT @wssp4 = @EidBase, @wssp5 = @abort END IF @abort = 0 BEGIN EXEC @abort = proc_NavStructAddNewNodeByUrl '6323DF8A-5C57-4D3E-A477-09AA8B66100A','7AE114DF-9D52-4B08-AFFA-8C544CBC27B6',1,2072,-1,0,N'sites/impact/default.aspx',N'PersonSøk',N'PersonSøk',NULL,0,0,0,NULL,@EidBase,@EidHome
    OUTPUT SELECT @wssp6 = @abort END IF @abort = 0 BEGIN EXEC proc_NavStructLogChangesAndUpdateSiteChangedTime @wssp7, @wssp8, NULL END IF @abort <> 0 BEGIN ROLLBACK TRAN END ELSE BEGIN COMMIT TRAN END IF @abort = 0  BEGIN EXEC proc_UpdateDiskUsed
    '6323DF8A-5C57-4D3E-A477-09AA8B66100A' END '     CommandType: Text CommandTimeout: 0     Parameter: '@wssp0' Type: UniqueIdentifier Size: 0 Direction: Input Value: '6323df8a-5c57-4d3e-a477-09aa8b66100a'     Parameter: '@wssp1'
    Type: UniqueIdentifier Size: 0 Direction: Input Value: '7ae114df-9d52-4b08-affa-8c544cbc27b6'     Parameter: '@wssp2' Type: Int Size: 0 Direction: Input Value: '1'     Parameter: '@wssp3' Type: Int Size: 0 Direction: Input Value: '2072'
        Parameter: '@wssp4' Type: Int Size: 0 Direction: Output Value: '2072'     Parameter: '@wssp5' Type: Int Size: 0 Direction: Output Value: '0'     Parameter: '@wssp6' Type: Int Size: 0 Direction: Output Value: '10006'  
      Parameter: '@wssp7' Type: UniqueIdentifier Size: 0 Direction: Input Value: '6323df8a-5c57-4d3e-a477-09aa8b66100a'     Parameter: '@wssp8' Type: UniqueIdentifier Size: 0 Direction: Input Value: '7ae114df-9d52-4b08-affa-8c544cbc27b6'
    5b7e05f7-49df-42ca-b7c9-8ae5b06b464f
    03.12.2014 15:21:25.45 PowerShell.exe (0x1620)
    0x11F4 SharePoint Foundation
    Database aek90
    High SecurityOnOperationCheck = True
    5b7e05f7-49df-42ca-b7c9-8ae5b06b464f
    03.12.2014 15:21:25.45 PowerShell.exe (0x1620)
    0x11F4 SharePoint Foundation
    Database d0d6
    High System.Data.SqlClient.SqlException (0x80131904): Cannot insert duplicate key row in object 'dbo.NavNodes' with unique index 'NavNodes_PK'. The duplicate key value is (6323df8a-5c57-4d3e-a477-09aa8b66100a, 7ae114df-9d52-4b08-affa-8c544cbc27b6,
    1000).  The statement has been terminated.     at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)     at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject
    stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)     at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj,
    Boolean& dataReady)     at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()     at System.Data.SqlClient.SqlDataReader.get_MetaData()     at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior
    runBehavior, String resetOptionsString)     at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite)  
      at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite)     at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior
    cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)     at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)     at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior
    behavior)     at Microsoft.SharePoint.Utilities.SqlSession.ExecuteReader(SqlCommand command, CommandBehavior behavior, SqlQueryData monitoringData, Boolean retryForDeadLock)     at Microsoft.SharePoint.SPSqlClient.ExecuteQueryInternal(Boolean
    retryfordeadlock)     at Microsoft.SharePoint.SPSqlClient.ExecuteQuery(Boolean retryfordeadlock)  ClientConnectionId:2bb4004c-aa75-470e-b11e-dbf1c476aaed
    5b7e05f7-49df-42ca-b7c9-8ae5b06b464f
    03.12.2014 15:21:25.45 PowerShell.exe (0x1620)
    0x11F4 SharePoint Foundation
    Database ad194
    High ExecuteQuery failed with original error 0x80131904
    5b7e05f7-49df-42ca-b7c9-8ae5b06b464f
    03.12.2014 15:21:25.45 PowerShell.exe (0x1620)
    0x11F4 SharePoint Foundation
    Database 8z23
    Unexpected Unexpected query execution failure in navigation query, HResult -2146232060. Query text (if available): "BEGIN TRAN DECLARE @abort int SET @abort = 0 DECLARE @EidBase int,@EidHome int SET @EidBase
    = 0 SET @EidHome = NULL IF @abort = 0 BEGIN EXEC @abort = proc_NavStructAllocateEidBlockWebId @wssp0, @wssp1, @wssp2, @wssp3, @EidBase OUTPUT SELECT @wssp4 = @EidBase, @wssp5 = @abort END IF @abort = 0 BEGIN EXEC @abort = proc_NavStructAddNewNodeByUrl '6323DF8A-5C57-4D3E-A477-09AA8B66100A','7AE114DF-9D52-4B08-AFFA-8C544CBC27B6',1,2072,-1,0,N'sites/impact/default.aspx',N'PersonSøk',N'PersonSøk',NULL,0,0,0,NULL,@EidBase,@EidHome
    OUTPUT SELECT @wssp6 = @abort END IF @abort = 0 BEGIN EXEC proc_NavStructLogChangesAndUpdateSiteChangedTime @wssp7, @wssp8, NULL END IF @abort <> 0 BEGIN ROLLBACK TRAN END ELSE BEGIN COMMIT TRAN END IF @abort = 0  BEGIN EXEC proc_UpdateDiskUsed
    '6323DF8A-5C57-4D3E-A477-09AA8B66100A' END "
    5b7e05f7-49df-42ca-b7c9-8ae5b06b464f
    03.12.2014 15:21:25.45 PowerShell.exe (0x1620)
    0x11F4 SharePoint Foundation
    General 8kh7
    High <nativehr>0x8107140d</nativehr><nativestack></nativestack>An unexpected error occurred while manipulating the navigational structure of this Web.
    5b7e05f7-49df-42ca-b7c9-8ae5b06b464f
    03.12.2014 15:21:25.45 PowerShell.exe (0x1620)
    0x11F4 SharePoint Foundation
    General aix9j
    High SPRequest.AddNavigationNode: UserPrincipalName=i:0).w|s-1-5-21-2030300366-1823906440-2562684930-2106, AppPrincipalName= ,bstrUrl=http://im-sp1/sites/impact ,bstrName=PersonSøk ,bstrNameResource=<null> ,bstrNodeUrl=/sites/impact/default.aspx
    ,lType=0 ,lParentId=2072 ,lPreviousSiblingId=-1 ,bAddToQuickLaunch=False ,bAddToSearchNav=False
    5b7e05f7-49df-42ca-b7c9-8ae5b06b464f
    03.12.2014 15:21:25.45 PowerShell.exe (0x1620)
    0x11F4 SharePoint Foundation
    General ai1wu
    Medium System.Runtime.InteropServices.COMException: <nativehr>0x8107140d</nativehr><nativestack></nativestack>An unexpected error occurred while manipulating the navigational structure of this
    Web., StackTrace:    at Microsoft.SharePoint.Navigation.SPNavigationNode.AddInternal(Int32 iPreviousNodeId, Int32 iParentId, Boolean bAddToQuickLaunch, Boolean bAddToSearchNav)     at Microsoft.SharePoint.Navigation.SPNavigationNodeCollection.AddInternal(SPNavigationNode
    node, Int32 iPreviousNodeId)     at ImpactSharePoint.ConfigureSharePointInstance.NavigationConfig.<ConfigureQuickLaunchBar>b__0()     at Microsoft.SharePoint.SPSecurity.<>c__DisplayClass5.<RunWithElevatedPrivileges>b__3()
        at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode)     at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode, Object param)     at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated
    secureCode)     at ImpactSharePoint.ConfigureSharePointInstance.NavigationConfig.ConfigureQuickLaunchBar()     at ImpactSharePoint.Features.Pages.PagesEventReceiver.FeatureActivated(SPFeatureReceiverProperties properties)    
    at Microsoft.SharePoint.SPFeature.DoActivationCallout(Boolean fActivate, Boolean fForce)     at Microsoft.SharePoint.SPFeature.Activate(SPSite siteParent, SPWeb webParent, SPFeaturePropertyCollection props, SPFeatureActivateFlags activateFlags, Boolean
    fForce)     at Microsoft.SharePoint.SPFeatureCollection.AddInternal(SPFeatureDefinition featdef, Version version, SPFeaturePropertyCollection properties, SPFeatureActivateFlags activateFlags, Boolean force, Boolean fMarkOnly)     at Microsoft.SharePoint.SPFeature.ActivateDeactivateFeatureAtWeb(Boolean
    fActivate, Boolean fEnsure, Guid featid, SPFeatureDefinition featdef, String urlScope, String sProperties, Boolean fForce)     at Microsoft.SharePoint.SPFeature.ActivateDeactivateFeatureAtScope(Boolean fActivate, Guid featid, SPFeatureDefinition
    featdef, String urlScope, Boolean fForce)     at Microsoft.SharePoint.PowerShell.SPCmdletEnableFeature.UpdateDataObject()     at Microsoft.SharePoint.PowerShell.SPCmdlet.ProcessRecord()     at System.Management.Automation.CommandProcessor.ProcessRecord()
        at System.Management.Automation.CommandProcessorBase.DoExecute()     at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input, Hashtable errorResults, Boolean enumerate)     at System.Management.Automation.PipelineOps.InvokePipeline(Object
    input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcContext)     at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame
    frame)     at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)     at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)    
    at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)     at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)     at System.Management.Automation.DlrScriptCommandProcessor.RunClause(Action`1
    clause, Object dollarUnderbar, Object inputToProcess)     at System.Management.Automation.CommandProcessorBase.DoComplete()     at System.Management.Automation.Internal.PipelineProcessor.DoCompleteCore(CommandProcessorBase commandRequestingUpstreamCommandsToStop)
        at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input, Hashtable errorResults, Boolean enumerate)     at System.Management.Automation.Runspaces.LocalPipeline.InvokeHelper()    
    at System.Management.Automation.Runspaces.LocalPipeline.InvokeThreadProc()     at System.Management.Automation.Runspaces.PipelineThread.WorkerProc()     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext,
    ContextCallback callback, Object state, Boolean preserveSyncCtx)     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)     at System.Threading.ExecutionContext.Run(ExecutionContext
    executionContext, ContextCallback callback, Object state)     at System.Threading.ThreadHelper.ThreadStart()
    5b7e05f7-49df-42ca-b7c9-8ae5b06b464f
    03.12.2014 15:21:25.45 PowerShell.exe (0x1620)
    0x11F4 SharePoint Foundation
    Feature Infrastructure 88jm
    High Feature receiver assembly 'ImpactSharePoint, Version=1.1.0.0, Culture=neutral, PublicKeyToken=3f4d824fecc0071e', class 'ImpactSharePoint.Features.Pages.PagesEventReceiver', method 'FeatureActivated' for feature
    'd8aabd95-076a-4650-a8a6-0aa5bd8ac8d1' threw an exception: Microsoft.SharePoint.SPException: An unexpected error occurred while manipulating the navigational structure of this Web. ---> System.Runtime.InteropServices.COMException: <nativehr>0x8107140d</nativehr><nativestack></nativestack>An
    unexpected error occurred while manipulating the navigational structure of this Web.     at Microsoft.SharePoint.Library.SPRequestInternalClass.AddNavigationNode(String bstrUrl, String bstrName, String bstrNameResource, String bstrNodeUrl, Int32
    lType, Int32 lParentId, Int32 lPreviousSiblingId, Boolean bAddToQuickLaunch, Boolean bAddToSearchNav, String& pbstrDateModified)     at Microsoft.SharePoint.Library.SPRequest.AddNavigationNode(String bstrUrl, String bstrName, String bstrNameResource,
    String bstrNodeUrl, Int32 lType, Int32 lParentId, Int32 lPreviousSiblingId, Boolean bAddToQuickLaunch, Boolean bAddToSearchNav, String& pbstrDateModified)     --- End of inner exception stack trace ---     at Microsoft.SharePoint.SPGlobal.HandleComException(COMException
    comEx)     at Microsoft.SharePoint.Library.SPRequest.AddNavigationNode(String bstrUrl, String bstrName, String bstrNameResource, String bstrNodeUrl, Int32 lType, Int32 lParentId, Int32 lPreviousSiblingId, Boolean bAddToQuickLaunch, Boolean bAddToSearchNav,
    String& pbstrDateModified)     at Microsoft.SharePoint.Navigation.SPNavigationNode.AddInternal(Int32 iPreviousNodeId, Int32 iParentId, Boolean bAddToQuickLaunch, Boolean bAddToSearchNav)     at Microsoft.SharePoint.Navigation.SPNavigationNodeCollection.AddInternal(SPNavigationNode
    node, Int32 iPreviousNodeId)     at ImpactSharePoint.ConfigureSharePointInstance.NavigationConfig.<ConfigureQuickLaunchBar>b__0()     at Microsoft.SharePoint.SPSecurity.<>c__DisplayClass5.<RunWithElevatedPrivileges>b__3()
        at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode)     at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode, Object param)     at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated
    secureCode)     at ImpactSharePoint.ConfigureSharePointInstance.NavigationConfig.ConfigureQuickLaunchBar()     at ImpactSharePoint.Features.Pages.PagesEventReceiver.FeatureActivated(SPFeatureReceiverProperties properties)    
    at Microsoft.SharePoint.SPFeature.DoActivationCallout(Boolean fActivate, Boolean fForce)
    5b7e05f7-49df-42ca-b7c9-8ae5b06b464f
    The code:
    using System.Diagnostics;
    using Microsoft.SharePoint;
    using Microsoft.SharePoint.Navigation;
    namespace ImpactSharePoint.ConfigureSharePointInstance
        public class NavigationConfig
            public void ConfigureQuickLaunchBar(SPWeb web)
                SPSecurity.RunWithElevatedPrivileges(delegate
                    //Delete All Links
                    web.AllowUnsafeUpdates = true;
                    for (int i = web.Navigation.QuickLaunch.Count - 1; i > -1; i--)
                        web.Navigation.QuickLaunch[i].Delete(); // -> Deleting all the links in quick launch
                    web.QuickLaunchEnabled = true;
                    EventLog.WriteEntry("Sharepointfeature","Starter");
                    //Adding Links
                    SPNavigationNodeCollection nodes = web.Navigation.QuickLaunch;
                    var sokNode = new SPNavigationNode("Søk", null, false);
                    nodes.AddAsFirst(sokNode);
                    sokNode.Update();
                    EventLog.WriteEntry("Sharepointfeature", "Lagt til søk");
                    // Personsøk
                    var personSokNode = new SPNavigationNode("Deltakere", "/sites/impact/default.aspx", false); //TODO: fix hardkoding
                    sokNode.Children.AddAsFirst(personSokNode);
                    personSokNode.Update();
                    EventLog.WriteEntry("Sharepointfeature", "Lagt til node personsøk");
                    // Udb-søk
                    var udbSokNode = new SPNavigationNode("UDB-Søk", "/sites/impact/udbsok.aspx", false); //TODO: fix hardkoding
                    sokNode.Children.AddAsLast(udbSokNode);
                    udbSokNode.Update();
                    EventLog.WriteEntry("Sharepointfeature", "Lagt til node udbsøk");
                    // Kommuner
                    var kommuneNode = new SPNavigationNode("Kommuner", "/sites/impact/kommunesearch.aspx", false); //TODO: fix hardkoding
                    sokNode.Children.AddAsFirst(kommuneNode);
                    kommuneNode.Update();
                    EventLog.WriteEntry("Sharepointfeature", "Lagt til node kommunesøk");   
                    // Organisasjoner
                    var virksomhetNode = new SPNavigationNode("Organisasjoner", "/sites/impact/virksomhetsearch.aspx", false); //TODO: fix hardkoding
                    sokNode.Children.AddAsFirst(virksomhetNode);
                    virksomhetNode.Update();
                    EventLog.WriteEntry("Sharepointfeature", "Lagt til node kommunesøk");
                    // NIR
                    var nirNode = new SPNavigationNode("Nir", null, false); //TODO: fix hardkoding
                    nodes.AddAsLast(nirNode);
                    nirNode.Update();
                    EventLog.WriteEntry("Sharepointfeature", "Lagt til node Nir");
                    // Tilskudd
                    var tilskuddNode = new SPNavigationNode("Tilskudd", "/sites/impact/", false);
                    nodes.AddAsLast(tilskuddNode);
                    tilskuddNode.Update();
                    EventLog.WriteEntry("Sharepointfeature", "Lagt til node Tilskudd");
                    // Kjøringsoversikt
                    var showkjoringerNode = new SPNavigationNode("Kjøringsoversikt", "/sites/dev/kjoringoversikt.aspx", false); //TODO: fix hardkoding
                    tilskuddNode.Children.AddAsFirst(showkjoringerNode);
                    showkjoringerNode.Update();
                    EventLog.WriteEntry("Sharepointfeature", "Lagt til node showkjoringerNode");
                    web.Update();
                    EventLog.WriteEntry("Sharepointfeature", "Etter update");
                    //Setting homepage
                    SPFolder folder = web.RootFolder;
                    folder.WelcomePage = "default.aspx";
                    folder.Update();
                    EventLog.WriteEntry("Sharepointfeature", "Etter homepage");
                    web.AllowUnsafeUpdates = false;

    i think you need to debug your code, lookalike the values you trying insert already exist in the database.
    these two IDs (6323df8a-5c57-4d3e-a477-09aa8b66100a, 7ae114df-9d52-4b08-affa-8c544cbc27b6).
    i would try to run the select command against the content db.
    SELECT TOP *  FROM [DB Name].[dbo].[NavNodes] where id = '6323df8a-5c57-4d3e-a477-09aa8b66100a'
    Please remember to mark your question as answered &Vote helpful,if this solves/helps your problem. ****************************************************************************************** Thanks -WS MCITP(SharePoint 2010, 2013) Blog: http://wscheema.com/blog

  • Violation of PRIMARY KEY constraint 'XPKLocalizedLabel'. Cannot insert duplicate key in object 'MetadataSchema.LocalizedLabel'.

    Hello everyone,
    I am getting the following error while importing the CRM 2013 managed solution, Does anyone have any idea regarding this, What could be the possible cause for this ?
    "Violation of PRIMARY KEY constraint 'XPKLocalizedLabel'. Cannot insert duplicate key in object 'MetadataSchema.LocalizedLabel'. The duplicate key value is (184191c0-1d6f-e411-9400-e41f13be2efc, 25a01723-9f63-4449-a3e0-046cc23a2902, 0,
    Jan 1 1900 12:00AM). The statement has been terminated."
    and this guids in the error message is different from organization to organization. Where it is having fix with the solution or organization ?
    please help me to solve this.
    Thanks in advance, Veeresh

    Hi All,
    I have exported one unmanaged solution from my development CRM system and imported in to production, while importing i am getting the following error. 
    "Violation of PRIMARY KEY constraint 'XPKLocalizedLabel'. Cannot insert duplicate key in object 'MetadataSchema.LocalizedLabel'. The duplicate key value is (184191c0-1d6f-e411-9400-e41f13be2efc, 25a01723-9f63-4449-a3e0-046cc23a2902,
    0, Jan 1 1900 12:00AM).
    The statement has been terminated."
    The key point i have noticed here is, recently i have updated my CRM system with server pack 1 and development organization is created after the server pack is installed and production organization is created before the server pack is installed. and
    i have tried this in some other organization which is created before the server pack 1 installed it is failed there also and some organization which is created after the server pack 1 is installed it is imported successfully.
    so i can see here it is not able to import solution into organization which is created before server pack 1 is installed from which is created after the server pack 1 is installed.
    please help me to solve this error.
    Thanks,
    Veeresh
    Thanks in advance, Veeresh

  • How to combine large number of key-value pair tables into a single table?

    I have 250+ key-value pair tables with the following characteristics
    1) keys are unique within a table but may or may not be unique across tables
    2) each table has about 2 million rows
    What is the best way to create a single table with all the unique key-values from all these tables? The following two queries work till about 150+ tables
    with
      t1 as ( select 1 as key, 'a1' as val from dual union all
              select 2 as key, 'a1' as val from dual union all
              select 3 as key, 'a2' as val from dual )
    , t2 as ( select 2 as key, 'b1' as val from dual union all
              select 3 as key, 'b2' as val from dual union all
              select 4 as key, 'b3' as val from dual )
    , t3 as ( select 1 as key, 'c1' as val from dual union all
              select 3 as key, 'c1' as val from dual union all
              select 5 as key, 'c2' as val from dual )
    select coalesce(t1.key, t2.key, t3.key) as key
    ,      max(t1.val) as val1
    ,      max(t2.val) as val2
    ,      max(t3.val) as val3
    from t1
    full join t2 on ( t1.key = t2.key )
    full join t3 on ( t2.key = t3.key )
    group by coalesce(t1.key, t2.key, t3.key)
    with
      master as ( select rownum as key from dual connect by level <= 5 )
    , t1 as ( select 1 as key, 'a1' as val from dual union all
              select 2 as key, 'a1' as val from dual union all
              select 3 as key, 'a2' as val from dual )
    , t2 as ( select 2 as key, 'b1' as val from dual union all
              select 3 as key, 'b2' as val from dual union all
              select 4 as key, 'b3' as val from dual )
    , t3 as ( select 1 as key, 'c1' as val from dual union all
              select 3 as key, 'c1' as val from dual union all
              select 5 as key, 'c2' as val from dual )
    select m.key as key
    ,      t1.val as val1
    ,      t2.val as val2
    ,      t3.val as val3
    from master m
    left join t1 on ( t1.key = m.key )
    left join t2 on ( t2.key = m.key )
    left join t3 on ( t3.key = m.key )
    /

    A couple of questions, then a possible solution.
    Why on earth do you have 250+ key-value pair tables?
    Why on earth do you want to consolodate them into one table with one row per key?
    You could do a pivot of all of the tables, without joining. something like:
    with
      t1 as ( select 1 as key, 'a1' as val from dual union all
              select 2 as key, 'a1' as val from dual union all
              select 3 as key, 'a2' as val from dual )
    , t2 as ( select 2 as key, 'b1' as val from dual union all
              select 3 as key, 'b2' as val from dual union all
              select 4 as key, 'b3' as val from dual )
    , t3 as ( select 1 as key, 'c1' as val from dual union all
              select 3 as key, 'c1' as val from dual union all
              select 5 as key, 'c2' as val from dual )
    select key, max(t1val), max(t2val), max(t3val)
    FROM (select key, val t1val, null t2val, null t3val
          from t1
          union all
          select key, null, val, null
          from t2
          union all
          select key, null, null, val
          from t3)
    group by keyIf you can do this in a single query, unioning all 250+ tables, then you do not need to worry about chaining or migration. It might be necessary to do it in a couple of passes, depending on the resources available on your server. If so, I would be inclined to create the table first, with a larger than normal percent free, then do the first set as a straight insert, and the remaining pass or passes as a merge.
    Another alternative might be to use the approach above, but limit the range of keys in each pass. So pass one would have a predicate like where key between 1 and 10 in each branch of the union, pass 2 would have key between 11 and 20 etc. That way everything would be straight inserts.
    Having said all that, I go back to my second question above, why on earth do you want/need to do this? What is the business requirement you are trying to solve. There might be a much better way to meet the requirement.
    John

Maybe you are looking for