Problem about using reflection
//this code works fine
Method method = label.getClass().getMethod( "setToolTipText", new Class[]{String.class} );
method.invoke( label, new Object[]{"message"} );
//but this code doesnot work, give me error "NoSuchMenthodException : addMouseListener
Method method = label.getClass().getMethod( "addMouseListener", new Class[]{MyMouseListener.class} );
method.invoke( label, new Object[]{myMouseListener} );
** MyMouseListener extends MouseAdapter
Should work ok:
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
public class Test {
static class MyObject {}
public static void main(String[] args) throws Exception {
Class c = Test.class;
Class[] parameterTypes = new Class[] {Integer.class, MyObject.class};
try {
Object[] arguments = new Object[] {new Integer(2), new MyObject()};
Method met = c.getMethod("myMethod", parameterTypes);
met.invoke(new Test(), arguments);
} catch (NoSuchMethodException e) {
System.out.println(e);
} catch (IllegalAccessException e) {
System.out.println(e);
} catch (InvocationTargetException e) {
System.out.println(e);
public void myMethod(Integer var1, MyObject mobj) {
System.out.println("myMethod");
}
Similar Messages
-
Problem about using Oracle Form 6i to connect Oracle Database 10g express.
Sorry to interrupt all of you.
I have encountered a problem about using Oracle Form 6i to connect Oracle Database 10g express.
As I would like to
I use Oracle Net8 Easy Config to create a connection.
According to "tnsnames.ora", the paramater of connection is as follows;
XE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
(CONNECT_DATA = (SID = XE))
Unfortunately, when I use Oracle Net8 Easy Config to test the connection, an error message is prompted as follows:
Connecting....
The test did not succeed.
ORA-03106: fatal two-task communication protocol error
There may be an error in the fields entered
or the server may not be ready for a connection.
You can check the server and retry, or continue.
After I google it, I still have no idea how to solve the problem. I would like to ask, could anyone mind providing some hints or solution to address the issues.
Thanks for your assistance in advance.I don't believe the Net8 Easy Config (NEC) will create a compatible entry in the tnsnames.ora. I have Forms 6i running successfully against a 10g Express database, but I did not use the NEC - I created the entry myself. Here is the entry I use:
XE=
(DESCRIPTION=
(ADDRESS=
(PROTOCOL=TCP)
(HOST=<<servername or IP address>>)
(PORT=1521)
(CONNECT_DATA=
(SERVER=dedicated)
(SERVICE_NAME=XE)
)Hope this helps,
Craig B-)
If someone's response is helpful or correct, please mark it accordingly. -
Update problem when using reflection
We have an issue when updating objects. The values are not updated in the DB when we set the values in the domain class using reflection. However when we explicitly set the values using the setter methods, update is ok.
Here is the code for the reflection mechanism:
UnitOfWork uow = session.acquireUnitOfWork();
//domain class which needs to be persisted
Student student = new Student();
//get the clone
Student studentClone = (Student) uow.registerObject(student);
//copy the values from the value object into the
// domain class using reflection
studentClone.setVo(studentVo);
uow.commit();
The setVo method uses reflection to set the values (using invokeMethod). The values are set properly in the domain object. But the values are not updated when we do the commit.
However, if we explicitly set the values in the clone using the "setter" methods, update is okay. So this code works fine.
UnitOfWork uow = session.acquireUnitOfWork();
Student student = new Student();
Student studentClone = (Student) uow.registerObject(student);
studentClone.setName("NBA"); //set the value of name
uow.commit();
Any ideas would be appreciated...
Thanks muchTopLink 10.1.3 tracks changes through working and backup copies by default, so even if you set your changes through reflection they should be picked up. If you were using CMP 2 or EJB 3 or explicitly enabled AttributeChangeTracking, then changes set through reflective field access could be missed. In this case you should use the set methods through reflection, instead of the field directly.
I would check your code that set the changes through reflection, perhaps it is not working as you expect. Check the state of the object after applying the changes and verify they were actually set. Also ensure that you are changing the UnitOfWork clone, not the original object. -
Problem getMethod using reflection
i have problem when i try to get method using java reflection, this my source code :
1. this my bean class
public class bean1 {
public bean1() {
private String test;
public String getTest() {
return test;
public void setTest(String test) {
this.test = test;
2. this is method to set value to mehod
public class TestReflection {
void setValueToMethod(String className,String methodName,String value) {
try {
classNames = this.getClass().forName(className);
} catch (ClassNotFoundException e) {
e.printStackTrace();
Class[] classArg = { classNames };
try {
aMethod = classNames.getMethod(methodName,classArg);
catch (Exception e) {
e.printStackTrace();
try {
Object[] nomeArgs = { new String[] {value} };
aMethod.invoke(classNames ,nomeArgs);
catch(InvocationTargetException e) {
catch(IllegalAccessException e) {
3.
public static void main(String[] args) {
TestReflection aTestReflection= new TestReflection();
aTestReflection.setValueToMethod("bean1","setTest","hallo");
but in Runtime I find this error :
java.lang.NoSuchMethodException: setTest
at java.lang.Class.getDeclaredMethod(Class.java:1156)
at TestReflection.setValueToMethod(TestReflection.java:170)
at main(test.java:20)
Hit uncaught exception java.lang.NullPointerException
java.lang.NullPointerException
at TestReflection.setValueToMethod(TestReflection.java:180)
at main(test.java:20) Exception in thread "main"replace
Class[] classArg = { classNames };with
Class[] classArg = { String.class }; -
Problem about using GOS to store business document!
Hi Everyone,
I am using Generic Object services toolbar to archive document.
When I attach thru Create Attachment button and display by clicking on the attachments list, it is showing Creator name and the
real name of document .But If I attach thru Store Business document and display it thru attachment list, Creator name and the document name is blank. But client want to see the creator name also in the display.
Any one has idea about this?We need to have a document's name (i.e. name of the uploaded file) displayed in the "Attachment list" of GOS,We also need to be able to retrieve this file name programmatically via a function call or a class method .
Any Your help is much appreciated.
Thanks,
lexianHello Sachin:
Thank you very much!
Now I will tell you the procedure:
For example,enter tocode ME53,via Generic Object Services(GOS) menu path "Create -> Store business document", Then upload a document from my pc.
If what my offer is not correct ,Please tell me.
Thanks a lot!
lexian!
Edited by: le xian on Dec 3, 2010 2:47 AM -
Problem about using JTextPane in JScrollPane
I put a JTextPane in a JScrollPane.
But when I reduce the window size of the JScrollPane with my mouse, the text line in the JTextPane is broken to newlines automatically due to the reduced window size.
How to prevent the text lines breaking in this situation!OK, so the words are wrapping when they're not suppose to. How are you adding your JTextPane to the JScrollpane? Also, does setting a preferred size or a minimum size on the JTextPane help?
That's an odd problem. In looking at the API I see that JTextArea and JTextPane are both derived (eventually) from JTextComponent. But the line wrap option is only in JTextArea. This makes me think that it would be possible to overload paint method of the JTextPane. But wow! That would be messy.
I'll keep thinking about it. Let us know if you find a solution. -
Problem about using xmlbean as return parameter in workshop 9.2 jsr-181 WS
Hi
I met a problem with the jsr-181 web service's return parameters in workshop 9.2.
I wrote a web service which will return a jax-rpc-style javabean as return parameter. This javabean contained three xmlbean objects fields. So, the client can get those xmlbean objects when invoking the web service.
But I got the error like the following:
A java class "..." is being used as a parameter or return type that contains a property of field that is an xmlbean "...", this not allowed.
Maybe workshop 9.2 does not support xmlbean object as the returned javabean's field. But why, i can use that in the workshop 8.1. why workshop 9.2 does not support them.
And how can i do if the client want to get the three xmlbean objects when invoking the web service.
Thanks,
XuehHi Xueh
I got it confirmed from engineering that we do NOT support any use of XmlBeans in a Pojo complex type.
The workaround is to create a top-level xmlbean type that references the other xmlbean types.
Thanks
Vimala
P.S: There seems to be some complexities involved in mapping a JAX RPC type (POJO) to a XMLBean Type. But we do have a internal bug that is tracking this issue. -
Problem About using AMFPHP 1.2.1 Version
Hi Everybody,
First of all I would like to thanks to all of the developers
who open the Flash Remoting for open source source world.
So I download the AMFPHP 1.2.1 version. So I install the
AMFPHP to my local environment and test the gateway by accessing
the gateway.php. Everything is work fine. Then I move to the hello
world tutorial and test is ok in my local environment(
http://localhost).
Then I upload all the files to the live server and test the
gateway.php. it work fine.
Then I change my gateway url to
http://eallth.com/flashservices/gateway.php
in flash movie and test the same flash file but unfortunately it
didn't work. In flash output panel it gives me an error "Error
opening URL "
http://eallth.com/flashservices/gateway.php"".
I am using Macromedia Flash Professional 8. But I coudn't
solve the problem. There is no error in the NetConnection Debugger
panel.
For your reference and test purpose I list the urls to Flash
remoting gateway and url to download ZIP file which include the php
class file and amfphp_prod_test.fla file. Please check these URLS.
URL to Flsh Remoting gateway:-
http://eallth.com/flashservices/gateway.php
URL to Service Browser:-
http://eallth.com/flashservices/browser/
URL to Services directory:-
http://eallth.com/flashservices/services/TestService.php
URL to Download ZIP file (contains
amfphp_prod_test.fla,TestService.php in services folder):-
http://eallth.com/amfphp_test.zip
Please help me to solve this problem. thanks.
Anuruddhahi,
i have an idea where the problem could come from.
I'm working on a project with flash 8/amfphp/mysql.
In apache : "Listen 192.3.3.30:80"
"Listen 127.0.0.1:80"
in fla : gateway :
http://192.3.3.30:80 (localhost
works fine too)
I took a look at your files. indeed, there's a problem with
the gateway, even it's functioning.
You've tried the IP address instead of eallth.com ?
What happens if you try to put "localhost" back again as
gateway?
I tried such things in the past but don't remember how flash
reacted.
What's your apache config? ( I had troubles with that
before)?
Do you do the test online? Or locally with online gateway?
Oh, I forgot another thing... Replace all " " with ' ' (
double to simple). That can help too.
tell me -
Strange problem about using JSTL
Dear all,
I've got a strange proble when using JSTL with tomcat.
I've got two strings as the following:
String id_string = (String)session.getAttribute("user_id");
System.out.println(id_string);
String valid_user = (String)session.getAttribute("valid_user");
The "println" call tells me that "id_string" has a valid value.
But when I use it like this in the same page:
<a href="springapp/blog.htm?id=<c:out value=${ id_string " /><c:out value="${ valid_user }" />" >test
I can only get "valid_user"'s value.
"id_string" is not print out to the page.
Would anyone please help me out?
Any help would appreciated and thanks in advance.
Edited by: haoniukun on Sep 15, 2007 9:57 PMhaoniukun wrote:
String id_string = (String)session.getAttribute("user_id");
<a href="springapp/blog.htm?id=<c:out value=${ id_string " /><c:out value="${ valid_user }" />" >test
I can only get "valid_user"'s value.
"id_string" is not print out to the page.Your session attribute is called "user_id" which you're fetching correctly earlier. But in the <c:out> tag, you're trying to read "id_string" which is the name of your local variable and not in any scope. "valid_user" works because you've named your local variable the same as your scope attribute, so the value being printed out is from the scope and not your local variable. As far as I know, JSTL doesn't work with local scriptlet variables, it only access variables in the four scopes: page, request, session and application
You should use the <c:set> tag to set a variable value. Try not to mix scriptlets and tags, it's frowned upon and will probably cause you problems later. -
Problem about use OCFS2 install clusterware
hi,all :
i set two disk use OCFS2, one for OCR, another for voting disk,i format the two disk on rac1 ,and mout on rac1 and rac2
[root@rac2 ocfs2]# mkfs.ocfs2 -b 4K -C 32K -N 2 -L ora_votingdisk /dev/sdb1
[root@rac2 ocfs2]# mkdir /opt/votingdisk
[root@rac2 ocfs2]# chown oracle.oinstall /opt/votingdisk/
[root@rac2 ocfs2]# mount -t ocfs2 /dev/sdb1 /opt/votingdisk/
[root@rac2 votingdisk]# mkfs.ocfs2 -b 4K -C 32K -N 2 -L ora_OCR /dev/sdc1
[root@rac2 votingdisk]# mkdir /opt/OCRfile
[root@rac2 votingdisk]# chown oracle.oinstall /opt/OCRfile
[root@rac2 votingdisk]# mount -t ocfs2 /dev/sdc1 /opt/OCRfile/and i use response file to installl crs
n_storageTypeOCR=2
s_ocrpartitionlocation="/opt/OCRfile"
s_ocrMirrorLocation=""
n_storageTypeVDSK=2
s_votingdisklocation="/opt/votingdisk"and install successed,but when i run root.sh ,both fail on each node,and here is error info,i do not know why?
[root@rac2 opt]# /opt/ora/product/10.2.0/crs_1/root.sh
WARNING: directory '/opt/ora/product/10.2.0' is not owned by root
WARNING: directory '/opt/ora/product' is not owned by root
WARNING: directory '/opt/ora' is not owned by root
Checking to see if Oracle CRS stack is already configured
/etc/oracle does not exist. Creating it now.
Setting the permissions on OCR backup directory
Setting up NS directories
PROT-1: Failed to initialize ocrconfig
Failed to upgrade Oracle Cluster Registry configurationand i checked the log output
[root@rac2 client]# cat ocrconfig_8035.log
Oracle Database 10g CRS Release 10.2.0.1.0 Production Copyright 1996, 2005 Oracle. All rights reserved.
2011-07-29 23:26:53.612: [ OCRCONF][5408976]ocrconfig starts...
2011-07-29 23:26:53.613: [ OCRCONF][5408976]Upgrading OCR data
2011-07-29 23:26:53.614: [ OCROSD][5408976]utopen:6'': OCR location /opt/OCRfile configured is not valid storage type. Return code [37].
2011-07-29 23:26:53.614: [ OCRRAW][5408976]proprinit: Could not open raw device
2011-07-29 23:26:53.614: [ default][5408976]a_init:7!: Backend init unsuccessful : [37]
2011-07-29 23:26:53.615: [ OCRCONF][5408976]Exporting OCR data to [OCRUPGRADEFILE]
2011-07-29 23:26:53.615: [ OCRAPI][5408976]a_init:7!: Backend init unsuccessful : [33]
2011-07-29 23:26:53.615: [ OCRCONF][5408976]There was no previous version of OCR. error:[PROC-33: Oracle Cluster Registry is not configured]
2011-07-29 23:26:53.615: [ OCROSD][5408976]utopen:6'': OCR location /opt/OCRfile configured is not valid storage type. Return code [37].
2011-07-29 23:26:53.615: [ OCRRAW][5408976]proprinit: Could not open raw device
2011-07-29 23:26:53.615: [ default][5408976]a_init:7!: Backend init unsuccessful : [37]
2011-07-29 23:26:53.616: [ OCROSD][5408976]utopen:6'': OCR location /opt/OCRfile configured is not valid storage type. Return code [37].
2011-07-29 23:26:53.616: [ OCRRAW][5408976]proprinit: Could not open raw device
2011-07-29 23:26:53.616: [ OCRAPI][5408976]a_init:6b!: Backend init unsuccessful : [37]
2011-07-29 23:26:53.616: [ OCRCONF][5408976]Failed to initialized OCR context. error:[PROC-37: Oracle Cluster Registry does not support the storage type configured]
2011-07-29 23:26:53.617: [ OCRCONF][5408976]Exiting [status=failed]...Edited by: 859340 on 2011-7-29 上午12:59instead this dot ( . ) on oracle.oinstall
[root@rac2 votingdisk]# chown oracle.oinstall /opt/OCRfileuse colon ( : )
[root@rac2 votingdisk]# chown oracle:oinstall /opt/OCRfile -
Problem about using the airplay?
I want to know that is that the airplay can connect to the klipsch gallery G-17 by using the ipad apps just to play the video sound like example good player apps?
Sorry, I don't fully understand your question. Apps do not need to support AirPlay to play the audio. Basically an Airplay speaker is a wireless speaker that replaces your iPads internal speaker. Any audio played on an iPad will be played on the connected wireless speaker whether it is an AirPlay speaker or a Bluetooth speaker. So once you have the Airplay speaker on your network and connected to the iPad the audio from any app in use on the iPad will play through the speaker.
With video you may experiance a little lag between the video and audio with AirPlay speakers. Bluetooth speakers handle video apps a little better. -
Little problem about using dispatchertimer on WP app developing
First of all Hello to everyone,
I m developing a little game on VS 2013 for windows phone. I m using dispatchertimer for show error messege on screen every 30 seconds. I m using dispatchertimer for this. But error message doesn't show up on screen after 30 seconds, i need to touch screen
after 30 seconds for error message show up. How can i fix it ? I need to make this error message show up after 30 seconds without any touch.
Btw I've created, defined dispatchertimer in "OnNavigatedTo(NavigationEventArgs e)" function...Hi PauBM,
But error message doesn't show up on screen after 30 seconds, i need to touch screen after 30 seconds for error message show up.
-> Sounds like you have to touch screen to start the timer...Not sure how you implement the function but I would suggest you share your code snippet with us. As Ken told, using dispatcher.begininvoke() to show the error is also necessary if your dispatcherTimer
is not in UI thread:
RunAsync method
Basically here is a simple code snippet that can help you:
DispatcherTimer = new DispatcherTimer { Interval = new TimeSpan(0, 0, 0, 0, 30) };
DispatcherTimer.Tick += DispatcherTimerTick;
DispatcherTimer.Start();
In the dispatcherTimerTick method:
private void DispatcherTimerTick(object sender, object e)
//display your error here
//if the dispatcherTimer runs in a non-UI threads, use
dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
//display error here
--James
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.
Click
HERE to participate the survey. -
Hi all:
When I use the applet, i met a strange thing.
I write a very simple applet in html:
<html>
<body>
Here comes my first applet:
<br>
<applet name="hello" id="hello" code="HelloWorld.class" width=650 height=500></applet>
</body>
</html>
this result in IE is a grey box and show message is "load: class helloworld not found".
But when i use the following html:
<html>
<body>
Here comes my first applet:
<br><object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" height="300" width="450" >
<param name="code" value="HelloWorld.class" />
</object>
</body>
</html>
The applet can work correctly.
Dose any one know the diff between useing "<applet>" and "<object>".
My IE version is 6.0.2900.2180.
My Java RE is 1.4.2_12.
Thanks.
FangHuacheck this http://java.sun.com/j2se/1.4.2/docs/guide/plugin/developer_guide/contents.html
but applet should also work with IE, dont use IE :D -
The Problem about using OTT command line
Environment variables:
oracle_home=c:\oracle
command line:
ott userid=scott/tiger intype=demoin.typ outtype=demoout.typ code=cpp hfile=demo.h cppfile=demo.cpp mapfile=RegisterMappings.cpp
error message:
Exception in thread "main" java.lang.NoClassDefFoundError: oracle/ott/c/CMain
where should I place the all the classes(not only the CMain.class) of oracle package?
or what others should I have to configure?
thanks!install xe client
set ORACLE_HOME to the client installation path.
******************************ott.bat******************************
@echo off
Rem OTT script for Oracle XE .
Rem Before running this script
Rem set jdk1.4.2/bin to PATH
Rem If ORACLE_HOME is not set, set the
Rem CLASSPATH to the directories containing
Rem ojdbc14.jar,orai18n.jar and ottclasses.zip
Rem
if defined ORACLE_HOME set CLASSPATH=%ORACLE_HOME%\jdbc\lib\ojdbc14.jar;%ORACLE_HOME%\jlib\orai18n.jar;%ORACLE_HOME%\precomp\lib\ottclasses.zip;%CLASSPATH%
set NLSLANG=
if defined NLS_LANG set NLSLANG=NLS_LANG
if defined ORACLE_HOME (
java oracle.ott.c.CMain nlslang=%NLSLANG% orahome=%ORACLE_HOME% %*
) else (
java oracle.ott.c.CMain nlslang=%NLSLANG% %*
) -
Problem about use dbca create database
before run dbca
[oracle@rac1 bin]$ ./crs_stat -t
Name Type Target State Host
ora....SM1.asm application ONLINE ONLINE rac1
ora....C1.lsnr application ONLINE ONLINE rac1
ora.rac1.gsd application ONLINE ONLINE rac1
ora.rac1.ons application ONLINE ONLINE rac1
ora.rac1.vip application ONLINE ONLINE rac1
ora....SM2.asm application ONLINE ONLINE rac2
ora....C2.lsnr application ONLINE ONLINE rac2
ora.rac2.gsd application ONLINE ONLINE rac2
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip application ONLINE ONLINE rac2when i run dbca to create DB ,it failed
[oracle@rac2 ~]$ dbca -silent -responseFile /home/oracle/dbca.rsp
Look at the log file "/opt/ora/product/10.2.0/db_1/cfgtoollogs/dbca/mydb.log" for further details.
[oracle@rac2 ~]$ cat "/opt/ora/product/10.2.0/db_1/cfgtoollogs/dbca/mydb.log"
The file path +ORADG/oradata/mydb/system01.dbf is invalid. Please check the permissions.info in my dbca.rsp
OPERATION_TYPE = "createDatabase"
GDBNAME = "mydb.oracle.com"
SID = "mydb"
NODELIST=rac1,rac2
TEMPLATENAME = "/home/oracle/mydb.dbc"
SYSPASSWORD = "Myss123456"
SYSTEMPASSWORD = "Myss123456"
EMCONFIGURATION = "LOCAL"
SYSMANPASSWORD = "Myss123456"
DBSNMPPASSWORD = "Myss123456"
ASM_SYS_PASSWORD="Myss123456"in template file,i put redo file,datafile,spfile and control file in ASM, some diag file and pfile i put in local file system
and i do not know why dbca will complain no permission
and i run the same command on another node
[oracle@rac1 ~]$ dbca -silent -responseFile /home/oracle/dbca.rsp
Look at the log file "/opt/ora/product/10.2.0/db_1/cfgtoollogs/dbca/mydb0.log" for further details.
[oracle@rac1 ~]$ cat "/opt/ora/product/10.2.0/db_1/cfgtoollogs/dbca/mydb0.log"
The directories "[+ORADG/mydb, +ORADG/oradata/mydb]" are not on cluster file system partitions shared across nodes "rac1, rac2".Edited by: 859340 on 2011-7-23 上午12:21Check the permission of dbca.rsp file in /home/oracle by
#ls -l /home/oracle/dbca.rsp
From the error its very clear that oracle user is not having sufficient privilege on this file.
Maybe you are looking for
-
How to see full file path in DW find/replace results
I've been looking for a solution to this for a while now. I've also seen many questions about this on other forums but no real answers. The problem is this: when I use the DW8 find feature to search for something across an entire site (or an entire f
-
Line alignment issue in InDesign CS5
Hi all, After many fruitless hours of Googling, I'm really, really hoping to find some help here with a small InDesign CS5 issue I'm having. I'll try and keep this brief. I'm currently designing a book in InDesign CS5 that has chapters that run one a
-
MIRO No Proposal of PO line item
Hi All, I am working on ECC 6.0. I enter an invoice with tx miro. I enter the purchase order and I press enter. The system doesnt propose the line items. In R/3 4.6C if you enter the PO, the system proposed the line items. What can I do to solve the
-
Recently upgraded to CF8 on 6 of our servers. Our software vendor recommended we go with coldfusion standard edition. We have 550 concurrent connections, with the users browsing pages and generating PDF Quotes. Every couple of days coldfusion locks u
-
Hi everyone i don't know anything in oracle forms , and all what i want to do is the following : I have a table called 'fp_log' with 2 columns 'ID' and "UIS' I have another table called 'EMP' with a column 'FP' which is a 'LONG RAW' type and another