How to declare java.lang.Class variable that can be used in Enum.valueOf(.)
As per subject -- we have a need to declare variable in class that will hold enum's Class object. At some point we want to use this variable as a Class argument for Enum.valueOf(.) which has the following signature:
public static <T extends Enum<T>> T valueOf(Class<T> enumType, String name) {..}So far we cannot come up with a workable solution.
private final Class<? extends Enum<?>> propertyClass;doesn't work (apparently because second ? should in fact be the same as first ? -- which works with T for class/method templates, but cannot be used for variables). Error message (in Eclipse) is:
Bound mismatch: The generic method valueOf(Class<T>, String) of type Enum<E> is not applicable for the arguments (Class<capture#13-of ? extends Enum<?>>, String). The inferred type capture#13-of ? extends Enum<?> is not a valid substitute for the bounded parameter <T extends Enum<T>>
So what would be the proper way to declare the variable?
Thanks in advance!
the enum.valueof method is a little weird. they implemented it so it is nice and "safe". if you don't care about that safety, you can probably work with raw types for that bit of code and get the call to go through. you just won't have any type safety on the result.
Similar Messages
-
Hi all,
I used the following code to create a new Database (ScottChangDB) and a new Table (marvel) in my SQL Server 2012 Management Studio (SSMS2012) successfully:
-- ScottChangDB.sql saved in C://Documents/SQL Server XQuery_MacLochlainns Weblog_code
-- 14 April 2015 09:15 AM
USE master
IF EXISTS
(SELECT 1
FROM sys.databases
WHERE name = 'ScottChangDB')
DROP DATABASE ScottChangDB
GO
CREATE DATABASE ScottChangDB
GO
USE ScottChangDB
CREATE TABLE [dbo].[marvel] (
[avenger_name] [char] (30) NULL, [ID] INT NULL)
INSERT INTO marvel
(avenger_name,ID)
VALUES
('Hulk', 1),
('Iron Man', 2),
('Black Widow', 3),
('Thor', 4),
('Captain America', 5),
('Hawkeye', 6),
('Winter Soldier', 7),
('Iron Patriot', 8);
SELECT avenger_name FROM marvel ORDER BY ID For XML PATH('')
DECLARE @x XML
SELECT @x=(SELECT avenger_name FROM marvel ORDER BY ID FOR XML PATH('Marvel'))--,ROOT('root'))
SELECT
person.value('Marvel[4]', 'varchar(100)') AS NAME
FROM @x.nodes('.') AS Tbl(person)
ORDER BY NAME DESC
--Or if you want the completed element
SELECT @x.query('/Marvel[4]/avenger_name')
DROP TABLE [marvel]
Now I am trying to create my first XML Schema Collection to do the Validation on the Field Name (Column Title) of the "marvel" Table. I have studied Chapter 4 XML SCHEMA COLLECTIONS of the book "Pro SQL Server 2008 XML" written by
Michael Coles (published by Apress) and some beginning pages of XQuery Language Reference, SQL Server 2012 Books ONline (published by Microsoft). I mimicked Coles' Listing 04-05 and I wanted to execute the following first-drafted sql in
my SSMS2012:
-- Reference [Scott Chang modified Listing04-05.sql of Pro SQL Server 2008 XML by Michael Coles (Apress)]
-- [shcColes04-05.sql saved in C:\\Documents\XML_SQL_Server2008_code_Coles_Apress]
-- [executed: 2 April 2015 15:04 PM]
-- shcXMLschemaTableValidate1.sql in ScottChangDB of SQL Server 2012 Management Studio (SSMS2012)
-- saved in C:\Documents\XQuery-SQLServer2012
tried to run: 15 April 2015 ??? AM
USE ScottChangDB;
GO
CREATE XML SCHEMA COLLECTION dbo. ComplexTestSchemaCollection_all
AS
N'<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="marvel">
<xsd:complexType>
<xsd:all>
<xsd:element name="avenger_name" />
<xsd:element name="ID" />
</xsd:all>
</xsd:complexType>
</xsd:element>
</xsd:schema>';
GO
DECLARE @x XML (dbo. ComplexTestSchemaCollection_all);
SET @x = N'<?xml version="1.0"?>
<marvel>
<avenger_name>Thor</name>
<ID>4</ID>
</marvel>';
SELECT @x;
GO
DROP XML SCHEMA COLLECTION dbo.ComplexTestSchemaCollection_all;
GO
I feel that drafted sql is very shaky and it needs the SQL Server XML experts to modify to make it work for me. Please kindly help, exam the coding of my shcXMLTableValidate1.sql and modify it to work.
Thanks in advance,
Scott ChangHi Scott,
2) Yes, FOR XML PATH clause converts relational data to XML format with a specific structure for the "marvel" Table. Regarding validate all the avenger_names, please see below
sample.
DECLARE @x XML
SELECT @x=(SELECT ID ,avenger_name FROM marvel FOR XML PATH('Marvel'))
SELECT @x
SELECT
n.value('avenger_name[1]','VARCHAR(99)') avenger_name,
n.value('ID[1]','INT') ID
FROM @x.nodes('//Marvel') Tab(n)
WHERE n.value('ID[1]','INT') = 1 -- specify the ID here
--FOR XML PATH('Marvel') --uncommented this line if you want the result as element type
3)i.check the xml schema content
--find xml schema collection
SELECT ss.name,xsc.name collection_name FROM sys.xml_schema_collections xsc JOIN sys.schemas ss ON xsc.schema_id= ss.schema_id
select * from sys.schemas
--check the schema content,use the name,collection_name from the above query
SELECT xml_schema_namespace(N'name',N'collection_name')
3)ii. View can be viewed as virtual table. Use a view to list the XML schema content.
CREATE VIEW XSDContentView
AS
SELECT ss.name,xsc.name collection_name,cat.content
FROM sys.xml_schema_collections xsc JOIN sys.schemas ss ON xsc.schema_id= ss.schema_id
CROSS APPLY(
SELECT xml_schema_namespace(ss.name,xsc.name) AS content
) AS cat
WHERE xsc.name<>'sys'
GO
SELECT * FROM XSDContentView
By the way, it would be appreciated if you can spread your questions into posts. For any question, feel free to let me know.
Eric Zhang
TechNet Community Support -
How is the java.lang.StringBuffer class different from the java.lang.String class?....
Read the API.
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html
"Strings are constant; their values cannot be changed after they are created. String buffers support mutable strings."
Although when possible you should use StringBuilder instead of StringBuffer.
Always read the API at the very least before asking questions in the forums. Ideally you should do some google searching and poke around for an answer too. Otherwise you will get people barking at you.
Drake -
I want to call a specified method of one class dynamically. I use the method
"getMethod()" in package "java.lang.Class" to get method and "invoke()" in
" java.lang.reflect.Method " to invoke method.
The problem is as following :
1. There are two argument in this method "getMethod(String MethodName , Class[] paremterTypes)" in package "Class". I have no idea about the second parameter " Class[] parameterTypes ".what does the argument exactly mean ?
2. There are two argument in the method "invoke(object obj, object[] obj)" in package "Method".
I have no idea about the second parameter "object[] obj ".what is mean ?
I pass " null " value to it and it works.But i pass anothers ,jvm will throw exception.I have a generic Method Executer that has a method like
public Object execute(String className, String methodName, Object args)
String fullClassName = packageName + className ;
Class delegateClass = Class.forName(fullClassName);
BaseDelegate delegate = (BaseDelegate)delegateClass.newInstance();
Method method = null;
if (args == null)
method = delegateClass.getMethod(methodName, new Class[] {});
obj = method.invoke(delegate,new Object[] {});
else
method = delegateClass.getMethod(methodName, new Class[] {args.getClass()});
obj = method.invoke(delegate, new Object[]{args});
}This seems to have problems when I call the method from a class like:
execute("CategoryDelegate", "getCategoryById", new Integer(4144));(I get a NoSuchMethodException)
The method I am trying to execute in CategoryDelegate looks like:
public Category getCategoryById(int categoryId) throws DelegateExceptionI think it has to deal with the difference in the way we handle Primitive Wrappers and Objects. Wrapper we have to use Interger.TYPE and with the rest of the Objects we have to use obj.class.
Am I doing something wrong here? Any suggestions to make it work for primitive wrappers as well as Objects? -
Error: could not be converted to [class java.lang.Class].
I am newbie to JDeveloper (10.1.2) on winxp and i was trying to setup the example from the following url http://radio.weblogs.com/0129487/2003/09/19.html
It is a how to on "Executing Toplink Queries using JavaBean DataControl "
Any help would be greatly appreciated.
Near the bottom on step "In StrutsPageFlow diagram, select allEmpsDA Data Action, right mouse and chooe Run" i get a the following runtime errors:
Validation Error
You must correct the following error(s) before proceeding:
JBO-29000: Unexpected exception caught: oracle.jbo.JboException, msg=JBO-29000: Unexpected exception caught: oracle.toplink.exceptions.ConversionException, msg= Exception Description: The object [mypackage.Employees], of class [class java.lang.String], could not be converted to [class java.lang.Class]. Please ensure that the class [class java.lang.Class] is on the CLASSPATH. You may need to use alternate API passing in the appropriate class loader as required, or setting it on the default ConversionManager Internal Exception: java.lang.ClassNotFoundException: mypackage.Employees
JBO-29000: Unexpected exception caught: oracle.toplink.exceptions.ConversionException, msg= Exception Description: The object [mypackage.Employees], of class [class java.lang.String], could not be converted to [class java.lang.Class]. Please ensure that the class [class java.lang.Class] is on the CLASSPATH. You may need to use alternate API passing in the appropriate class loader as required, or setting it on the default ConversionManager Internal Exception: java.lang.ClassNotFoundException: mypackage.Employees
Exception Description: The object [mypackage.Employees], of class [class java.lang.String], could not be converted to [class java.lang.Class]. Please ensure that the class [class java.lang.Class] is on the CLASSPATH. You may need to use alternate API passing in the appropriate class loader as required, or setting it on the default ConversionManager Internal Exception: java.lang.ClassNotFoundException: mypackage.EmployeesThis error is happening on a read.
Here is the mapping descriptor:
<database-mapping>
<attribute-name>SuppItemCollection</attribute-name>
<read-only>false</read-only>
<reference-class>package.SuppItem</reference-class>
<is-private-owned>false</is-private-owned>
<uses-batch-reading>false</uses-batch-reading>
<indirection-policy>
<mapping-indirection-policy>
<type>oracle.toplink.internal.indirection.NoIndirectionPolicy</type>
</mapping-indirection-policy>
</indirection-policy>
<container-policy>
<mapping-container-policy>
<container-class>java.util.Vector</container-class>
<type>oracle.toplink.internal.queryframework.ListContainerPolicy</type>
</mapping-container-policy>
</container-policy>
<source-key-fields>
<field>SUPP.REQ_NUM</field>
</source-key-fields>
<target-foreign-key-fields>
<field>SUPP_ITEM.REQ_NUM</field>
</target-foreign-key-fields>
<type>oracle.toplink.mappings.OneToManyMapping</type>
</database-mapping>
Object model has a Supp class that has a collection of SuppItem(s). I was allowing the Mapping Workbench to create the Java Source. I'm not to fond of that, but I thought it would be easiest to get things going.
The datamodel is similiar to the class model.
Thanks for the help,
Mike -
Hi All: Our platform is IBM AIX power system 64 bit, os level 6. Oracle Fusion Middleware version is 10.3.6.0.8. We tried to patch 10.3.6.0.10 on it, but encounter ‘out of memory error’ when applied WebLogic patch 10.3.6.0.10 on UAT report server. Currently UAT has 3GB memory (currently is 3G) .
JVMDUMP006I Processing dump event "systhrow",
detail "java/lang/OutOfMemoryError
JVMDUMP032I JVM requested Heap dump using
'/ora_bin01/u01/oracle/Middleware/utilhd' in response to an event
JVMDUMP010I Heap dump written to
/ora_bin01/u01/oracle/Middleware/utils/bsu/heapdump.20150224.152727.6422620.0001.phd
JVMDUMP032I JVM requested Java dump using
'/ora_bin01/u01/oracle/Middleware/utils/bsu/javacore.20150224.152727.6422620.0002.txt'
in response to an event
JVMDUMP010I Java dump written to
/ora_bin01/u01/oracle/Middleware/utils/bsu/javacore.20150224.152727.6422620.0002.txt
JVMDUMP032I JVM requested Snap dump using
'/ora_bin01/u01/oracle/Middleware/utils/bsu/Snap.20150224.152727.6422620.0003.trc'
in response to an event
JVMDUMP006I Processing dump event "systhrow",
detail "java/lang/OutOfMemoryError" - please wait.
JVMDUMP010I Snap dump written to
/ora_bin01/u01/oracle/Middleware/utils/bsu/Snap.20150224.152727.6422620.0003.trc
JVMDUMP013I Processed dump event "systhrow",
detail "java/lang/OutOfMemoryError".
JVMDUMP032I JVM requested Heap dump using
'/ora_bin01/u01/oracle/Middleware/utils/bsu/heapdump.20150224.152735.6422620.0004.phd'
in response to an event
JVMDUMP010I Heap dump written to
/ora_bin01/u01/oracle/Middleware/utils/bsu/heapdump.20150224.152735.6422620.0004.phd
JVMDUMP032I JVM requested Java dump using
'/ora_bin01/u01/oracle/Middleware/utils/bsu/javacore.20150224.152735.6422620.0005.txt'
in response to an event
JVMDUMP010I Java dump written to
/ora_bin01/u01/oracle/Middleware/utils/bsu/javacore.20150224.152735.6422620.0005.txt
JVMDUMP032I JVM requested Snap dump using
'/ora_bin01/u01/oracle/Middleware/utils/bsu/Snap.20150224.152735.6422620.0006.trc'
in response to an event
Exception in thread "main"
java.lang.OutOfMemoryError at
java.lang.StringBuffer.ensureCapacityImpl(StringBuffer.java:335)
at
java.lang.StringBuffer.append(StringBuffer.java:201)
at
java.lang.Class.throwNoSuchMethodException(Class.java:278)
at
java.lang.Class.getMethod(Class.java:845)
at
com.bea.cie.common.dao.xbean.XBeanDataHandler.isValueSet(XBeanDataHandler.java:958)
at
com.bea.cie.common.dao.xbean.XBeanDataHandler.getValueFromObject(XBeanDataHandler.java:589)
at
com.bea.cie.common.dao.xbean.XBeanDataHandler.getSimpleValue(XBeanDataHandler.java:431)
at
com.bea.plateng.patch.dao.cat.PatchDependency.getRule(PatchDependency.java:48)
at
com.bea.plateng.patch.dao.cat.PatchCatalogHelper.getInvalidatedPatchMap(PatchCatalogHelper.java:1625)
at com.bea.plateng.patch.PatchSystem.updatePatchCatalog(PatchSystem.java:436)
at
com.bea.plateng.patch.PatchSystem.refresh(PatchSystem.java:130)
at
com.bea.plateng.patch.PatchSystem.setCacheDir(PatchSystem.java:201)
at
com.bea.plateng.patch.Patch.main(Patch.java:281)
JVMDUMP010I Snap dump written to
/ora_bin01/u01/oracle/Middleware/utils/bsu/Snap.20150224.152735.6422620.0006.trc
JVMDUMP013I Processed dump event "systhrow",
detail "java/lang/OutOfMemoryError".
Exception in thread "Attach API wait loop"
java.lang.OutOfMemoryError
at
com.ibm.tools.attach.javaSE.CommonDirectory.waitSemaphore(CommonDirectory.java:222)
at
com.ibm.tools.attach.javaSE.AttachHandler$WaitLoop.waitForNotification(AttachHandler.java:329)
at com.ibm.tools.attach.javaSE.AttachHandler$WaitLoop.run(AttachHandler.java:396)
bsu.sh -install -patch_download_dir=/ora_bin01/u01/oracle/Middleware/utils/bsu/cache_dir -patchlist=12UV -prod_dir=/ora_bin01/u01/oracle/Middleware/wlserver_10.3
we followed the README.txt instructions, and stop/start weblogic service before/after apply patch. Can anyone suggest a solution or Doc ID for helping us?
thank you very much!Solutions: Bounce the applications and check the arguments if you can increase it. It is due to memory issue
You can set these values in CommEnv.sh (.cmd for windows) file located in the weblogic_home/common/bin directory.
This gets applied to all the domains under that wls home.
If you want to make the changes to specific domain then edit the SetDomainEnv.sh file located under the domain/bin directory.
How to solve java.lang.OutOfMemoryError: Java heap space
solutions: export JVM_ARGS="-Xms1024m -Xmx1024m"
How to solve java.lang.OutOfMemoryError: PermGen space
solution : export JVM_ARGS="-XX:PermSize=64M -XX:MaxPermSize=256m" -
Developer 10g error Java.Lang class not found
Hi
My application is live on static IP but when i try to access it from some systems i get the error after downloading Jinitiator
Java.lang class not found exception:Oracle forms engine main
is this problem of browser or something else? how can i solve
RegardsHi
My application is live on static IP but when i try
to access it from some systems i get the error after
downloading Jinitiator
ava.lang class not found exception:Oracle forms
engine main
is this problem of browser or something else? how can
i solve
RegardsSee the JInitiator "Proxies" configuration tab from the control panel, try checking the "Use Browser Settings" checkbox, that does the trick sometimes.
Tony -
Java.lang.class not found
Hi,
I configured scenario FILE TO JDBC, the sender channel is successful but in the receiving I am getting the error that java.lang.class not found.
In the receiver communication channel, I gave "com.microsoft.jdbc.sqlserverdriver".
what database connection parameters need to be given??
Thanks,
Satish.Whats your database ?
As Suresh said, did you deploy your JDBC driver ?
How to ?
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/xi-how-to-guides/how to install and configure external drivers for jdbc and jms adapters.pdf
After configuring your communication channel, did you check the Adapter Monitor
XI SP > 09
http://<host>:5<sysnum>00/rwb -> Component Monitoring -> All Display -> Adapter Engine -> Adapter Monitor
XI SP <= 09
http://<host>:5<sysnum>00/AdapterFramework
Oracle Driver & Connection:
JDBC Driver: oracle.jdbc.driver.OracleDriver
Connection: jdbc:oracle:thin:@<hostname>:<port_umber>:<database_name>
SQL Server Driver & Connection:
JDBC Driver = com.microsoft.jdbc.sqlserver.SQLServerDriver
Connection = jdbc:microsoft:sqlserver://hostname:1433;DatabaseName=<DBName>
regards
Shravan -
Java.lang.Class- getFields() results in JVM crash when called through JNI
From a C++ application, I use Invocation APIs to create a JVM and call some Java methods using JNI
I get a crash in jvm.dll with EXCEPTION_ACCESS_VIOLATION
when I try to call "getFields" method of java.lang.Class in order to get the Fields of the java class
This method call, should return a java/lang/reflect/Fields[] on success
I am able to get the method ID of this method by using pEnv->GetMethodID(..)
However, when I call this method using CallObjectMethod(..), HotSpt JVM crashes with access violation with the dump given below.
Any clues on how to debug and find the problem?
Or has anyone tried getting the fields of a Java class from C++ by calling reflection APIs uing JNI?
Thanks in advance!
Sample code
jclass testerClass = pEnv->FindClass("com/test/Tester");
jmethodID cid = pEnv->GetMethodID(testerClass,"<init>","()V");
if(NULL == cid)
pEnv->ExceptionDescribe();
jobject testerObject = pEnv->NewObjectV(testerClass, mid);
jmethodID mid = pEnv->GetMethodID(testerClass, "getClass",
"()Ljava/lang/Class;");
jobject clsObj = (jobject)pEnv->CallObjectMethod(testerObject, mid);
pEnv->ExceptionDescribe();
jclass jCls = pEnv->GetObjectClass(clsObj);
jmethodID midGetFields = pEnv->GetMethodID(jCls, "getFields",
"()[Ljava/lang/reflect/Field;");
jobjectArray jobjArray = (jobjectArray)pEnv->CallObjectMethod(testerObject, midGetFields);
pEnv->ExceptionDescribe();
Crash dump
Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x809E69F
Function=JVM_FindSignal+0x11505
Library=D:\Java\j2re1.4.2_03\bin\client\jvm.dll
Current Java thread:
at java.lang.Class.privateGetDeclaredFields(Unknown Source)
at java.lang.Class.privateGetPublicFields(Unknown Source)
at java.lang.Class.getFields(Unknown Source)
Dynamic libraries:
0x00400000 - 0x00419000 E:\SC\SC12.1\SCApplications\SNMP\Bin\JNITester.exe
0x77F50000 - 0x77FF7000 C:\WINDOWS\System32\ntdll.dll
0x77E60000 - 0x77F46000 C:\WINDOWS\system32\kernel32.dll
0x10000000 - 0x10023000 E:\SC\SC12.1\SCApplications\SNMP\Bin\JniUtils.dll
0x00320000 - 0x00332000 E:\SnmpIpmNativeTestDriver\MTFStubHelper.dll
0x00340000 - 0x0035B000 E:\SnmpIpmNativeTestDriver\MTFXMLFileAPI.dll
0x12000000 - 0x122B1000 e:\sc\sc12.1\bin\xerces-c_2_2_0D.dll
0x77DD0000 - 0x77E5D000 C:\WINDOWS\system32\ADVAPI32.dll
0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll
0x10200000 - 0x1026C000 e:\sc\sc12.1\bin\MSVCRTD.dll
0x102A0000 - 0x102B7000 e:\sc\sc12.1\bin\MSVCIRTD.dll
0x5F800000 - 0x5F8E9000 e:\sc\sc12.1\bin\MFC42uD.DLL
0x77C70000 - 0x77CB0000 C:\WINDOWS\system32\GDI32.dll
0x77D40000 - 0x77DCC000 C:\WINDOWS\system32\USER32.dll
0x5F700000 - 0x5F746000 e:\sc\sc12.1\bin\MFCD42uD.DLL
0x5F500000 - 0x5F5C6000 e:\sc\sc12.1\bin\MFCO42uD.DLL
0x10480000 - 0x104FE000 e:\sc\sc12.1\bin\MSVCP60D.dll
0x15020000 - 0x15042000 e:\sc\sc12.1\bin\SCTraceLib.dll
0x6D510000 - 0x6D58D000 C:\WINDOWS\System32\dbghelp.dll
0x77C10000 - 0x77C63000 C:\WINDOWS\system32\msvcrt.dll
0x77C00000 - 0x77C07000 C:\WINDOWS\system32\VERSION.dll
0x00360000 - 0x0037D000 e:\sc\sc12.1\bin\SCFileManager.dll
0x76BF0000 - 0x76BFB000 C:\WINDOWS\System32\PSAPI.DLL
0x00420000 - 0x00580000 e:\sc\sc12.1\bin\BctCoreCL.dll
0x5D920000 - 0x5D929000 C:\WINDOWS\System32\RPCNS4.dll
0x71B20000 - 0x71B31000 C:\WINDOWS\system32\MPR.dll
0x71C20000 - 0x71C6E000 C:\WINDOWS\System32\NETAPI32.dll
0x71AB0000 - 0x71AC5000 C:\WINDOWS\System32\WS2_32.dll
0x71AA0000 - 0x71AA8000 C:\WINDOWS\System32\WS2HELP.dll
0x15000000 - 0x15012000 e:\sc\sc12.1\bin\CTEventLog.dll
0x773D0000 - 0x77BC2000 C:\WINDOWS\system32\SHELL32.dll
0x70A70000 - 0x70AD4000 C:\WINDOWS\system32\SHLWAPI.dll
0x771B0000 - 0x772D1000 C:\WINDOWS\system32\ole32.dll
0x77120000 - 0x771AB000 C:\WINDOWS\system32\OLEAUT32.dll
0x1F7A0000 - 0x1F7D6000 C:\WINDOWS\System32\ODBC32.dll
0x77340000 - 0x773CB000 C:\WINDOWS\system32\COMCTL32.dll
0x763B0000 - 0x763F5000 C:\WINDOWS\system32\comdlg32.dll
0x08000000 - 0x08138000 D:\Java\j2re1.4.2_03\bin\client\jvm.dll
0x76B40000 - 0x76B6C000 C:\WINDOWS\System32\WINMM.dll
0x5FD00000 - 0x5FD0D000 C:\WINDOWS\System32\MFC42LOC.DLL
0x71950000 - 0x71A34000 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.10.0_x-ww_f7fb5805\comctl32.dll
0x1F840000 - 0x1F857000 C:\WINDOWS\System32\odbcint.dll
0x5DAC0000 - 0x5DAC7000 C:\WINDOWS\System32\rdpsnd.dll
0x00FE0000 - 0x00FE7000 D:\Java\j2re1.4.2_03\bin\hpi.dll
0x01000000 - 0x0100E000 D:\Java\j2re1.4.2_03\bin\verify.dll
0x01010000 - 0x01029000 D:\Java\j2re1.4.2_03\bin\java.dll
0x01030000 - 0x0103D000 D:\Java\j2re1.4.2_03\bin\zip.dll
0x76C90000 - 0x76CB2000 C:\WINDOWS\system32\imagehlp.dll
Heap at VM Abort:
Heap
def new generation total 576K, used 132K [0x15050000, 0x150f0000, 0x15530000)
eden space 512K, 25% used [0x15050000, 0x15071250, 0x150d0000)
from space 64K, 0% used [0x150d0000, 0x150d0000, 0x150e0000)
to space 64K, 0% used [0x150e0000, 0x150e0000, 0x150f0000)
tenured generation total 1408K, used 0K [0x15530000, 0x15690000, 0x19050000)
the space 1408K, 0% used [0x15530000, 0x15530000, 0x15530200, 0x15690000)
compacting perm gen total 4096K, used 964K [0x19050000, 0x19450000, 0x1d050000)
the space 4096K, 23% used [0x19050000, 0x191410e0, 0x19141200, 0x19450000)
Local Time = Wed Aug 25 21:06:44 2004
Elapsed Time = 0
# HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION
# Error ID : 4F530E43505002EF
# Please report this error at
# http://java.sun.com/cgi-bin/bugreport.cgi
# Java VM: Java HotSpot(TM) Client VM (1.4.2_03-b02 mixed mode)You are right, I tried getting the java.lang.Class reference for the com.test.Tester by calling getClass() on com.test.Tester
And using this jclass reference for java.lang.Class, I tried getting the method ID of getFields and eventually the Field[]
Thanks for the help
I have some more questions.
Assumption - Using JNI, I got the fields array of com.test.Tester and I am iterating through the fields
1.Assuming that the Tester class had an Integer field say m_nIntVal, then once I get the jobject equivalent of this Field in C++.
Now I need to get the type of the field (I call the method java.lang.reflect.getType() from JNI)
This gives me a jclass reference to it's type i.e java.lang.Integer
2.I need to get the name of this type i.e I want to get the name of the type in a string as "java.lang.Integer"
For this, on the jclass reference of java.lang.Integer got in Step 1, I call getClass() from JNI (to get the java.lang.Class) and then getName()
Now, for calling getClass(), I need a temporary object reference corresponding to the jclass of java.lang.Integer, The problem is that Integer does not have a default constructor, so my call to create the jobject fails.
But, since I do not know that I am constructing an Integer (remember that is what I am trying to find out - getType), I cant pass any values to constructor
Now, how do I go about creating a jobject of Integer, without knowing that I am constructing that, as this does not have a default constructor without parameters
Also, I tried using AllocObject to get the jobject and then tried to get the method ID of getClass(). Even this failed
3. If the com.test.Tester class had a primitive "int" field, say m_nPrimitiveInt
for which java provides a Class representation, I am able to get the jclass reference to the type of m_nPrimitiveInt
Now, how do I get the name of the type as "int" in a string?
Forllowing a similar procedure like in Step 2 fails when I try to pass the jclass reference to the type of m_nPrimitiveInt to the GetMethodID
with the error FATAL ERROR in native method: JNI received a class argument that is not a class
Can you tell me what is the way out?
Thanks in advance,
Also, can I mail you with some doubts that I have? If its ok, please contact me at [email protected] -
Problems with java.lang.Class in JDK1.3
Hi,
I have 3 problems with the reflection in java.lang.Class:
1) In the specification of method java.lang.Class.getDeclaredFields() is wrote:
"Returns .... This includes public, protected, default (package) access, and private fields ..."
This means, that all private fields should be return too. But some private methods are not given back. ????
2) In java.lang.Class.getDeclaredMethods()
some public methods are not return. ????
3) In java.lang.Class.getDeclaredMethods()
If Class is an interface. The same problem like 2) ????
Are they errors of java.lang.Class in JDK1.3 ????
Thanks & sincerely.Not sure it makes a difference, but you left off the last part of the quote:
This includes public, protected, default (package) access, and private classes and interfaces declared by the class, but excludes inherited classes and interfaces.
Are these missing methods from inherited classes, or are they declared in the class itself? -
Urgent... java.io , java.lang.class..
Hi there,
When i choose the file from JFilechooser, for example is a .class file, how do i make the .class file be read by java.lang.class as a class object, so i can get information from the class object ?
Is it related to java.io that make it become stream or something.
Is urgent for my school assignment, please help, Thanks in advance.Hi there,
When i choose the file from JFilechooser, for example
is a .class file, how do i make the .class file be
read by java.lang.class as a class object, so i can
get information from the class object ?
Is it related to java.io that make it become stream or
something.
Is urgent for my school assignment, please help,
Thanks in advance.First of all, java.lang.class does not exist. Just java.lang.Class.
1. Read the content of a file into a byte[]
2. Use defineClass method from ClassLoader in order to get the Class object (you can use the system class loader obtained by static method ClassLoader.getSystemClassLoader() ) -
Is a jclass object always a java.lang.Class object?
In a native method, I'm receiving a jobjectArray called "args" as a parameter. I'm writing this:
jclass cls1 = env->GetObjectClass(args);
jmethodID mid1 = env->GetMethodID(cls1, "isArray", "()Z");
but this returns 0, indicating there is no isArray in the jclass returned by GetObjectClass. On the other hand, this works:
jclass cls2 = env->GetObjectClass(env->GetObjectClass(args));
jmethodID mid2 = env->GetMethodID(cls2, "isArray", "()Z");
Why??
When I call getMethods() (via JNI) on cls1, I get only the methods of java.lang.Object. When I do that on cls2 I get the methods of java.lang.Class.Oops, I answered my own question. The jclass object represents the class of args, so its methods are those of the class of args, not those of java.lang.Class. I was misinterpreting what GetMethodID does -- it gets methods that would be returned by getMethods() in the Class object, not the methods of the Class object.
-
UI Error 'Method clone not found in class java.lang.Class'
When attempting to view an application window in the User Interface error I receive the error 'Method clone not found in class java.lang.Class'. The window will run correctly when I execute the application and other objects on the window are displayed correctly in the UI editor.
Within the window class I have used the following line of code to clone a reference list of values that is loaded just once when the application starts up: -
dsDefaultComboBoxModel priorityComboBoxModel = (dsDefaultComboBoxModel) dsReferenceLuLists.priorityComboBoxModel.clone();
And then this line of code to create a combo box: -
dsGuiComboBoxRefelu priorityComboBox = new dsGuiComboBoxRefelu(priorityComboBoxModel,ReportWindowSql.priorityCodeBuffer);
And then later on the combo box is displayed.
detailsArea.add(priorityComboBox, new XYConstraints(250,10,dsGlobalVariables.gvFieldWidthLarge,-1));
'dsDefaultComboBoxModel' is defined as follows: -
public class dsDefaultComboBoxModel extends DefaultComboBoxModel implements Cloneable
public dsDefaultComboBoxModel()
public Object clone()
try
return super.clone();
catch ( CloneNotSupportedException e )
// Shouldn't happen.
throw new InternalError( e.toString() );
This error occurs using the latest v903, but was also present in previous versions of JDeveloper.
At the moment this means that I did to execute the window in order to see all of the GUI elements that are displayed. As on option I could use something other than the clone method, but it seems to be such a nice way of copying the static reference lists.
Thanks for any help.Hi Darren,
My guess is that since DefaultComboBoxModel doesn't implement Cloneable, you can't call super.clone(). Does your code compile?
Later.
Dennis -
NullPointerException at java.lang.Class.forNameImpl(Native Method)
Hi All,
We installed an enterprise application using Websphere Application Server 6.1 and we use Java 1.5.0_18. We encountered the following error while testing the application:
[6/07/09 18:32:56:825 EST] 0000002b SystemErr R java.lang.NullPointerException
[6/07/09 18:32:56:825 EST] 0000002b SystemErr R at java.lang.Class.forNameImpl(Native Method)
[6/07/09 18:32:56:825 EST] 0000002b SystemErr R at java.lang.Class.forName(Class.java:130)
<the remaining part of the stack trace has been removed as it contains the names of our application specific classes>
Could you please let me know the root cause of this error?
Thank you.
Regards,
VenkateshI would double- and triple-check that. A null classname string is almost certainly the cause here.
-
How can i reuse same variables that i create using c:set var="index" /
hi all,
please some one helpme!!!!!!
how can i reuse same variable that i create using
<c:set var="index" value="${0}"/>
cause later in the program i use index to do some condition and based on that i increment ...
so for example if i say...
<c:if test="${index==0}">
<c:set var="index" value="${index+1}"/>
</c:if>
will it be like
if(index==0)
index++;
can i do like i did be4. if not what do i need to do to reuse. cause i use the variable atleast 5 time and its keep changing on diff condition level.Have you tried it?
It should work, provided you are on the same page.
The c:set tag creates the variable in pageScope by default.
If you forward to another JSP you need to set the scope to be "request" so that it is still available.
Maybe you are looking for
-
ITunes does not launch with new User Account (Vista)
One of my limited user accounts on Windows Vista because corrupt, so I created a new limited User Account and copied ALL of the files from the old to new. Now, when I try to launch itunes on the new user account, it will not open at all. Itunes works
-
Method expression syntax error in jsp jsf 2.0 eclipse
hi i made a simple bean jsp project, n ussed el to call methods in backing bean n show some text on the basis of method called.... the project works perfectly fine, but theres a small issue, that eclipse jsp editor marks the expression as red n shows
-
How can i delete the look up data in one shot , sql ?
Sorry wrong question Edited by: Coming Soon on Oct 29, 2010 2:55 PM Edited by: Coming Soon on Oct 29, 2010 2:57 PM
-
Dear friends, I�m implementing a classifieds web-application where the users can publish advertisements through a web form. Quite simple. my current task is: how to filter the advertisement contents in order to avoid Html Injection, i.e., the Html ta
-
Learn C on the mac questions...
Hello everybody, I'm just starting to learn programming. I choose to start with the book Learn C on the Mac - Dave Mark.He wrote the book while using xCode 3.1 I have 2 questions. First: Every Project that came with the book, when i try to open one