Showing posts with label Exceptions. Show all posts
Showing posts with label Exceptions. Show all posts

June 18, 2019

Oracle blockchain error: chaincode fingerprint mismatch data mismatch

[#OBP]

There are two Organizations (one is the founder and the other is a participant) in a channel (channel name is team1)  in Oracle blockchain network. A chaincode (chain code name is "oow") is deployed and instantiated with version v1 in the founder. A line in the chaincode is changed and deployed the code in the participant with the same version v1. While executing the REST endpoints, below error occurred as Oracle blockchain tries to match the code and their versions in all the peers of the channel and the chaincode are not matching in the peers. Solution for this is to deploy the chaincode with the new version on all the organizations.

{
    "returnCode": "Failure",
    "info": {
        "proxyError": "Proposal not pass",
        "peerErrors": [
            {
                "peerId": "prodhonestpeer1",
                "errMsg": "Sending proposal to prodhonestpeer1 failed because of: gRPC failure=Status{code=UNKNOWN, description=error executing chaincode: could not get ChaincodeDeploymentSpec for oow:v1.2: get ChaincodeDeploymentSpec for oow/team1 from LSCC error: chaincode fingerprint mismatch data mismatch, cause=null}",
                "verified": false
            },
            {
                "peerId": "prodhonestpeer0",
                "errMsg": "Sending proposal to prodhonestpeer0 failed because of: gRPC failure=Status{code=UNKNOWN, description=error executing chaincode: could not get ChaincodeDeploymentSpec for oow:v1.2: get ChaincodeDeploymentSpec for oow/team1 from LSCC error: chaincode fingerprint mismatch data mismatch, cause=null}",
                "verified": false
            }
        ]
    },
    "txid": "973a7518438bf9c62db240ea41dce88ef78854caa20"
}

#OBP #OracleBlockchain #Blockchain

May 6, 2019

Oracle blockchain error: executing chaincode premature execution

[#OBPCS]

I received the below error while executing a rest service of a participant in the Oracle Blockchain network. I deployed and instantiated successfully a new version of a chain code into all the participants of a channel in the network. While executing the corresponding rest service, it has thrown the below error. This is because I executed the rest service immediately after the code was instantiated. It took a few seconds to available. I executed the rest service again after a few seconds and then it worked without any code or configuration changes. :).

It looks funny, but it worked for me.  So, when you see this error, don't be panic. Just wait a few seconds and try again. This is because it may take some time for chain code to be ready on rest servers as these changes have to be applied to many containers in the backend.

{
"returnCode":"Failure",
"info":{
"proxyError":"Failed query proposal from peer(s) prodorganicpeer1, prodorganicpeer0.",
"peerErrors":[
{
"peerId":"prodorganicpeer1",
"errMsg":"Sending proposal to prodorganicpeer1 failed because of: gRPC failure=Status{code=UNKNOWN, description=error executing chaincode: premature execution - chaincode (oow:v1.3) launched and waiting for registration, cause=null}",
"verified":false
},
{
"peerId":"prodorganicpeer0",
"errMsg":"Sending proposal to prodorganicpeer0 failed because of: gRPC failure=Status{code=UNKNOWN, description=error executing chaincode: premature execution - chaincode (oow:v1.3) launched and waiting for registration, cause=null}",
"verified":false
}
]
}}

#OBPCS #OracleBlockchain #Blockchain

October 15, 2018

Android Error: Failed to resolve: com.google.firebase

[Android Studio]

Issue:

I updated gradle to 4.4 in my Android app and added below firebase libraries to my app level build.gradle file

implementation 'com.google.firebase:firebase-core:16.0.0'


but while building the project, got the below error

Failed to resolve: com.google.firebase:firebase-core:16.0.0


Solution:
This is a maven issue. This issue is resolved after adding google() to repositories of allporjects in project level build.gradle file. Now the json looks like below.

allprojects {
    repositories {
        google()
        jcenter()
    }
}

June 20, 2017

Issue: REST web services are created in AppModule but disappeared

[JDev 12.1.3]

Issue:

I have created an ADF application in JDeveloper 12.1.3 in which I created restful web services in the app module for the business components. I created another ViewObject by custom sql query and added to app module and created rest services for it. Suddenly all my existing rest services are disappeared from the app module window and + button under REST tab is also disabled as shown in the below image. There is no error or alert shown.


I can see the xml files in the project structure but are not appeared in the AppModule window.

Solution:

While creating my new view object by sql , I have not given any key attribute and added it to app module. I rolled back my changes and created the same view object with a key attribute and created rest service for the same view object now and it worked. It added to the list of rest services in the app module and all are appeared.

When you create rest service to any VO, an xml file like below is created.
 "AppModule_<ResourceName>Resource.xml"

When you delete the REST service, this file will not be deleted. If you try to create REST service again with the same name, then also you face the above issue. So, check if this xml file is deleted from the project before creating new one.

May 18, 2017

Error:The number of method references in a .dex file cannot exceed 64K. Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html

While building an android app in Android Studio, I got the below error and the build was failed.

Error: The number of method references in a .dex file cannot exceed 64K. Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html

The solution to avoid this error is, add the property "multiDexEnabled true" under defaultConfig in app's build.graddle file. It will look like below.

android {
    compileSdkVersion 23
    buildToolsVersion "24.0.0"

    defaultConfig {
        applicationId "com.sonuappz.app"
        minSdkVersion 14
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }


Update:

The above solution works for the issue but the root cause is because of multiple libraries added in the app may have same references inside. Try to identify what library exactly needed for the app and remove the extras. If still the issue occurs, above is the solution for it.

April 27, 2017

Error: oracle.maf.impl.cd.datasynch not found

[maf 2.3.1]

I am developing a mobile application with MCS offline sync feature using Oracle MAF. I have used AMPA for the implementation. After deploying the application, on click of "Pending Sync Actions", I got the below error.

Feature not found with id "oracle.maf.impl.cd.datasynch"



This is because the library might be deleted or corrupted in the application. To avoid this error, we need to re-add the library. Below is the procedure to do so.
  • Go to application properties -> Libraries and Classpath
  • If you see libraries "DataSynchFeature.jar" and "WebServiceCallsFeature.jar", remove them
  • Click on "Add JAR/Directory..." and go to the path <jdev_home>/jdeveloper/jdev/extensions/oracle.maf/FARs/CDM
  • Selet both the jar files "DataSynchFeature.jar" and "WebServiceCallsFeature.jar" and add them
  • Click Ok
Now clean and re-deploy the application. It worked for me.




February 14, 2017

Error: Calling the constructor for class oracle.jbo.server.SequenceImpl is not permitted

[JDev 12.1.3]

I have created an EntityObject in the Model project and assigned a DB sequence to the key attribute of it. While running the project, I got the below error.

[Static type checking] - [ADF security error] Calling the constructor for class oracle.jbo.server.SequenceImpl is not permitted.


To avoid this issue,
  • Go to the source of the entity object xml file
  • Search for the tag "TransientExpression"
  • Check the attribute trustMode. It may have the value "untrusted"
  • Change the value to "trusted". Save and run the app
Now the issue should be solved.

Note: The same solution is given in my previous post for the below error. This solution worked for both the issues.




December 6, 2016

Error: [ADF security error] The method getDBTransaction on class oracle.jbo.server.EntityImpl is not permitted

[JDev 12.2.1.0]

I have created an EntityObject from database table and assigned an expression to its key attribute to get the value from a database sequance (See this post to know how to assign a db sequence to a property in entity object ). But while building the project, I got the below error.

Error(11,53): [Static type checking] - [ADF security error] The method getDBTransaction on class oracle.jbo.server.EntityImpl is not permitted.
 @ line 11, column 53. Locations.bcs D:\Application2\Model\src\model Model.jpr


Which means that the entity is not trusted the expression changes. To avoid this issue,

  • Go to the source of the entity object xml file 
  • Search for the tag "TransientExpression"
  • Check the value of the attribute "trustMode"
  • If it is "untrusted", change it to "trusted"
  • Now rebuild the project
The above change solved my issue .






November 22, 2016

TypeError: h.apply is not a function

This is a Knockout JS error. I faced this issue when I am trying to invoke click action of a link created. My link statement is like below.

<a data-bind="attr:{id:Reqid},text: Title,click: $('#popup1').ojPopup('open', '#btnTitle')"></a>

And on click of this link, I am getting the below error.

TypeError: h.apply is not a function

This is because the click handler needs to be wrapped within a function. Below updated statement resolved the issue.

<a data-bind="attr:{id:Reqid},text: Title,hover: function(){$('#popup1').ojPopup('open', '#btnTitle')}"></a>

October 19, 2016

WindowManager: android.view.WindowLeaked: Activity has leaked window

While developing an android mobile app, I received this error.
In the mobile app, on click of back button, a dialog will be opened with few buttons including "Exit". On click of exit, I have given (Activity context).finish(); but it is throwing the below error.


WindowManager: android.view.WindowLeaked: Activity <app package> has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{45500950 V.E..... R....... 0,0-640,929} that was originally added here
at android.view.ViewRootImpl.<init>(ViewRootImpl.java:368)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:252)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
at android.app.Dialog.show(Dialog.java:286)
at android.app.Activity.onKeyUp(Activity.java:2204)
at android.view.KeyEvent.dispatch(KeyEvent.java:2664)
at android.app.Activity.dispatchKeyEvent(Activity.java:2434)



This error occurred due to improper closing of the dialog box before exiting the app. So, the solution I found is to dismiss the dialog box before calling finish() method.

May 13, 2016

Cordova Plugin is not added to Oracle MAF

Issue:
I faced an issue where I could not able to add few cordova plugins to Oracle MAF application. I could able to select the plugin but after selected, it is not added to MAF and not showing any error also.

Solution:
Check the value of the attribute xmlns of the tag plugin in the plugin.xml file under the corddova plugin folder. Generally it is

xmlns="http://cordova.apache.org/ns/plugins/1.0"

Change the value to as below
xmlns="http://apache.org/cordova/ns/plugins/1.0"

Now re-try to add the plugin to MAF.

November 18, 2015

java.sql.SQLException: stale connection

If you are getting the exception "java.sql.SQLException: stale connection" then you should check whether the Connection object is closed anywhere in the app and you are trying to access the same object. In this case, the object is closed and no longer available, so you can not do any execution on that object. 

Solution is to create a fresh connection object. 

If the error received in MAF apps, then remove the close statements as you don't need to close the connection in the mobile.

November 20, 2014

android.content.ActivityNotFoundException: Unable to find explicit activity class

I am developing an android application. On the home screen, it has a button, on click of this an activity should be displayed. While testing the app, on click of the button, the app is giving the below error and the app got terminated.

E/AndroidRuntime(Number): java.lang.RuntimeException: Unable to resume activity {app package}: android.content.ActivityNotFoundException: Unable to find explicit activity class {activity class}; have you declared this activity in your AndroidManifest.xml?

The solution for this is,

Every activity created in android application should be configured in AndroidManifest.xml of the app. To do so, open AndroidManifest.xml and goto Application tab. Under Application Nodes, add all the activities. 

October 15, 2014

ERROR: Plugin 'Camera' not found, or is not a CDVPlugin. Check your plugin mapping in Cordova.plist

I am developing a MAF application in which I need to collect images from the user for which I provided a button. On click of the button, photo library supposed to be opened, so that the user can select the images. But on click of the button, I am getting the below error.

Error:
Plugin 'Camera' not found, or is not a CDVPlugin. Check your plugin mapping in Cordova.plist.

This is because the app is not granted access to required device capabilities.
To give the access, go to maf-application.xml and click on "Device Access", then grant access to required capabilities.

Below is the example where I granted for Camera and Files to avoid the above error.


October 7, 2014

ADF_FACES-30108:The view state of the page has expired because of inactivity. Reload the page.

I have several tabs in my portal application, in which some of them are loading data from web services. Some times when I click on those tabs, an alert message with the below error message is displaying and on-click of Ok button, the app is reloading.

The error message:

ADF_FACES-60098:Faces lifecycle receives unhandled exceptions in phase RESTORE_VIEW 1
javax.faces.application.ViewExpiredException: viewId:/oracle/webcenter/portalapp/pages/home.jspx - ADF_FACES-30108:The view state of the page has expired because of inactivity.  Reload the page.

Solution:

To ignore this error, I have written a filter which validates the app session on every navigation.  And my filter would look like,

package portal;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class MyFilter implements Filter {
    private FilterConfig fc = null;

    public MyFilter() {
        super();
    }

    public void init(FilterConfig filterConfig) throws ServletException {
        fc = filterConfig;
    }

    public void doFilter(ServletRequest servletRequest,
                         ServletResponse servletResponse,
                         FilterChain filterChain) throws IOException,
                                                         ServletException {
        String reqSessionID =
            ((HttpServletRequest)servletRequest).getreqSessionIDId();
        String currentSessionID =
            ((HttpServletRequest)servletRequest).getSession().getId();
        String requestURI =
            ((HttpServletRequest)servletRequest).getRequestURI();
        boolean sameSession =
            currentSessionID.equalsIgnoreCase(reqSessionID);
        System.out.println("currentSessionID == reqSessionID? : " + sameSession);
        if (!sameSession && reqSessionID != null) {
              //((HttpServletResponse)servletResponse).sendRedirect(requestURI);
            System.out.println("Session is null");
        } else {
            filterChain.doFilter(servletRequest, servletResponse);
            System.out.println("Continue to servlet.");
        }
    }

    public void destroy() {
        fc = null;
    }
}

Configured the above filter in web.xml file as below.
<filter>
 <filter-name>AppSessionFilter</filter-name>
   <filter-class>portal.MyFilter</filter-class>
 </filter>
<filter-mapping>
  <filter-name>AppSessionFilter</filter-name>
   <servlet-name>Faces Servlet</servlet-name>
</filter-mapping>

June 16, 2014

java.sql.SQLException: Protocol violation

Exception in thread "main" java.sql.SQLException: Protocol violation: [1]
                at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:502)
                at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:205)
                at oracle.jdbc.driver.T4C7Ocommoncall.doOLOGOFF(T4C7Ocommoncall.java:64)
                at oracle.jdbc.driver.T4CConnection.logoff(T4CConnection.java:576)
                at oracle.jdbc.driver.PhysicalConnection.close(PhysicalConnection.java:5222)
               at XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Connection con=createConnection();
