New instance of a generic type?
Hello!
I'm quite new to writing generics and I have this (possibly lame) question: how can I create a new instance of a generic type?
Let's say that inside a class MyClass<T> I have a method with following interface, whose only purpose would be to return new instance of the generic type T: public T getInstance(); Inside this method, I tried the obvious way of getting that instance, that is return new T(); and I also understood why that cannot be done.
However, Googling didn't really reveal any other ways of doing this, so I'm a little stuck. Could anybody please show me the light here?
triceo wrote:
However, Googling didn't really reveal any other ways of doing this.Because there aren't any.
triceo wrote:
Could anybody please show me the light here?Search this forum. I doubt you'd have to go back more than a few hours to find the last time this question was asked.
Similar Messages
-
How To: Use reflection to create instance of generic type?
I would like to be able to use reflection to instantiate an instance of a generic type, but can't seem to avoid getting type safety warnings from the compiler. (I'm using Eclipse 3.1.1) Here is a trivial example: suppose I want to create an instance of a list of strings using reflection.
My first guess was to write the following:
Class cls = Class.forName("java.util.ArrayList<String>");
List<String> myList = cls.newInstance();The call to Class.forName throws a ClassNotFoundException. OK, fine, so I tried this:
Class cls = Class.forName("java.util.ArrayList");
List<String> myList = cls.newInstance();Now the second line generates the warning "Type safety: The expression of type List needs unchecked conversion to conform to List<String>".
If I change the second line to
List<String> myList = (List<String>)cls.newInstance();then I get the compiler warning "Type safety: The cast from Object to List<String> is actually checking against the erased type List".
This is a trivial example that illustrates my problem. What I am trying to do is to persist type-safe lists to an XML file, and then read them back in from XML into type-safe lists. When reading them back in, I don't know the type of the elements in the list until run time, so I need to use reflection to create an instance of a type-safe list.
Is this erasure business prohibiting me from doing this? Or does the reflection API provide a way for me to specify at run time the type of the elements in the list? If so, I don't see it. Is my only recourse to simply ignore the type safety warnings?Harald,
I appreciate all your help on this topic. I think we are close to putting this thing to rest, but I'd like to run one more thing by you.
I tried something similar to your suggestion:public static <T> List<T> loadFromStorage(Class<T> clazz) {
List<T> list = new ArrayList<T>();
for ( ...whatever ...) {
T obj = clazz.newInstance();
// code to load from storage ...
list.add(obj);
return list;
}And everything is fine except for one small gotcha. The argument to this method is a Class<T>, and what I read from my XML storage is the fully qualified name of my class(es). As you pointed out earlier, the Class.forName("Foo") method will return a Class<?> rather than a Class<Foo>. Therefore, I am still getting a compiler warning when attempting to produce the argument to pass to the loadFromStorage method.
I was able to get around this problem and eliminate the compiler warning, but I'm not sure I like the way I did it. All of my persistent classes extend a common base class. So, I added a static Map to my base class:class Base
private static Map<String, Class<? extends Base>> classMap = null;
static
Map<String, Class<? extends Base>> map = new TreeMap<String, Class<? extends Base>>();
classMap = Collections.synchronizedMap(map);
public static Class<? extends Base> getClass(String name)
return classMap.get(name);
protected static void putClass(Class<? extends Base> cls)
classMap.put(cls.getName(), cls);
}And added a static initializer to each of my persistent classes:class Foo extends Base
static
Base.putClass(Foo.class);
}So now my persistence code can replace Class.forName("my.package.Foo") with Base.getClass("my.package.Foo"). Since Foo.class is of type Class<Foo>, this will give me the Class<Foo> I want instead of a Class<?>.
Basically, it works and I have no compiler warnings, but it is unfortunate that I had to come up with my own mechanism to obtain a Class<Foo> object when my starting point was the string "my.package.Foo". I think that the JDK, in order to fully support reflection with generic types, should provide a standard API for doing this. I should not have to invent my own.
Maybe it is there and I'm just not seeing it. Do you know of another way, using reflection, to get from a string "my.package.Foo" to a Class<Foo> object?
Thanks again for your help,
Gary -
Creating instance of generic type
Hi.
Here is my class
public class ManagerForm<M extends Stuff>{
private Class<M>clazz;
private M manager;
public void setWorker(M manager){
this.manager=manager;
public M getWorker(){
return this.manager;
private final Class<M> getGenericClass() {
Class<M> persistentClass = null;
Type genericType = getClass().getGenericSuperclass();
if (genericType instanceof ParameterizedType) {
ParameterizedType pType = ((ParameterizedType) genericType);
// obtaining first generic type class
persistentClass = (Class<M>) pType.getActualTypeArguments()[0];
return persistentClass;
public ManagerForm(){
this.clazz=getGenericClass();
this.manager=this.clazz.newInstance();
In default constructor I need to inicialize U instance this.user.
I have an nullPointerException in line this.manager=this.clazz.newInstance();
persistantClass is returned nullable because genericType is not instance of ParameterizedType.
Could anybody say me what is wrong or propose other methods to create generic instance. I need help. Will be very appreciable.
Thanks in advance.YoungWinston wrote:
877715 wrote:
Could anybody say me what is wrong or propose other methods to create generic instance. I need help. Will be very appreciable. I think you need to back up and explain exactly what you're trying to do here.
It would appear that you're attempting to divine the actual type of a specific ManagerForm, but I'm not absolutely certain. Also, since you already specify the type as a field, why can't you just usemanager.getClass()? I suspect that all you'll get from getClass().getGenericSuperclass() is 'Stuff', but I have to admit I'm no expert on this.
Far better to describe what you want than an implementation that plainly doesn't work.
WinstonWell. I have class ManagerForm<M extends Stuff>. there is private field manager that have generic type M. And I need to instantinate manager in default constructor.
I cant write
public ManagerForm(){
this.manager=new M();//will be compiler error
Thats why exists a mechanism to get current generic type in runtyme through ParameterType.
I have method getGenericClass that gets current class in runtime and then I create an instance of this class through <class>.newInstance(); And this is the standard way to instantinate generic type.
I hoped line Type genericType = getClass().getGenericSuperclass(); of method returned ParameterizedType. But variable genericType cannot be casted to ParameterizedType. I don't know why. So I cannot get current generic param M and instantiate its. -
Hi.
I have an issue with instantiating of generic type. My issue is similar to this Re: creating instance of generic type post.
So I have the following class
public class VehicleForm<V extends Vehicle>{
private V vehicle;
private Double price;
private Class<V>vItemClass;
public V getVehicle(){
return this.vehicle;
public void setVehicle(V vehicle){
this.vehicle=vehicle;
public Double getPrice(){
return this.price;
public void setPrice(Double price){
this.price=price;
private final Class<V> getGenericClassInstance() {
Class<V> persistentClass = null;
Type genericType = getClass().getGenericSuperclass();
if (genericType instanceof ParameterizedType) {
ParameterizedType pType = ((ParameterizedType) genericType);
// obtaining first generic type class
persistentClass = (Class<V>) pType.getActualTypeArguments()[0];
return persistentClass;
public VehicleForm(){
this.vItemClass=getGenericClassInstance();//vItemClass is null
this.vehicle=this.vItemClass.newInstance();//null poiner exception
I cannot write in default constructor
public VehicleForm(){
this.vehicle=new V();//runtime error will occure
because of generic type
For obtaining generics we can use java reflection functionality. Generic type list in runtime is obtaining through ParameterizedType. The code in getGenericClassInstance is standard to instantiate generic type var.
But unfortunately in my case it doesn't work. getGenericClassInstance returns null. Line Type genericType = getClass().getGenericSuperclass(); doesnt get generic type which is instance of ParameterizedType, so the condition if (genericType instanceof ParameterizedType) is false. My genericType is Object instance, but not ParameterizedType. So I cannot create Class<V> instance from null.
Can anybody help me? Thanks in advance.
Edited by: 877736 on 06.08.2011 12:50
Edited by: 877736 on 06.08.2011 12:51877736 wrote:
My issue is similar to this Re: creating instance of generic type post...Did you look at the answers given there? Pretty much the same as ttjacobs is telling you here: This is NOT what generics was created for.
Even if you can do it, the code is likely to be messy, complex and brittle.
Also: this thread is in the wrong category, as the other poster (you?) was already told. There is a "Generics" section under Java APIs.
My suggestion: rethink your solution.
Winston -
Tutorial for make a non-generic type class from a generic type interface
Hi there,
How can I make a non-generic type class from a generic type interface?
I appreciate if somebody let me know which site can help me.
Regards
MauriceI have a generic interface with this signature
public interface IELO<K extends IMetadataKey>
and I have implemented a class from it
public class CmsELOImpl<K extends IMetadataKey> implements IELO<K>, Cloneable, Serializable
then I have to pass class of an instance CmsELOImpl to AbstractJcrDAO class constructor whit below signature
public abstract class AbstractJcrDAO<T> implements JcrDAO<T> {
public AbstractJcrDAO( Class<T> entityClass, Session session, Jcrom jcrom ) {
this(entityClass, session, jcrom, new String[0]);
So I have made another class extended from AbstractJcrDAO. Below shows the code of this class and itd constructor
public class ELODaoImpl extends AbstractJcrDAO<CmsELOImpl<IMetadataKey>> {
public ELODaoImpl( Session session, Jcrom jcrom ) {
super(CmsELOImpl.class , session , jcrom, MIXIN_TYPES);
and as you see in its constructor I am calling the AbstractJcrDAO constructor by supper method
then I got this error on the line of super method
The constructor AbstractJcrDAO(class<CmsELOImpl>, session, Jcrom, String[]) is undefined.
as I know java generics are implemented using type erasure. This generics are only
in the java source file and not in the class files. The generics are only used by the compiler and
they are erased from the class files. This is done to make generics compatible with (old) non generics java code.
As a result the class object of AbstractJcrDAO<CmsELOImpl<IMetadataKey>>
is AbstractJcrDAO.class. The <CmsELOImpl<IMetadataKey>> information is
not available in the class file. As far as I understand it, I am looking a way
to pass <CmsELOImpl<IMetadataKey>>, if it is possible at all.
Maurice -
I rely heavily on Firefox's profiling ability to assist me in my web design projects. Lately, using Firefox 3.6, I have run into some problems with how it opens Internet Shortcuts that are saved locally (i.e.- shortcuts that reside on my Desktop). When I double-click on one of these shortcuts, a new instance of Firefox 3.6 is loaded with the saved website from the shortcut, but it's also initialized a fresh profile (i.e.- my bookmarks are gone, no add-ons, etc.--it's as if it uses some sort of "hidden" clean slate to load the shortcuts).
Is there any way to force Firefox to load all shortcuts into whatever profile I'm currently using at that given moment? I think the reason this has happened to begin with is because of the fact that I did some stuff to Internet Explorer awhile back that caused some problems with the Internet Shortcut associations and it all led to this eventuality.
I'm running Windows XP Pro and have the following profiles with my Firefox versions:
"C:\Program Files\Mozilla Firefox 3.6\firefox.exe" -no-remote -p Firefox3.6
"C:\Program Files\Mozilla Firefox N\firefox.exe" -no-remote -p FirefoxN
"C:\Program Files\Mozilla Firefox 3\firefox.exe" -no-remote -p Firefox3
"C:\Program Files\Mozilla Firefox 2\firefox.exe" --no-remote -p Firefox2
When I go into the "Folder Options / File Types" and double-click on "Internet Shortcut", I have the following within the "Advanced" settings (for the "open" action):
Action: open
Application used to perform action: rundll32.exe shdocvw.dll,OpenURL %l
"Use DDE" is checked...
"DDE Message" is blank...
"Application" is "shdocvw"...
"DDE Application Not Running" is blank...
"Topic" is "System"
Again, I think the root problem here is to do with the profiles and how they're handled when being opened with Firefox but I can't discern how to apply a fix with all this as I've obviously goobered this up a bit. I would really appreciate some professional knowledge on this and would prefer to avoid any reinstalls of anything if possible.To save your sanity with this issue, my advice is to find a method other than desktop shortcuts to open those URL's.
1. Desktop shortcuts are going to open the Default Browser.
a. With multiple versions of Firefox installed that would be the last version that was installed when you have Firefox set as the Default Browser in Windows..
b. The Default Browser is going to use the Profile that shows a Default=1 in the profiles.ini file.
c. The Default Browser with the Default Profile isn't going to open if you have any other versions of Firefox already running, and the -no-remote command line parameter doesn't work in this situation.
2. The use of multiple Profiles and multiple versions isn't officially supported by Mozilla, and all the Bug reports that I have ever read about Requests for Enhancement have been WONTFIX'd by the developers. Basically we have to work with the limitations in Firefox and maybe improvise work arounds by ourselves. I've even seen a few threats about removing Profiles altogether in RFE Bug reports about Profiles.
I have had so many problems over the years with this Default Browser / Default Profile thing over the years that personally I find it easier to just set Opera as the Default Browser in Windows rather than have a Profile get b0rked because some other program I am using decides it wants to open the Default Browser unexpectedly. I don't use Opera for much, but it is a lot better than IE for purposes of being the Default Browser, considering the quirks I have seen with Firefox and multiple Profiles.
I have written a number of postings over at the MozillaZine Builds forum over the years about installing multiple versions of Firefox and using multiple Profiles. There's a lot of tips and comments provided by other multiple Profile users in one of those threads. Why don't you read those threads and see if it gives you some ideas or solutions I haven't thought of.
http://forums.mozillazine.org/viewtopic.php?f=23&t=1062975
http://forums.mozillazine.org/viewtopic.php?t=613873
http://forums.mozillazine.org/viewtopic.php?t=462431
The last thread listed has a lot of comments offered by other users, the first two threads were locked as a How-to sticky thread. -
How to create an array with Generic type?
Hi,
I need to create a typed array T[] from an object array Object[]. This is due to legacy code integration with older collections.
The method signature is simple:public static <T> T[] toTypedArray(Object[] objects)I tried using multiple implementations and go over them in the debugger. None of them create a typed collection as far as I can tell. The type is always Object[].
A simple implementation is just to cast the array and return, however this is not so safe.
What is interesting is that if I create ArrayList<String>, the debugger shows the type of the array in the list as String[].
If I create ArrayList<T>, the class contains Object[] and not T[].
I also triedT[] array = (T[]) Array.newInstance(T[].class.getComponentType(), objects.length);And a few other combinations. All work at runtime, create multiple compilation warnings, and none actually creates T[] array at runtime.
Maybe I am missing something, but Array.newInstace(...) is supposed to create a typed array, and I cannot see any clean way to pass Class<T> into it.T[].class.getComponentType()Returns something based on object and not on T, and T.class is not possible.
So is there anything really wrong here, or should I simply cast the array and live with the warnings?
Any help appreciated!Ok. May be you could keep information about generic type in the your class:
public class Util {
public static <T> T[] toTypedArray(Class<T> cls, Object[] objects){
int size = objects.length;
T[] t = (T[]) java.lang.reflect.Array.newInstance(cls, size);
System.arraycopy(objects, 0, t, 0, size);
return t;
public class Sample<T> {
Class<T> cls;
T[] array;
public Sample(Class<T> cls) {
this.cls = cls;
public void setArray(Object[] objects){
array = Util.toTypedArray(cls, objects);
public T[] getArray(){
return array;
public static void main(String[] args) {
Object[] objects = new Object[] { new LinkedList(), new ArrayList()};
Sample<List> myClass = new Sample<List>(List.class);
myClass.setArray(objects);
for(List elem: myClass.getArray()){
System.out.println(elem.getClass().getName());
} -
Java5: Can't find a way to get rid of warnings about generic types
Hi all,
i have this method:
public static void insert(List list, int index, Object obj) {
list.add(obj);
int j = list.size() - 1;
for (; j > index; j--) {
list.set(j - 1, list.get(j));
list.set(index, obj);
}I get 3 warnings. All about:
Type safety: The method add(Object) belongs to the raw type List. References to generic type List<E> should be parameterized
I can't find a way to rewrite this method (Java5), that i get no warnings compiling it and calling it with:
List<AnyClass> list = new ArrayList<AnyClass>();
list.add(new AnyClass());
AnyClass ac = new AnyClass();
insert(list, 0, ac);May be you know another way to insert an element to a List?
ThanksNever tried it and do not have 5.0 installed to test
it, but what if you define the ArrayList as follows?
List<Object> list = new ArrayList<Object>();
That should get rid of the warnings. -
HELP: Extended Attributes Not Appearing In Instances of Custom Content Type
From Java code I create a custom content type derived from Document and define some extended attributes with default values for that type. All done using the same methodology shown in the Developer's Guide and Oracle example code.
I start ifsmgr and I can indeed see the content type and the extended attributes.
If I however create an instance of this (custom) type, either from the Viewer (file Upload) or from Java code (using code simuilar to createDocument from the Oracle ContentModule example), the extended attributes do not appear!
BUT, if I delete one of the extended attributes using ifsmgr (highlight one of my extened attributes, click on "Remove", and then "Apply"), from that point on the previously missing extended attributes appear (except for the one I deleted of course) when I create files of the custom type from either Java code or the Viewer. Furthermore, once I get ifs to "see" one of these extended attributes in this manner, I can delete the extended attribute and re-create it from Java at will and it will appear in created instances of my custom content type just fine.
If however I add another new extended attribute to the custom content type, I have to do the "Remove/Apply" drill in ifsmgr to get this new attribute to appear in created files of my custom type.
I've tried deleting all instances of the custom type and closing both ifsmgr and the Viewer, but unless I delete one of the extended attributes from ifsmgr I cannot get new extended attributes to appear.
What do I need to do in my 9ifs Java code to get new custom content extended attributes to appear in instances of that custom type?
Thank you,
Jeff "Did Kafka Write ifs?" RiningerDear @user10993347,
As mentioned by @vinod2303, you need to maintain content relationships along with subscriptions.
Regards,
Saurabh -
How to create new instance of an abstract?
I just downloaded a *.jar library.
In my code, I imported the right class.
When I create a new instance Netbean complaints "blah is an abstract: can not instantiated"
So when I looked at blah class code:
It looks like this:
public abstract class blahblah extends DataFrame
protected blahblah(byte[] data)
super(data);
}huh? How can I instantiate this bad boy then?jverd wrote:
firewind4000 wrote:
huh? How can I instantiate this bad boy then?You can't. You can only instantiate a concrete subclass.Yup. There are two possibilities:
1. BlahBlah was designed for client (you!) subclassing. You should define a concrete ( = not abstract) subclass X of BlahBlah :
public class X extends BlahBlah {...}and then instantiate X.
2. There is a factory method somewhere in this framework that returns objects of type BlahBlah. Use it:
BlahBlah myObj = factory.createBlahBlah();In this case there is probably a non-public subclass of BlahBlah defined in the framework that you don't need to know the details of. -
Creating new instances of MDBs at runtime
I am creating an application with a single input point (messages on a JMS Queue). The application needs to be multi-threaded, but would like to process the messages sequentially based on the message type.
For example, a message of type A and a message type B can be processed simultaneously, but only 1 message of type A can be processed at a time. So if the application is processing a message of type A, and it receives another type A message, it must complete the first message before processing the second message.
What I would like to do is have a single MDB (called the dispatcher MDB) that listens on the input point (JMS Queue). The dispatcher MDB calls onMessage() which will look at the message type and the forward to another JMS Queue based on the type. For example, if message type is A, send to Queue A, else if message type B, send to Queue B and so on. Each queue would have a MDB instance servicing the messages. In order to process the messages sequentially on each queue, the pool size for each MDB would be 1.
My problem is that I don't know how many message types there are, this is decided at runtime.
How can I create the Queues and register MDB at runtime?
After some research, I have found the ability to create the Queues using JMX. But, I cannot seem to find details on how to create a register an MDB and tell it to listen on a particular Queue. Has anyone had any experience doing such a thing?OK, i have some code similar to below, where I want to
create a new instance of the class BookRecord which
takes parameters from Book b, which is an instance if
the class Book.
//This is code from the Libraray class
public void addBookRecord(Book b, String author,
String title)
bookHolder = new BookRecord(b, author, title);
}Now this creates a new BookRecord object that has an
author and title which refer to the Book b. Now when i
invoke the method again, choosing the same object for
b as i did last time it creates a second BookRecord
object, when I just want it to overwrite the values of
the previous BookRecord object. how can i do this
simply?
Thanks in advanceWell I am not quite sure if I understood.
But refering to what you wrote I would say:
//This is code from the Libraray class
public void addBookRecord(Book b, String author, String title)
if(bookHolder.getBook() != b)
// Not the same book object
bookHolder = new BookRecord(b, author, title);
else
// same book object
bookHolder.setAuthor(author);
book.setTitle(tile);
As I said may be totally not what you are looking for.
Regards
Tarik -
Running into strange errors when creating a new instance
Hello:
I am running 9.2.0.8 on a Windows 2003 Server.
When I try to create a new instance, I chose a New Database/UTF-8/16KB Block Size. Everything else was default value. However, I get a "ORA-29807: specified operator does not exist" error. When I looked into the Create log file, the file, CreateDBCatalog.log has the following errors:
No errors.
No errors.
drop table AUDIT_ACTIONS
ERROR at line 1:
ORA-00942: table or view does not exist
No errors.
CREATE ROLE exp_full_database
ERROR at line 1:
ORA-01921: role name 'EXP_FULL_DATABASE' conflicts with another user or role name
CREATE ROLE imp_full_database
ERROR at line 1:
ORA-01921: role name 'IMP_FULL_DATABASE' conflicts with another user or role name
drop table system.logstdby$skip_support
ERROR at line 1:
ORA-00942: table or view does not exist
Warning: View created with compilation errors.
Warning: View created with compilation errors.
CREATE ROLE exp_full_database
ERROR at line 1:
ORA-01921: role name 'EXP_FULL_DATABASE' conflicts with another user or role name
CREATE ROLE imp_full_database
ERROR at line 1:
ORA-01921: role name 'IMP_FULL_DATABASE' conflicts with another user or role name
drop synonym DBA_LOCKS
ERROR at line 1:
ORA-01434: private synonym to be dropped does not exist
drop view DBA_LOCKS
ERROR at line 1:
ORA-00942: table or view does not exist
No errors.
drop package body sys.diana
ERROR at line 1:
ORA-04043: object DIANA does not exist
drop package sys.diana
ERROR at line 1:
ORA-04043: object DIANA does not exist
drop table sys.pstubtbl
ERROR at line 1:
ORA-00942: table or view does not exist
drop package body sys.diutil
ERROR at line 1:
ORA-04043: object DIUTIL does not exist
drop package sys.diutil
ERROR at line 1:
ORA-04043: object DIUTIL does not exist
drop procedure sys.pstubt
ERROR at line 1:
ORA-04043: object PSTUBT does not exist
drop procedure sys.pstub
ERROR at line 1:
ORA-04043: object PSTUB does not exist
drop procedure sys.subptxt2
ERROR at line 1:
ORA-04043: object SUBPTXT2 does not exist
drop procedure sys.subptxt
ERROR at line 1:
ORA-04043: object SUBPTXT does not exist
No errors.
No errors.
No errors.
No errors.
drop type dbms_xplan_type_table
ERROR at line 1:
ORA-04043: object DBMS_XPLAN_TYPE_TABLE does not exist
drop type dbms_xplan_type
ERROR at line 1:
ORA-04043: object DBMS_XPLAN_TYPE does not exist
No errors.
DROP TABLE ODCI_SECOBJ$
ERROR at line 1:
ORA-00942: table or view does not exist
DROP TABLE ODCI_WARNINGS$
ERROR at line 1:
ORA-00942: table or view does not exist
No errors.
No errors.
No errors.
No errors.
drop sequence dbms_lock_id
ERROR at line 1:
ORA-02289: sequence does not exist
drop table dbms_alert_info
ERROR at line 1:
ORA-00942: table or view does not exist
No errors.
No errors.
No errors.
No errors.
No errors.
No errors.
No errors.
No errors.
No errors.
No errors.
No errors.
No errors.
No errors.
No errors.
No errors.
No errors.
No errors.
No errors.
No errors.
No errors.
No errors.
No errors.
No errors.
drop table SYSTEM.AQ$_Internet_Agent_Privs
ERROR at line 1:
ORA-00942: table or view does not exist
drop table SYSTEM.AQ$_Internet_Agents
ERROR at line 1:
ORA-00942: table or view does not exist
No errors.
No errors.
No errors.
No errors.
No errors.
No errors.
No errors.
No errors.
No errors.
DROP SYNONYM def$_tran
ERROR at line 1:
ORA-01434: private synonym to be dropped does not exist
DROP SYNONYM def$_call
ERROR at line 1:
ORA-01434: private synonym to be dropped does not exist
DROP SYNONYM def$_defaultdest
ERROR at line 1:
ORA-01434: private synonym to be dropped does not exist
DBMS_DEBUG successfully loaded.
PBUTL successfully loaded.
PBRPH successfully loaded.
PBSDE successfully loaded.
PBREAK successfully loaded.
DROP TYPE SYS.RewriteMessage FORCE
ERROR at line 1:
ORA-04043: object REWRITEMESSAGE does not exist
DROP TYPE SYS.RewriteArrayType FORCE
ERROR at line 1:
ORA-04043: object REWRITEARRAYTYPE does not exist
DROP TYPE SYS.ExplainMVMessage FORCE
ERROR at line 1:
ORA-04043: object EXPLAINMVMESSAGE does not exist
DROP TYPE SYS.ExplainMVArrayType FORCE
ERROR at line 1:
ORA-04043: object EXPLAINMVARRAYTYPE does not exist
No errors.
drop view sys.transport_set_violations
ERROR at line 1:
ORA-00942: table or view does not exist
drop table sys.transts_error$
ERROR at line 1:
ORA-00942: table or view does not exist
No errors.
No errors.
No errors.
No errors.
No errors.
No errors.
No errors.
No errors.
No errors.
No errors.
No errors.
No errors.
No errors.
No errors.
No errors.
No errors.
No errors.
No errors.
No errors.
No errors.
No errors.
No errors.
No errors.
No errors.
No errors.
No errors.
No errors.
No errors.
drop operator XMLSequence
ERROR at line 1:
ORA-29807: specified operator does not exist
What does this mean?
venki
Edited by: thevenkat on Mar 11, 2009 10:17 PMVenki,
The ORA-00942 is okay because there is no existing object. But what stuck me is the ORA-01921 error which may indicate that this might not be a new database.
CREATE ROLE exp_full_database
ERROR at line 1:
ORA-01921: role name 'EXP_FULL_DATABASE' conflicts with another user or role name
CREATE ROLE imp_full_database
ERROR at line 1:
ORA-01921: role name 'IMP_FULL_DATABASE' conflicts with another user or role name
Are there any existing databases on this server? Have you tried to create it on other machine?I searched on Metalink too and found Doc ID: 237486.1 ORA-29807 Signalled While Creating Database using DBCA which say that eroror could be ignored. You may want to review that as well.
Ittichai -
Creating a new instance of a class within a superclass
I have a class with 2 subclasses and in the top classs I have a method that needs to create a new instance of whihc ever class called it.
Example:
class Parent
void method()
addToQueue( new whatever type of event is calling this function )
class Child1 extends Parent
class Child2 extends Parent
}What I mean is , if Child1 calls the method then a new Child1 gets added to the queue but if Child 2 calls method a new Child 2 gets added to the queue. Is this possible?
Thanks.try
void method()
addToQueue(this.getClass().newInstance());
}Is this what you want ?Won't that always add an object of type Parent?
no if we invoke this method on the child object...
we currently dun know how op going to implement the addToQueue()
so... just making my guess this method will always add to same queue shared among
Parent and it's childs...... -
Oracle 9i new instance create scripts
Hello,
I have Oracle 9.0.1 installed on a HP-UX 11.0 machine. I created a new instance with Oracle Configuration Assistance when I install the package. I try to create the second instance, DBCA or my database create scripts for Oracle 8i does not work. I received the error message like "The instance is running" type message.
Does any one has a create script for Oracle 9i I can have?
Please help!
Thanks!
Nelson NgDid you change your ORACLE_SID before trying to create a new instance?
-
I need to rebuild my SCCM2012 site server. I already have a SQL2012 server housing 1 instance. I need to create a new instance on this production SQl2012 server.
When createing a new instance during the setup SQLwizard will it take the other instances already running offline during the configuration?
Thanks
EiramNo, but as Ashwin suggested after applying SP you may have to reboot that brings up another instance down.
Apart from that you will have to consider other things, when you are sharing with another prod instance.
Hardware and software requirements, processor, memory, OS related, Cross-language support if any, Hard Disk requirements, any OS updates brings both prod servers down, Storage type for data and log files, Domain controller issues..
Maybe you are looking for
-
How can I transfer pictures from my pc to my iPhone through iTunes
Hey how can I putpictures from my windows vista computer to my iTunes, o then I can put it on they iPhone 4s? Thanks!
-
Reset my Lumia 620 through settings and now it's '...
I planned to give my Lumia 620 to my dad as I had recently upgraded to a 920. Thus I did a reset to make it feel as brand new as possible. Now, it's stuck at the 'cog cycle' for at least a day. What will the care centre do with it?
-
Database link between Oracle Standard Edition and Oracle Enterprise Edition
Hi, I am looking at setting up a data transfer process between an Oracle 11g Enterprise Edition database and an Oracle 11g Standard Edition database. Database links would be required each way. I heard once that this is not permitted as connecting Sta
-
SQL developer 3.1 throws Function sequence error
Hi, I was able to connect to my remote timesten db and was able to compile and execute packages. I tried modifying one of my packages to include dbms_lock.sleep in my code and then compiled the package. while running the package i got some error rela
-
Suppress warnings re exclusive locking
We're using ASE 15.7 on Windows but this may apply to other platforms. Certain stored procs where we're locking a table in exclusive mode inside a trans generate warnings: (number 12103, Severity 10) Table 'x' in database 'y' was not locked in 'exclu