Which exception is thrown?
Which exception is thrown when a native method breaks?
For example: when a native method cannot access some device.
Is it RunTimeException, or just plain Exception, or perhaps something else?
Thanks.
The native - C - code is yours. If it encounters an
error, it is up to you to decide how to deal with it.No. Im using someone elses native methods.
Chances are, if you are trying to write a wrapper
around someone elses code...Exactly! :)
... you will find the code
throws C++ exceptions. You have to catch them and
deal with them.I know that. That is why I posted a question here. Question is: What is that exception?
One likely way to "deal with them" is to define for
yourself the exceptions you would like to see in
java, and have the native methods construct and throw
those java exceptions. The JNI interface includes
ways of throwing exceptions while in native code.I don't know that. If you could provide some example it would be most appreciated.
Thanks.
Similar Messages
-
Which exception is thrown in overidding method
Hi ,
I have a doubt in doubt in overriding method. What type of exception is thrown in overidding method.Hi all,
I have a doubt.. I read some where that an overriding
method can throw a different exception from the
orignal one. Does that exception has a restriction
that ..it shouldn't be more Generic than that of the
original?
Yes, this is what the jls in section 8.4.4 has to say about throws and overriding
A method that overrides or hides another method (�8.4.6), including methods that implement abstract methods defined in interfaces,
may not be declared to throw more checked exceptions than the overridden or hidden method.
More precisely, suppose that B is a class or interface, and A is a superclass or
superinterface of B, and a method declaration n in B overrides or hides a
method declaration m in A. If n has a throws clause that mentions any checked
exception types, then m must have a throws clause, and for every checked
exception type listed in the throws clause of n, that same exception class or one
of its superclasses must occur in the throws clause of m; otherwise, a compile-time error occursLets take an example
public class A
public void meth() throws IOException
//some code that throws IOException
class B extends A
//this is ok bcos FNFException inherits from IOException
public void meth() throws FileNotFoundException
//code that throws FNFException
/* THIS WILL FAIL TO COMPILE
public void meth() throws Exception
//code that throws FNFException
I think the access modifier in the over riden method
can't be more restrictive than the original one.. For
example..The overriden method can change the access
modifier from default to protected..But not vice
versa..correct.
Cheers,
ram. -
Which exception to be thrown when integrity check fails
hey guys just a scenario for ya.
During the developmen of an API for Global Platform,if an integrity check failure occurs reading a value should an exception be thrown, if not then wat procedure should be followed.
put some light on thisdude,the scenario is as mentioned...
an applet calls an api which inturn returns a value.This value is a critical value of th card.So in the memory this value will be stored along with its compliment.
In the api,first of all it has to be checked whether the value and it compliment when 'AND ed' gives zero,this is to ensure that memory is corrupted.So if this check fails in the API what shoukd be done.
Should and exception be thrown or an error status word be return to the terminl -
Exception is thrown but exception.getMessage() is null
Hi,
I am wirting a code in which an exception is thrown, I catch this exception in the catch block, but when I display e.getMessage() it displays null.....Can any body help in telling why....
Thanks
Rajnish VermagetMessage() is just about useless. If you use the no-arg constructor for a Throwable, you'll get a null message. Much, much better for displaying information about Throwables is toString() which will include the class name of the Throwable and the message if it's not null. Out shop never uses getMessage()
-
Hi All,
My environment details:
SCSM 2012 R2
SCCM 2012 R2 connector configured
When I looked into the event viewer , I find the following error occurring continuously while the SCCM 2012 synchronization
Error Event 26319
An exception was thrown while processing ProcessDiscoveryData for session ID uuid:xxxxx
Exception message: The relationship source specified in the discovery data item is not valid.
Relationship source ID: xxxx
Rule ID: xxxxxx
Full Exception: Microsoft.EnterpriseManagement.Common.DiscoveryDataInvalidRelationshipSourceException: The relationship source specified in the discovery data item is not valid.
This error is accompanied by the below warning
Event:34113
Connector SCCM Connector -Primary Site
Error writing changes to entity of type Microsoft.Windows.Peripheral.LogicalDisk with DisplayName XXXXXXX
Message: The relationship source specified in the discovery data item is not valid.
Relationship source ID: XXXXXXX
Rule ID: XXXXXXX
If this error occurs with every synchronization, examine view Cached_CMv5_LogicalDisks for correctness or the schema for type Microsoft.Windows.Peripheral.LogicalDisk in management pack Microsoft.Windows.Peripheral.Library.
Event:33333
Data Access Layer rejected retry on SqlError:
Request: p_RelationshipDiscovered -- (RelationshipId=f449d88a-ecbf-5b16-40be-c085391a6380), (SourceEntityId=ccdf084d-254f-0ad4-ba2e-189b75ff109a), (TargetEntityId=07734206-0880-a4ec-a638-df20ccbdcbaf), (RelationshipTypeId=e4c6f8ce-0763-51c6-6421-c424a93a1eb6),
(DiscoverySourceId=df6eae9f-f14f-4e6e-9f3c-c1effa193fbe), (HealthServiceEntityId=34b1c704-120c-1175-9fe3-411e2c0aac30), (PerformHealthServiceCheck=False), (TimeGenerated=09/01/2015 04:15:26), (SourceEntityLastModified=), (IsRelationshipAlreadyDiscovered=False),
(RelationshipInserted=False), (LastModified=), (ChangeId=), (RETURN_VALUE=1)
Class: 16
Number: 777980002
Message: The specified relationship doesn't have a valid source.
From the events, it is clear that the problem is with SCCM connector and in the warning it mention to check the management pack ,
Microsoft.Windows.Peripheral.Library
whether need to update any MP ??
I tried to resolve this, but ended up in aforum which suggested to do a restart of server .But since it is Prod , restart will not be easy.
If any suggestions , it will be good to resolve this
Thank youHi,
Please install UR3 and check the result:
Update Rollup 3 for System Center 2012 R2 Service Manager
http://support.microsoft.com/kb/2962041
Regards,
Yan Li
Please remember to mark the replies as answers if they help and unmark them if they provide no help. -
Populating OUT parameters when TOO_MANY_ROWS exception is thrown
When I was trying to write code to test out today's PL/SQL challenge quiz, the behavior appears to depend on the table being queried. I can't figure out what attribute of the table drives the behavior (or if there is a different explanation for the behavior).
The quiz is testing what happens when a procedure does a SELECT INTO an OUT parameter and a TOO_MANY_ROWS exception is thrown. The intent is to show that even though the behavior is technically undefined, what actually happens is that the OUT parameter is populated with the first row that is selected (obviously, you would never write code that depends on this behavior-- this is solely an academic exercise). The demonstration code works as expected
CREATE TABLE plch_emp ( emp_name VARCHAR2(100) );
INSERT INTO plch_emp VALUES ('Jones');
INSERT INTO plch_emp VALUES ('Smith');
COMMIT;
CREATE OR REPLACE PROCEDURE plch_get
(out_name OUT plch_emp.emp_name%TYPE) IS
BEGIN
SELECT emp_name
INTO out_name
FROM plch_emp
ORDER BY emp_name;
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('A:' || out_name);
END;
What will be displayed after executing the following block:
DECLARE
l_name plch_emp.emp_name%TYPE;
BEGIN
plch_get(l_name);
dbms_output.put_line('B:' || l_name);
END;
/and outputs
A:Jones
B:JonesWhen I replicate the logic while hitting the EMP table, the PLCH_EMP table, and the newly created EMP2 table, however, I get different behavior for the EMP and EMP2 tables. The procedure that queries PLCH_EMP works as expected but the OUT parameter is NULL when either EMP or EMP2 are created. Any idea what causes the behavior to differ?
select *
from v$version;
create table emp2
as
select *
from emp;
create or replace procedure p1( p_out out varchar2 )
is
begin
select emp_name
into p_out
from plch_emp
order by emp_name;
exception
when others then
dbms_output.put_line( 'P1 A:' || p_out );
end;
create or replace procedure p2( p_out out varchar2 )
is
begin
select ename
into p_out
from emp
order by ename;
exception
when others then
dbms_output.put_line( 'P2 A:' || p_out );
end;
create or replace procedure p3( p_out out varchar2 )
is
begin
select ename
into p_out
from emp2
order by ename;
exception
when others then
dbms_output.put_line( 'P3 A:' || p_out );
end;
declare
l_ename varchar2(100);
begin
p1( l_ename );
dbms_output.put_line( 'P1 B:' || l_ename );
p2( l_ename );
dbms_output.put_line( 'P2 B:' || l_ename );
p3( l_ename );
dbms_output.put_line( 'P3 B:' || l_ename );
end;
SQL> select *
2 from v$version;
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for 64-bit Windows: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
SQL>
SQL> create table emp2
2 as
3 select *
4 from emp;
Table created.
SQL>
SQL> create or replace procedure p1( p_out out varchar2 )
2 is
3 begin
4 select emp_name
5 into p_out
6 from plch_emp
7 order by emp_name;
8 exception
9 when others then
10 dbms_output.put_line( 'P1 A:' || p_out );
11 end;
12 /
Procedure created.
SQL>
SQL> create or replace procedure p2( p_out out varchar2 )
2 is
3 begin
4 select ename
5 into p_out
6 from emp
7 order by ename;
8 exception
9 when others then
10 dbms_output.put_line( 'P2 A:' || p_out );
11 end;
12 /
Procedure created.
SQL>
SQL> create or replace procedure p3( p_out out varchar2 )
2 is
3 begin
4 select ename
5 into p_out
6 from emp2
7 order by ename;
8 exception
9 when others then
10 dbms_output.put_line( 'P3 A:' || p_out );
11 end;
12 /
Procedure created.
SQL>
SQL> declare
2 l_ename varchar2(100);
3 begin
4 p1( l_ename );
5 dbms_output.put_line( 'P1 B:' || l_ename );
6
7 p2( l_ename );
8 dbms_output.put_line( 'P2 B:' || l_ename );
9
10 p3( l_ename );
11 dbms_output.put_line( 'P3 B:' || l_ename );
12
13 end;
14 /
P1 A:Jones
P1 B:Jones
P2 A:
P2 B:
P3 A:
P3 B:
PL/SQL procedure successfully completed.JustinBilly Verreynne wrote:
So we can then reasonably assume that the test or environment itself somehow interferes with the results? After all, the very same cursor is executed and the same PL/SQL engine uses that cursor interface.Clearly, there is something in my environment that is wonky. It just bugs me that I can't figure out what that variable is.
Your test was done as a single anonymous PL/SQL block. Which means each proc that was called referenced the same variable/memory - are there perhaps PL/SQL optimisation enabled for the database or session? Or any other settings that could influence the test? Have you tried calling the procedures directly from SQL*Plus using a bind var and not via an anon block and a local var in that block?I have. And the results were the same
SQL> var ename varchar2(100);
SQL> exec p1( :ename );
P1 A:Jones
PL/SQL procedure successfully completed.
SQL> exec p2( :ename );
P2 A:
PL/SQL procedure successfully completed.
SQL> exec p3( :ename );
P3 A:
PL/SQL procedure successfully completed.
As a sanity test - what happens when proc P3 for example is changed to a catersian join/union of emp2 and plch_emp? Do the test results change? Or you can change it as follows:
SQL> ed
Wrote file afiedt.buf
1 create or replace procedure p5( p_out out varchar2 )
2 is
3 begin
4 --// force a value into p_out using a successful fetch
5 select emp_name
6 into p_out
7 from plch_emp
8 where rownum = 1;
9 --// force an error and determine if p_out was overwritten
10 select ename
11 into p_out
12 from emp2
13 order by ename;
14 exception
15 when others then
16 dbms_output.put_line( 'P5:' || p_out );
17* end;
18 /
Procedure created.
SQL> exec p5( :ename );
P5:Jones
PL/SQL procedure successfully completed.
Of course, you can also put this one down to using an operating system like Windows as a poor database server and not as a magnificent client gaming platform... Well, sure. But you can probably only play World of Warcraft so long before you need to write some PL/SQL.
Justin -
Detecting when exception was thrown using custom class loader
Hello all,
I would like to implement the solution described here - http://stackoverflow.com/questions/75218/how-can-i-detect-when-an-exceptions-been-thrown-globally-in-java - that uses custom class loader in order to detect when an Exeption thrown somewhere in the JVM hosting my app, please note that exceptions might be thrown from 3rd party jars the app is using. So, thanks to help I got from another post, I've managed to code the custom class loader. My question is how can the class loader wrap the original exception, as the methods in ClassLoader deals with classes, not instances. So where should I set the original exception?
Thanks!
Edited by: user9355666 on Sep 28, 2010 10:48 PMuser9355666 wrote:
I think I'm missing something fundumental, forgive me for being slow...
This is what I did so far. For the exception wrapper I made a simple class extens Exception that recieve Exception in its ctor and store it. I also subclassed ClassLoader and override its loadClass(). I've registered it as the system classloader. My thinking was to check in that point that if the requested class is instance of Exception and if yes, returning my wrapper class wrapping this exception. But, since loadClass() return class, how can I set in the wrapper the original exception?
In addition, let's say 2 different places in the code throws NPE, to my understanding the classloader will load NPE only once, so how throwing the NPE in the second time can be detected?you are missing a key point. you should creating a custom implementation of the NPE class which hooks into your detection code in its constructor. from that point forward, anytime any NPE (which is your custom class) is constructed, you can detect it. -
Check if an exception is thrown during my JUnit test
Hi all,
I've been writing unit tests for the application I'm writing.
I'm trying to write one very generic test which will simply open up the application, press some buttons, and close it back down, and confirm that no exceptions were thrown at any time during the test.
Unfortunately, while I figured I could just wrap the whole thing in a try/catch block, it seems that I have an exception that is being thown in the AWT-EventQueue which isn't being caught. The test passes fine, but I want it to fail.
What is the best way to go about checking for this? Should I be running the test in the event queue? Or should I have my own error handler to catch the exceptions?
Thanks!
Timjschell wrote:
TimQuinn wrote:
I'm not trying to fix the bug. I'm trying to make my JUnit tests catch the exception. I think we're going around in circles here.Yep. Because the problem was stated incorrectly.
Exceptions are returned up the call stack within the thread of execution.
You have two threads. The one that the test runs in A, and another B.
You can't catch or even see an exception in A that originated in B as an exception (you can't catch it.)
So you need to find some other way, some other place, to put a catch, in thread B and then create data which indicates whether it worked or not. Or find some other existing data that changes state because of that.Well, the question that I asked in my original post was exactly that: how do I find out about an exception that is thrown in another thread? If something got stated incorrectly, maybe it was in the later posts?
It can't be impossible: I can think of one very simple solution to my question, but it isn't very good. I can simply replace the Standard Error writer with one that sets a"fail" flag every time it is called. Then my test can fail every time Standard Error is written to, no matter which thread it's in. Obviously, this isn't a great solution, because, while it would fail the test every time an exception was printed, it would fail other times as well.
So with a bit more work I could parse what's written to stderr myself, to check if it's a real exception. But this really seems like re-inventing the wheel. Is there no standard pattern for creating a test that confirms that you can run something without generating exceptions? -
Exception of type 'System.OutOfMemory Exception' was thrown while running
We have a web application develeoped in ASP.Net, SQL Server 2005 , Crystal Reports 10.2. When I try to run a report which has around 5 lakh records (the query to fetch the records in sql server takes around 1.5 to 2 minutes) gives an error Exception of type 'System.OutOfMemory Exception' was thrown.
Can anybody help !!
ThanksHello, Balla;
the first thing to check is that the ASP.NET Worker process has rights to your Temp folder. You will find where it is by checking your Environment variables.
Use the correct name for the ASP.NET worker process depending on your operating system - LocalMachine\IIS_WPG(Windows 2003 Server) or ASPNET(XP) or (Vista) IIS_IUSRS
To give the IIS_WPG account full control of a folder:
1. Right-click the folder and select 'Properties'.
2. Go to the 'Security' tab and click the 'Add' button.
3. Click the 'Locations' button and select the
computer name. Click 'OK'.
4. Type "IIS_WPG" under the 'Enter the object names to
select' box.
5. Click 'Check Names'. <Your machine name>\IIS_WPG
appears. Click 'OK'.
6. Check 'Full Control' from 'Permissions for IIS_WPG'.
Click 'OK'.
====================
NOTE:
The IIS_WPG includes the LocalService,
System, and NetworkService accounts.
====================
If that is not the issue:
What database driver are you using in the design of your report? Go to Database|Set datasource location and tell me the properties of the database connection.
Do you logon to the database in your code or pass the data to it using Datasets?
Are there subreports in the design? How many are there? What section are they in? What data source does each one use?
Do you have a lot of formulas in the report?
Elaine -
Memory leak when exceptions are thrown?
Hello,
I'm doing a simple database connect with the JDBC Oracle 8.1.6 oci8 drivers on Solaris. It seems whenever I try to repeatedly connect to a database, and an exception is thrown, such as database not found, or wrong password, the program size grows and grows until it runs out of memory. I've narrowed it down to being the getConnection operation as the casue of this memory leak.
Now, if I repeatedly connect successfully, there is no problem, it will run all day, but if there are exceptions thrown, memory leaks. Has anyone else encountered this?
I'll paste a sample program below which shows the problem. Maybe someone can help???
import java.sql.*;
import java.util.*;
import java.io.*;
public class connect extends Thread {
private oracle.jdbc.driver.OracleDriver oDriver = new oracle.jdbc.driver.OracleDriver();
private Connection connection;
* Open a connection to the database
private void connectToDB() {
try {
connection = DriverManager.getConnection ("jdbc:oracle:oci8:@test", "test", "test");
connection.close();
} catch (SQLException e) {
e.printStackTrace();
System.out.println("couldn't connect");
public void run() {
try {
DriverManager.registerDriver(oDriver);
} catch (SQLException e) {}
while(true) {
try {
sleep(1000);
connectToDB();
} catch (InterruptedException ie) {}
public static void main(String[] args) {
connect conn = new connect();
conn.start();
nullTry this:
private void connectToDB() {
try {
connection = DriverManager.getConnection ("jdbc:oracle:oci8:@test", "test", "test");
} catch (SQLException e) {
e.printStackTrace();
System.out.println("couldn't connect");
finally {
connection.close();
null -
EJB5018: An exception was thrown during an ejb invocation on [ResultFacade]
I have a problem to access from application client to methods of session beans
the problem haw to call this method "getcodesresultcampbean("ARTV")"
EJB5018: An exception was thrown during an ejb invocation on [ResultFacade]
javax.ejb.TransactionRolledbackLocalException: Exception thrown from bean: java.lang.NoClassDefFoundError: org/postgresql/jdbc3/Jdbc3PreparedStatement
at com.sun.ejb.containers.BaseContainer.checkExceptionClientTx(BaseContainer.java:3591)
at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:3436)
at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1247)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:192)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:71)
at $Proxy306.findByRefCampagne(Unknown Source)
at com.bellconsulting.praxys.stats.service.StatCampagneBean.getcodesresultcampbean(StatCampagneBean.java:77)
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:589)
at com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1050)
at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:165)
at com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:2766)
at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:3847)
at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:190)
at com.sun.ejb.containers.EJBObjectInvocationHandlerDelegate.invoke(EJBObjectInvocationHandlerDelegate.java:67)
at $Proxy305.getcodesresultcampbean(Unknown Source)
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:589)
at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:121)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:650)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:193)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1705)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1565)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:947)
at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:178)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:717)
at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.dispatch(SocketOrChannelConnectionImpl.java:473)
at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.doWork(SocketOrChannelConnectionImpl.java:1270)
at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:479)
Caused by: java.lang.NoClassDefFoundError: org/postgresql/jdbc3/Jdbc3PreparedStatement
at org.postgresql.jdbc3.Jdbc3Connection.prepareStatement(Jdbc3Connection.java:37)
at org.postgresql.jdbc3.AbstractJdbc3Connection.prepareStatement(AbstractJdbc3Connection.java:266)
at org.postgresql.jdbc2.AbstractJdbc2Connection.prepareStatement(AbstractJdbc2Connection.java:151)
at com.sun.gjc.spi.ConnectionHolder.prepareStatement(ConnectionHolder.java:413)
at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:497)
at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:415)
at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1538)
at org.hibernate.loader.Loader.doQuery(Loader.java:661)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2211)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2095)
at org.hibernate.loader.Loader.list(Loader.java:2090)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:388)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:64)
at com.bellconsulting.praxys.stats.facades.ResultFacade.findByRefCampagne(ResultFacade.java:54)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
**************************code source************** ResultFacade******
package com.bellconsulting.praxys.stats.facades;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import com.bellconsulting.praxys.stats.entities.Result;
* @author idriss
@Stateless
public class ResultFacade implements ResultFacadeLocal {
@PersistenceContext
private EntityManager em;
/** Creates a new instance of ResultFacade */
public ResultFacade() {
public void create(Result result) {
em.persist(result);
public void edit(Result result) {
em.merge(result);
public void destroy(Result result) {
em.merge(result);
em.remove(result);
public Result find(Object pk) {
return (Result) em.find(Result.class, pk);
public List findAll() {
return em.createQuery("select object(o) from Result as o").getResultList();
public List findByRefCampagne (String campaignCode) {
return em.createNamedQuery("Result.findByRefcampagne").setParameter("refcampagne", campaignCode).getResultList();
*****************StatCampagneBean********
package com.bellconsulting.praxys.stats.service;
import com.bellconsulting.praxys.stats.facades.ResultFacadeLocal;
import java.sql.Date;
import javax.ejb.EJB;
import javax.ejb.Stateful;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import com.bellconsulting.praxys.stats.entities.Campaign;
import com.bellconsulting.praxys.stats.entities.Result;
import com.bellconsulting.praxys.stats.facades.CampaignFacadeLocal;
import java.util.Iterator;
import java.util.List;
* @author idriss
@Stateful
public class StatCampagneBean implements StatCampagneRemote {
@EJB
private CampaignFacadeLocal campaignFacade;
private @EJB ResultFacadeLocal resultFacade;
private String _campagnecode;
/** Creates a new instance of StatCampagneBean */
public StatCampagneBean() {
public StatCampagneBean(String campagnecode)
this._campagnecode= campagnecode;
@PersistenceContext
private EntityManager _manager;
public int getnbreOKbean(String codecampagne) {
//TODO implement getnbreOK
Campaign camp= _manager.find(Campaign.class,codecampagne);
return camp.getNbRepPositive();
public void statCodesResultats(String nomcamp, String codecamp, Date datedebut, Date datefin) {
//TODO implement statCodesResultats
public String[ ] getcodesresultcampbean(String codecamp) {
//TODO implement getcodesresultcampbean
// _manager.getTransaction().begin();
/* EntityManagerFactory emf = Persistence.createEntityManagerFactory("Result");
EntityManager em = emf.createEntityManager();
String querystring = "select object(r) from Result r"+" where r.refcampagne = ?1";
Query query =em.createQuery(querystring).setParameter(1,codecamp);
*for (Result r : coderesultList)
coderesult[j++]= r.getResultPK().getCode().toString();
// List<Result> coderesultList = query.getResultList();
List<Result> coderesultList = resultFacade.findByRefCampagne(codecamp);
Iterator<Result> itr = coderesultList.iterator();
String[]codesresult =null;
int j= 0;
while (itr.hasNext()){
codesresult[j++] =itr.next().getResultPK().getCode().toString();
// _manager.getTransaction().commit();
return codesresult;
*********************Application client *************
package application.praxys;
import com.bellconsulting.praxys.stats.service.StatCampagneRemote;
import javax.swing.JOptionPane;
import stats.praxys.*;
* @author idriss
public class Main {
/** Creates a new instance of Main */
public Main() {
* @param args the command line arguments
public static void main(String[] args) {
// TODO code application logic here
// InitialContext ctx;
String[] nbreok =null ;
int c =0;
/* try {
ctx = new InitialContext();
StatCampagneRemote simpleSession = (StatCampagneRemote) ctx.lookup(StatCampagneRemote.class.getName());
nbreok = simpleSession.getnbreOK("ARTV");
System.out.println("voici un resultaaaaaaaaaaaaaaaaaaaaa"+" "+nbreok);
} catch (NamingException ex)
TeleVenteServiceLocator tvLocator = new TeleVenteServiceLocator();
StatCampagneRemote statCampagneBean = (StatCampagneRemote)tvLocator.getCampaignService();
JOptionPane.showMessageDialog(null, "dfsdfsdfsfsq");
nbreok=statCampagneBean.getcodesresultcampbean("ARTV");
//nbreok =statCampagneBean.getnbreOKbean("ARTV");
System.out.println("voici un resultaaaaaaaaaaaaaaaaaaaaa "+ nbreok[1]);
JOptionPane.showMessageDialog(null, "dfsdfsdfsfsq"+nbreok[2]);
***************Result entity bean*********
package com.bellconsulting.praxys.stats.entities;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
* Entity class Result
* @author idriss
@Entity
@Table(name = "result")
@NamedQueries( {
@NamedQuery(name = "Result.findByCode", query = "SELECT r FROM Result r WHERE r.resultPK.code = :code"),
@NamedQuery(name = "Result.findByLibelle", query = "SELECT r FROM Result r WHERE r.libelle = :libelle"),
@NamedQuery(name = "Result.findByPriorite", query = "SELECT r FROM Result r WHERE r.priorite = :priorite"),
@NamedQuery(name = "Result.findByPrix", query = "SELECT r FROM Result r WHERE r.prix = :prix"),
@NamedQuery(name = "Result.findByResType", query = "SELECT r FROM Result r WHERE r.resType = :resType"),
@NamedQuery(name = "Result.findByRefcampagne", query = "SELECT r FROM Result r WHERE r.resultPK.refcampagne = :refcampagne"),
@NamedQuery(name = "Result.findByRetValue", query = "SELECT r FROM Result r WHERE r.retValue = :retValue"),
@NamedQuery(name = "Result.findByRetUnit", query = "SELECT r FROM Result r WHERE r.retUnit = :retUnit")
public class Result implements Serializable {
* EmbeddedId primary key field
@EmbeddedId
protected ResultPK resultPK;
@Column(name = "libelle")
private String libelle;
@Column(name = "priorite", nullable = false)
private int priorite;
@Column(name = "prix", nullable = false)
private float prix;
@Column(name = "resType")
private Integer resType;
@Column(name = "retValue")
private Integer retValue;
@Column(name = "retUnit")
private String retUnit;
@JoinColumn(name = "refcampagne", referencedColumnName = "code", insertable = false, updatable = false)
@ManyToOne
private Campaign campaign;
/** Creates a new instance of Result */
public Result() {
* Creates a new instance of Result with the specified values.
* @param resultPK the resultPK of the Result
public Result(ResultPK resultPK) {
this.resultPK = resultPK;
* Creates a new instance of Result with the specified values.
* @param resultPK the resultPK of the Result
* @param priorite the priorite of the Result
* @param prix the prix of the Result
public Result(ResultPK resultPK, int priorite, float prix) {
this.resultPK = resultPK;
this.priorite = priorite;
this.prix = prix;
* Creates a new instance of ResultPK with the specified values.
* @param refcampagne the refcampagne of the ResultPK
* @param code the code of the ResultPK
public Result(String refcampagne, String code) {
this.resultPK = new ResultPK(refcampagne, code);
* Gets the resultPK of this Result.
* @return the resultPK
public ResultPK getResultPK() {
return this.resultPK;
* Sets the resultPK of this Result to the specified value.
* @param resultPK the new resultPK
public void setResultPK(ResultPK resultPK) {
this.resultPK = resultPK;
* Gets the libelle of this Result.
* @return the libelle
public String getLibelle() {
return this.libelle;
* Sets the libelle of this Result to the specified value.
* @param libelle the new libelle
public void setLibelle(String libelle) {
this.libelle = libelle;
* Gets the priorite of this Result.
* @return the priorite
public int getPriorite() {
return this.priorite;
* Sets the priorite of this Result to the specified value.
* @param priorite the new priorite
public void setPriorite(int priorite) {
this.priorite = priorite;
* Gets the prix of this Result.
* @return the prix
public float getPrix() {
return this.prix;
* Sets the prix of this Result to the specified value.
* @param prix the new prix
public void setPrix(float prix) {
this.prix = prix;
* Gets the resType of this Result.
* @return the resType
public Integer getResType() {
return this.resType;
* Sets the resType of this Result to the specified value.
* @param resType the new resType
public void setResType(Integer resType) {
this.resType = resType;
* Gets the retValue of this Result.
* @return the retValue
public Integer getRetValue() {
return this.retValue;
* Sets the retValue of this Result to the specified value.
* @param retValue the new retValue
public void setRetValue(Integer retValue) {
this.retValue = retValue;
* Gets the retUnit of this Result.
* @return the retUnit
public String getRetUnit() {
return this.retUnit;
* Sets the retUnit of this Result to the specified value.
* @param retUnit the new retUnit
public void setRetUnit(String retUnit) {
this.retUnit = retUnit;
* Gets the campaign of this Result.
* @return the campaign
public Campaign getCampaign() {
return this.campaign;
* Sets the campaign of this Result to the specified value.
* @param campaign the new campaign
public void setCampaign(Campaign campaign) {
this.campaign = campaign;
* Returns a hash code value for the object. This implementation computes
* a hash code value based on the id fields in this object.
* @return a hash code value for this object.
@Override
public int hashCode() {
int hash = 0;
hash += (this.resultPK != null ? this.resultPK.hashCode() : 0);
return hash;
* Determines whether another object is equal to this Result. The result is
* <code>true</code> if and only if the argument is not null and is a Result object that
* has the same id field values as this object.
* @param object the reference object with which to compare
* @return <code>true</code> if this object is the same as the argument;
* <code>false</code> otherwise.
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Result)) {
return false;
Result other = (Result)object;
if (this.resultPK != other.resultPK && (this.resultPK == null || !this.resultPK.equals(other.resultPK))) return false;
return true;
* Returns a string representation of the object. This implementation constructs
* that representation based on the id fields.
* @return a string representation of the object.
@Override
public String toString() {
return "com.bellconsulting.praxys.stats.entities.Result[resultPK=" + resultPK + "]";
Message was edited by:
081283Try posting this on the EJB forum:
http://forum.java.sun.com/forum.jspa?forumID=13 -
NO EXCEPTION IS THROWN FROM THE PERSIST
We are using Glassfish and MySQL. When we do a persist with a bad object/query, internal DB errors are NOT being reported back to the caller in any way, but Glassfish knows that the error occurred. Here is a schematic of the situation:
Glassfish starts a CMP transaction and calls our bean
Inside the bean we have code like this:
obj = (a new object that will cause a DB error when persisted)
try {
entityManager.persist(obj)
} catch (Throwable t) {
report to the user that the throwable happened
bean returns
Glassfish manages CMP transaction
What we see is the following:
- The persist has an internal failure and generates error messages in the Glassfish system.log file.
- NO EXCEPTION IS THROWN FROM THE PERSIST, so the application code thinks that the persist completed correctly
- At the end of the bean operation, Glassfish (correctly) rolls back the transaction.
At the user level the result is that the request succeeds but nothing is put into the Database!
We are not asking about the cause of the DB error. From reading the system log we know what happened and can fix it. Our problem is that problems in our field-deployed systems cannot be detected by the application code so failures cannot be reported to the user.
The critical question is:
Is there a way for the application code in the bean to see that an error occurred?
By the way, we also have a secondary question: Why is the erroneous persist tried 6 times before deciding it won't work? Is there an option somewhere that says to try 6 times?
The Exception as reported in the system log (only one copy of it) is included below.
[#|2008-10-22T08:32:25.992-0400|WARNING|sun-appserver9.1|oracle.toplink.essentials.session.file:/opt/localVendors/glassfish/tems-glassfish-v1/domains/domain1/applications/j2ee-apps/im-app/im-ejb_jar/-local|_ThreadID=138;_ThreadName=p: thread-pool-1; w: 156;_RequestID=509e7043-21bb-410c-b795-19e9953afeec;|
Local Exception Stack:
Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.0.1 (Build b04-fcs (04/11/2008))): oracle.toplink.essentials.exceptions.DatabaseException
Internal Exception: com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException: Column 'STATIONCODE' cannot be null
Error Code: 1048
Call: INSERT INTO <exact operation and table contents elided from this trace file>
at oracle.toplink.essentials.exceptions.DatabaseException.sqlException(DatabaseException.java:311)
at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:654)
at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.executeNoSelect(DatabaseAccessor.java:703)
at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:492)
at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:452)
at oracle.toplink.essentials.internal.sessions.AbstractSession.executeCall(AbstractSession.java:690)
at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:228)
at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:214)
at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.insertObject(DatasourceCallQueryMechanism.java:346)
at oracle.toplink.essentials.internal.queryframework.StatementQueryMechanism.insertObject(StatementQueryMechanism.java:191)
at oracle.toplink.essentials.internal.queryframework.StatementQueryMechanism.insertObject(StatementQueryMechanism.java:205)
at oracle.toplink.essentials.internal.queryframework.DatabaseQueryMechanism.insertObjectForWrite(DatabaseQueryMechanism.java:564)
at oracle.toplink.essentials.queryframework.InsertObjectQuery.executeCommit(InsertObjectQuery.java:89)
at oracle.toplink.essentials.internal.queryframework.DatabaseQueryMechanism.performUserDefinedWrite(DatabaseQueryMechanism.java:750)
at oracle.toplink.essentials.internal.queryframework.DatabaseQueryMechanism.performUserDefinedInsert(DatabaseQueryMechanism.java:714)
at oracle.toplink.essentials.internal.queryframework.DatabaseQueryMechanism.insertObjectForWriteWithChangeSet(DatabaseQueryMechanism.java:602)
at oracle.toplink.essentials.queryframework.WriteObjectQuery.executeCommitWithChangeSet(WriteObjectQuery.java:162)
at oracle.toplink.essentials.internal.queryframework.DatabaseQueryMechanism.executeWriteWithChangeSet(DatabaseQueryMechanism.java:390)
at oracle.toplink.essentials.queryframework.WriteObjectQuery.executeDatabaseQuery(WriteObjectQuery.java:109)
at oracle.toplink.essentials.queryframework.DatabaseQuery.execute(DatabaseQuery.java:628)
at oracle.toplink.essentials.queryframework.DatabaseQuery.executeInUnitOfWork(DatabaseQuery.java:555)
at oracle.toplink.essentials.queryframework.ObjectLevelModifyQuery.executeInUnitOfWorkObjectLevelModifyQuery(ObjectLevelModifyQuery.java:138)
at oracle.toplink.essentials.queryframework.ObjectLevelModifyQuery.executeInUnitOfWork(ObjectLevelModifyQuery.java:110)
at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2233)
at oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:952)
at oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:909)
at oracle.toplink.essentials.internal.sessions.CommitManager.commitNewObjectsForClassWithChangeSet(CommitManager.java:269)
at oracle.toplink.essentials.internal.sessions.CommitManager.commitAllObjectsWithChangeSet(CommitManager.java:190)
at oracle.toplink.essentials.internal.sessions.AbstractSession.writeAllObjectsWithChangeSet(AbstractSession.java:2657)
at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.commitToDatabase(UnitOfWorkImpl.java:1044)
at oracle.toplink.essentials.internal.ejb.cmp3.base.RepeatableWriteUnitOfWork.commitToDatabase(RepeatableWriteUnitOfWork.java:403)
at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.commitToDatabaseWithChangeSet(UnitOfWorkImpl.java:1126)
at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.issueSQLbeforeCompletion(UnitOfWorkImpl.java:2443)
at oracle.toplink.essentials.internal.ejb.cmp3.base.RepeatableWriteUnitOfWork.issueSQLbeforeCompletion(RepeatableWriteUnitOfWork.java:202)
at oracle.toplink.essentials.transaction.AbstractSynchronizationListener.beforeCompletion(AbstractSynchronizationListener.java:131)
at oracle.toplink.essentials.transaction.JTASynchronizationListener.beforeCompletion(JTASynchronizationListener.java:91)
at com.sun.jts.jta.SynchronizationImpl.before_completion(SynchronizationImpl.java:99)
at com.sun.jts.CosTransactions.RegisteredSyncs.distributeBefore(RegisteredSyncs.java:158)
at com.sun.jts.CosTransactions.TopCoordinator.beforeCompletion(TopCoordinator.java:2548)
at com.sun.jts.CosTransactions.CoordinatorTerm.commit(CoordinatorTerm.java:278)
at com.sun.jts.CosTransactions.TerminatorImpl.commit(TerminatorImpl.java:249)
at com.sun.jts.CosTransactions.CurrentImpl.commit(CurrentImpl.java:623)
at com.sun.jts.jta.TransactionManagerImpl.commit(TransactionManagerImpl.java:309)
at com.sun.enterprise.distributedtx.J2EETransactionManagerImpl.commit(J2EETransactionManagerImpl.java:1030)
at com.sun.enterprise.distributedtx.J2EETransactionManagerOpt.commit(J2EETransactionManagerOpt.java:397)
at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:3792)
at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:3571)
at com.sun.ejb.containers.MessageBeanContainer.afterMessageDeliveryInternal(MessageBeanContainer.java:1226)
at com.sun.ejb.containers.MessageBeanContainer.afterMessageDelivery(MessageBeanContainer.java:1197)
at com.sun.ejb.containers.MessageBeanListenerImpl.afterMessageDelivery(MessageBeanListenerImpl.java:79)
at com.sun.enterprise.connectors.inflow.MessageEndpointInvocationHandler.invoke(MessageEndpointInvocationHandler.java:139)
at $Proxy364.afterDelivery(Unknown Source)
at com.sun.messaging.jms.ra.OnMessageRunner.run(OnMessageRunner.java:324)
at com.sun.enterprise.connectors.work.OneWork.doWork(OneWork.java:76)
at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:555)
Caused by: com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException: Column 'STATIONCODE' cannot be null
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:931)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2985)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1631)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1723)
at com.mysql.jdbc.Connection.execSQL(Connection.java:3283)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1332)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1604)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1519)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1504)
at com.mysql.jdbc.jdbc2.optional.PreparedStatementWrapper.executeUpdate(PreparedStatementWrapper.java:840)
at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:647)
... 53 more
|#]This is because the persistent context is not synchronized with the database until the commit is being executed.
You might 'force' this by calling entityManager.flush() right after the call to persist(...).
Or you register a transaction synchronizer and check the transaction status on afeterCompletion().
- Roy -
How to fail messsages when timeout exception is thrown in BPM?
Hi
In my BPM, if the time out exception is thrown in BPM, in SXMB_MONI, all the inbound messages' staus is 'processed sucessfully' ? How can I make the message fail? With a red flag or anything indicating exception?
In my design I used deadline branch to throw time out exception.And in the exception branch I used control step to cancel the process.Hi,
In my design I used deadline branch to throw time out exception.And in the exception branch I used control step to cancel the process
If this is what you have designed then increasing the timeout using the above mentioned blogs doesn't seem to be logical:) (BPM will throw the error when the deadline is meet....can't understand how by increasing timeout will help you)....instead of increasing the timeout you can increase the time limit mentioned in the deadline branch itself to ensure that your message will be processed in that particular time limit.
Since you have reached the timeout it means that desired message processing has failed so better you raise an alert instead of going for a increase in timeout....increasing timeout decreases performance...
Regards,
Abhishek. -
Exception is thrown "mydb is not bound"(needs urgent help)
We r three students and our final project is a BPM(Business peocess Management)system.
BPM is actually a workflow system(managing the business processes)and all the rules and constraints are applied from the Rule Management System.
we have started the implementation, and therefore we need some help related to the implementation.
We r using EJB2.0 with JBuilder9, JBoss3.2 as the application server and tomcate as the web server.
problem:
I want to create manual database connection using DataSource,
I am using mysql and database name is mydb.
I have done all the reqiured configration of mysql with Joss and it is working.
After getting the initial context, when i try to lookup the datasource, exception is thrown "mydb is not bound"
Initial context is correct because i have tried entity beans asd it works well.
code is
Hashtable contextValues = new Hashtable();
contextValues.put(Context.PROVIDER_URL, "jnp://loopback:1099");
contextValues.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
Context context = new InitialContext(contextValues);
context.lookup("java://mydb");
Kindly help me if u find time,
regards!try java:comp/env/jdbc/mydb or java:comp/env/mydb
-
What should I do to ensure that a certian part of my code is always excuted whether an exception is thrown or not?
Put it in a finally section and the code that might throw in the preceding try block.
Chuck
Maybe you are looking for
-
How to increas the width of the Table in OBIEE Report
Hi , I am creating a OBIEE report, the report has table and 30 column in it. When I am viewing the report in an excel file , its appearing good but the width of the table is so small if I am viewing the same in internet explorer/PDF .I dont know how
-
HT4059 How can I convert a pdf into an ibook?
How can I convert a pdf into an ibook? I've got a host of PDF's that I'd like to bring into the software but need a quick and simple tool to pull them through. Any ideas?
-
Error in Local Message System: Error when opening an RFC connection Message
Hi Gurus, We are not able to create support messages in our ECC production system but it can created in Development and Quality. Support message created appears in solution manager system. ECC System displays error message as Error in Local Message S
-
How do I sort alphabetically xfce menu entries?
Hi, all. Just finishing an install and want my xfce4 menu entries to be sorted automatically and updated if I add an application. I've seen this documented somewhere, but can't find it, now. Does anyone know how to sort the menu? Cheers, Chris.
-
What GB would you recommend?
I was wondering if anyone knows data well enough to recommend what GB I should get for the iPod 5th gen because I am getting a newer one. I have about 120 songs. I have about 400 pitures I usually don't go over dowloading 20 apps. I don't buy any new