Con.close();
Con.commit();
Con.close();

Here, commit() is invoked after the connection is closed, hence the above exception occurred.

java.lang.ArrayIndexOutOfBoundsException while executing batch Statements in Java

I have created a PreparedStatement to execute a batch of insert statements. But while executing,  the below exception occurred.


java.lang.ArrayIndexOutOfBoundsException: 22 at oracle.jdbc.driver.T4CNumberAccessor.unmarshalOneRow(T4CNumberAccessor.java:207) at oracle.jdbc.driver.T4C8Oall.readRXD(T4C8Oall.java:745) at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:371) at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:205) at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:548) at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:217) at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:1115) at oracle.jdbc.driver.OraclePreparedStatement.executeForRowsWithTimeout(OraclePreparedStatement.java:13106) at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:13246) at oracle.jdbc.driver.OracleStatementWrapper.executeBatch(OracleStatementWrapper.java:248) at XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 



Solution:

After googling, I realized that the PreparedStatement is not accepting more than 6 parameters. Below is the statement I have used.
PreparedStatement stmtQuestions = conDB.prepareStatement("INSERT INTO "+Properties.DB_TABLE +" values(?,?,?,?,?,?,?)");
         
I changed the statement to below which avoid the above exception and program was executed successfully.
Statement stmtQuestions=conDB.createStatement();
String query="INSERT INTO "+Properties.DB_TABLE +" values('"+id+"',"+sid+","+qid+",'"+sqText+"','"+sqSText+"','"+qType+"','"+qoType+"')";
stmtQuestions.addBatch(query);

April 24, 2014

oracle.jbo.DMLException: JBO-27200: JNDI failure. Unable to lookup Data Source at context jdbc/Connection1DS

Issue: 

<LifecycleImpl> <_handleException> ADF_FACES-60098:Faces lifecycle receives unhandled exceptions in phase RENDER_RESPONSE 6
oracle.jbo.DMLException: JBO-27200: JNDI failure. Unable to lookup Data Source at context jdbc/Connection1DS
                at oracle.jbo.server.DBTransactionImpl.lookupDataSource(DBTransactionImpl.java:1476)
                at oracle.jbo.server.DBTransactionImpl2.connectToDataSource(DBTransactionImpl2.java:332)
                at oracle.jbo.common.ampool.DefaultConnectionStrategy.connect(DefaultConnectionStrategy.java:203)
                at oracle.jbo.server.ApplicationPoolMessageHandler.doPoolConnect(ApplicationPoolMessageHandler.java:592)
                at oracle.jbo.server.ApplicationPoolMessageHandler.doPoolMessage(ApplicationPoolMessageHandler.java:422)
                at oracle.jbo.server.ApplicationModuleImpl.doPoolMessage(ApplicationModuleImpl.java:8995)
                at oracle.jbo.common.ampool.ApplicationPoolImpl.sendPoolMessage(ApplicationPoolImpl.java:4603)



Solution:

Check the connection in AppModule. To check,

  • Right click on AppModule
  • Select Configurations option
  • In the Names, select AppModule Local, the corresponding properties will be displayed on the right side of the window
  • Check the JDBC Name/Data source value. It should be the name which you have given to the connection created in your application. If the value is not correct, Select the property and click on Edit button to change the value

July 12, 2013

java.lang.UnsupportedOperationException



As the name implies when the requested operation is not supported, we get this error.
Below is a sample program to generate this error.

public static void main(String args[])
{
String st[]={"Hi","Hello","Bye"};
List list=Arrays.asList(st);
list.add(“Anand”); //Get error at this line
System.out.println(" List: "+list);
}

 If we run this method, we get the below error because we are trying to add a new element to a list which is not updatable.

Caused by: java.lang.UnsupportedOperationException
                at java.util. List.add(List.java:131)
                at java.util. List.add(List.java:91)
                at Test.main(Test.java:7)

 I modified the program as below to run without errors.

public static void main(String args[])
{
String st[]={"Hi","Hello","Bye"};
ArrayList<String> list = new ArrayList<String>();
//List list=Arrays.asList(st);
list.addAll(Arrays.asList(st));
list.add(“Anand”); //Get error at this line
System.out.println(" List: "+list);
}


June 26, 2013

Error: Page template name already used in library


I have created a page template with name “PageTemplate.jspx” in JDeveloper for my application, but I deleted the file later. Again when I tried to create a page template with the same name “PageTemplate.jspx”  in the application then I got the below validation error “Page template name already used in library”.





Even if we delete the file from JDeveloper, entries from some configuration files may not be deleted. Hence, we get this error.
There are two solutions for this.
The simplest one is to give different name to the template :D .
Another one is,
  • Go to META-INF folder under Application Source of the project
  • Open the file “pagetemplate-metadata.xml”
  • You should find your pagetemplate entry with in the tags
     <pagetemplate-jsp-ui-def>…</pagetemplate-jsp-ui-def>
  • Remove the entry and save the xml file
  • Now you should be able to create the page template with the same name