Creating object instance
I'm trying to create a new instance of an object using data supplied from a DataInputStream.
I can create a new instance of my object Nasjob using
Nasjob myjob = new Nasjob("12345","smith","K");
Using a DataInputStream I can obtain the string "12345","smith","K"
and assign it to a variable called MYPARAMS
When I try to substitute "12345","smith","K" with MYPARAMS
Eg
Nasjob myjob = new Nasjob(MYPARAMS);
I get a compilation error.
I'm new to java so any help greatly appreciated
So you have a construtor:
NasJob(String s1, String s2, String s3)
and you are calling it with
new NasJob(s)
Its not going to work:
You need to define a constructor:
NasJob(String s)
then do some tokenizing inside to get the three tokenized parameters in the string! The Java compiler is not clever enough to realise that the string you are passing to a constructor requiring three strings does infact contain three parameters seperated by commas!!
Similar Messages
-
"OIP-04796 Unable to create object instance"
I am using OO4O, version 3 for Oracle 8.1.7 on Windows with Visual Basic version 6.
I am getting the intermittent errors "OIP-04796 Unable to create object instance" and also "Method createDynaset of _IOraDatabase failed" - I think both are related to one another and from the documentation for OO4O, "OIP-04796" relates to the client side object cache of the OraDatabase class. Reasoning that the client side object cache was too small I attempted to increase the relevant properties of the OraDatabase object using the following: -
MyOraDatabaseObj.CacheOptimalSize = 400
However, at run-time, this property of the OraDatabase object does not get set accordingly in the VB IDE and after several attempts I can't seem to set it. I have also tried setting the CacheMaximumSize property but to no avail.
Can anybody indicate to me where I am going wrong and either with the setting of the above properties or with the error message in general if I am not on the right track with the cache properties. I don't suspect that it is my code because the problem "seems" to be intermittent.
Any and all help would be greatly appreciated. If more info is required then just ask as this is pressing problem.
TYIA
Mark GrimshawI am pretty sure the patches are available here. If you didn't explicitly install one then you have whatever the base release was.
If they are not available here (I almost never look here first for a patch) they are certainly available in the MetaLink file library for OO4O. -
Do I really have to create object instance before jsf can update its value?
Hello,
I have jsp page with following fragment:
<h:inputText value="#{myBean.obj.value}"/>
myBean is defined as managed bean of class MyBean:
public class MyBean {
private MyObject obj;
public object getObj() { return obj; }
public void setObj(MyObject obj) { this.obj = obj; }
MyObject is a POJO with getter and setter for property "value".
Now, when I display this jsp page, inputText will be empty, since getter for "obj" returned null. If I enter something in this inputText and submit the page I will get:
PropertyNotFoundException: Error testing property 'value' in bean of type null
This exception was thrown in PROCESS_VALIDATIONS phase. As I see, JSF is expecting getter for "obj" to return MyObject instance, where instead it returns null.
My question is: do I really have to have already created instance of object for validation to succed?
I know that this problem is easy to solve by placing
private MyObject obj = new MyObject();
in class definition or similar initialization in constructor, but..
What if "obj" is a hibernate bean, that has a full tree of other hibernate beans as properties... In this case, creating a new instance of "obj" and initializing all of it nodes, is no more "one line of code" task, but instead 20 lines of, IMHO, unnecessary code.
So I was wondering why is JSF unable to create new instance of object whose properties is trying to update?
Regards,
IgorThanks for reply,
I'm aware of jsf IoC, but this does not simplify my problem.
In my case MyObject is class used by Hibernate and can be something like:
public class Employee {
private String name;
private Workgroup workGrp;
private Residence res;
// ... more properties, getters, setters
public class Residence {
private State state;
// ... more properties, getters, setters
So, in order to fully create Employee instance, I have to create and set its Workgroup and Residence properties, and then create and set State inside Residence...etc. Defining all hibernate classes as managed beans, and making dependancies between them cannot solve this problem.
Since I don't want to add constructors or initializers to hibernate classes, the only solution I can come up with is to do manual creation:
obj = new Employee();
obj.setWorkGrp(new Workgroup());
obj.setRes(new Residence());
// ...etc
and place this code in obj's getter to be executed if obj is null. This is the reason I was wondering why can't this be done by jsf automaticly? -
Create an object instance without calling its constructor?
Hi,
Sometimes it's useful to create object instances without calling their constructor. When? For example object deserialization.
By default when deserializating an object, the instance in the VM is created by calling the default constructor of the first non Serializable super-class (if you don't have such you're in trouble). I think that the db4o object database don't even call any constructor you may have written.
So such thing exists, but how is this possible? I fugured out that sun's deserialization mechanism first finds the constructor of the first non Serializable super-class and then:
cons = reflFactory.newConstructorForSerialization(cl, cons); Here I'm stuck.
Here's the source of the method for finding serializable constructor:
* Returns subclass-accessible no-arg constructor of first non-serializable
* superclass, or null if none found. Access checks are disabled on the
* returned constructor (if any).
private static Constructor getSerializableConstructor(Class cl) {
Class initCl = cl;
while (Serializable.class.isAssignableFrom(initCl)) {
if ((initCl = initCl.getSuperclass()) == null) {
return null;
try {
Constructor cons = initCl.getDeclaredConstructor(new Class[0]);
int mods = cons.getModifiers();
if ((mods & Modifier.PRIVATE) != 0 ||
((mods & (Modifier.PUBLIC | Modifier.PROTECTED)) == 0 &&
!packageEquals(cl, initCl)))
return null;
cons = reflFactory.newConstructorForSerialization(cl, cons);
cons.setAccessible(true);
return cons;
} catch (NoSuchMethodException ex) {
return null;
}So any info about this ReflectionFactory, and the problem as a whole?
Thanks.So the question is how to create object instance without initializing it (calling the constructor)? And if you have any info about ReflectionFactory it will be useful too.
When serializing an object you save all its fields and some extra info. When you deserialize it you have to reconstruct it, by copying the fields back, but not to reinitialize.
import java.lang.reflect.*;
import java.io.Serializable;
import java.security.AccessController;
import sun.reflect.ReflectionFactory;
public class Test0 implements Serializable {
public Test0() {
System.out.println("Test0");
public static void main(String[] args) throws Exception {
Constructor<Test0> constr = reflectionFactory.newConstructorForSerialization(Test0.class, Object.class.getConstructor(new Class[0]));
System.out.println(constr.newInstance(new Object[0]).getClass());
private static final ReflectionFactory reflectionFactory = (ReflectionFactory)
AccessController.doPrivileged(
new ReflectionFactory.GetReflectionFactoryAction());
}When you execute this piece you get:
class Test0 -
Creating dynamic object instance names
If I have a class such as ...
class NewDevice
I would create a new instance of that object by calling 'NewDevice' as ....
NewDevice nd = new NewDevice();
Suppose I don't actually know how many device I need before I read a file in and then subsequently create a new object instance. I could have a long list of variable name i.e. nd1, nd2, nd3 etc but that would be messy and I would be sure to run out.
My Question..........
How do I create object instances with unique names 'on-the-fly' so to speak
ThanksHere's an example that allows you to build up a list of NewDevice instances, see how many there are and get them back by their index in the list:
public class MyClass
List newDeviceList;
public MyClass()
newDeviceList = new ArrayList();
public void addNewDevice(NewDevice newDevice)
newDeviceList.add(newDevice);
public int getNewDeviceCount()
return newDeviceList.size();
public NewDevice getNewDevice(int idx)
return (NewDevice)newDeviceList.get(idx);
}Hope this helps. -
can we create objects(instance of a class in other class) with repect to time
that is i want to create an object for every 30 sec can we do that
iam new to java can anyone help meThere are serveral ways, but creating objects is meaningless without doing something with them.
Thread.sleep() is the simplest call to wait an interval like 30 seconds or you can use a Timer object to call a piece of code periodically.
But I have the feeling that you're coming at the thing from the wrong end. -
How to create and instance of Java Object from an XML Document.
Hi,
How can we use a XML Document to create an instance of Java Object and do vice versa ie from the Java Object creating the XML Document.
XML Document is available in the form of a String Object.
Are there helper class available to achieve this.
I need to do this in a Servlet.
Regards
Pramod.JAXB is part of JavaSE while Xmlbeans claims full schema support and full infoset fidelity.
If the standard APIs do all that you need well then use them. -
Creating multiple instances of a class in LabVIEW object-oriented programming
How do you create multiple instances of a class in a loop? Or am I thinking about this all wrong?
For instance, I read in a file containing this information:
Person Name #1
Person Age #1
Hobby #1
Hobby #2
Hobby #3
Person Name #2
Person Age #2
Hobby #1
Hobby #2
Hobby #3
Person Name #3
Person Age #3
Hobby #1
Hobby #2
Hobby #3
If I define a Person class with name, age, and an array of strings (for the hobbies), how can I create several new Person instances in a loop while reading through the text file?
FYI, new to LabVIEW OOP but familiar with Java OOP. Thank you!First of all, let's get your terminology correct. You are not creating multiple instances of a class. You are creating Objects of the class.
Use autoindexing to create an array of your class type.
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines -
Object instance not getting created
Hi all,
I have created a report using local classes entirely,
I created the object reference and instantiating it in INITIALIZATION event then i'm using one method of the class in AT SELECTION-SCREEN ON event.
now everything is fine except that in some rare cases a a short dump is coming that object is not assigned, this is happening for the same test case also.
Now can there be any case that INITIALIZATION doesnot get executed and directly AT SELECTION-SCREEN is called?
this is happening entirely randomly.
кu03B1ятu03B9кwell here's the dump analysis, you might be interested to look at it, might be there's something i'm missing
INITIALIZATION.
* Too add movement types 101 & 261 as default movement types
l_wa_bwart-sign = c_i. "I
l_wa_bwart-option = c_eq. "EQ
l_wa_bwart-low = c_101. "101
APPEND l_wa_bwart TO s_bwart.
l_wa_bwart-low = c_261. "261
APPEND l_wa_bwart TO s_bwart.
* Instance Creation
CREATE OBJECT: o_validate.
IF sy-subrc IS NOT INITIAL.
MESSAGE e999.
ENDIF.
* Instance Creation
CREATE OBJECT: o_alv.
IF sy-subrc IS NOT INITIAL.
MESSAGE e999.
ENDIF.
* SELECTION SCREEN VALIDATIONS
AT SELECTION-SCREEN ON s_plant.
"To validate plant and check authorisation
CALL METHOD o_validate->validate_p_plant." <---Dump at this statement
AT SELECTION-SCREEN ON s_matnr.
"To validate material
CALL METHOD o_validate->validate_p_matnr.
AT SELECTION-SCREEN ON s_bwart.
"To validate movement type
CALL METHOD o_validate->validate_s_bwart.
Runtime Error OBJECTS_OBJREF_NOT_ASSIGNED
Except. CX_SY_REF_IS_INITIAL
What happened?
Error in ABAP application program.
The current ABAP program "/FIR/RRF2S_A042_001" had to be terminated because one
of the
statements could not be executed.
This is probably due to an error in the ABAP program.
Error analysis
An exception occurred. This exception is dealt with in more detail below
. The exception, which is assigned to the class 'CX_SY_REF_IS_INITIAL', was
neither
caught nor passed along using a RAISING clause, in the procedure
"%_SEL_SCREEN_S_PLANT" "(FORM)"
Since the caller of the procedure could not have expected this exception
to occur, the running program was terminated.
The reason for the exception is:
Attempt to access a component using 'NULL' object reference (points
to nothing).
An object reference must point to an object (an instance of a class)
before you can use it to access components (variable: "O_VALIDATE").
Either the reference has not yet been set, or it has been reset to
'NULL' by a CLEAR statement.
I'm not sure where to move this create object statement.
Edited by: Kartik Tarla on Oct 20, 2009 1:07 PM -
Creating objects in a second instance
I have created a second instance through the console of a directory server, which has been configured with the same rootdn as the original.
When I open up the console why in the new instance does it show the rootdn on the config tab but the original doesnt ......
also ....
why when i go into the second instance i try creating data objects for root suffixes ive created to mirror the original instance, does it create them under cn=config ......
Thanks
GHi
I have read that creating objects in a loop degrades
performance. Can someone explain why this should be
so?Every object creation takes time, so if you create
lot of unnecessary temporary items in loop it degrades
performance (so it is nothing loop specific). -
Create SOFM object instance from PDF
Hi All,
I am using 4.6 version of SAP where FM 'sap_wapi_attachment_add' is does not exit. My query is to create an attachment (SMARTFORM coverted in PDF) in ABAP progam which i have to send as attachment with a Decision Task in the workflow.
I am able to send attachment with mail but to send attachment with decision task i need to create an instance of SOFM object. Please suggest an alternative method to do so instead of FM 'sap_wapi_attachment_add' .Hi Taran,
I had put my code in workflow task. You can find the task method code below:
*Data declaration
DATA: GITAB TYPE SOLIX_TAB,
GSTAB LIKE LINE OF GITAB,
SOFM_KEY TYPE SOFMK,
GIT_LINES TYPE SOLI_TAB.
DATA: LREF_DOCUMENT_BCS TYPE REF TO CL_DOCUMENT_BCS,
LREF_IM_DOCUMENT TYPE REF TO IF_DOCUMENT_BCS.
Generate Smartform*
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = C_FORM
* VARIANT = ' '
* DIRECT_CALL = ' '
IMPORTING
FM_NAME = GV_FM
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'SSF_GET_DEVICE_TYPE'
EXPORTING
I_LANGUAGE = SY-LANGU
* I_APPLICATION = 'SAPDEFAULT'
IMPORTING
E_DEVTYPE = GV_OUTPUT_OPTIONS-TDPRINTER
EXCEPTIONS
NO_LANGUAGE = 1
LANGUAGE_NOT_INSTALLED = 2
NO_DEVTYPE_FOUND = 3
SYSTEM_ERROR = 4
OTHERS = 5.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
GV_OUTPUT_OPTIONS-TDNOPREV = 'X'.
GV_CONTROL_PARAMETERS-GETOTF = 'X'.
GV_CONTROL_PARAMETERS-NO_DIALOG = 'X'.
CALL FUNCTION GV_FM
EXPORTING
* ARCHIVE_INDEX =
* ARCHIVE_INDEX_TAB =
* ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS = GV_CONTROL_PARAMETERS
* MAIL_APPL_OBJ =
* MAIL_RECIPIENT =
* MAIL_SENDER =
OUTPUT_OPTIONS = GV_OUTPUT_OPTIONS
USER_SETTINGS = 'X'
GV_ENAME = GV_ENAME
GV_PERNR = GV_PERNR
GV_PERSK = GV_PERSK
GV_ZZ_LEVEL = GV_ZZ_LEVEL
GV_BTRTX = GV_BTRTX
GV_GBDAT = GV_GBDAT
GV_JOIN_DATE = GV_JOIN_DATE
GV_RESIN_DATE = GV_RESIN_DATE
IMPORTING
DOCUMENT_OUTPUT_INFO = GV_DOCUMENT_OUTPUT_INFO
JOB_OUTPUT_INFO = GV_JOB_OUTPUT_INFO
JOB_OUTPUT_OPTIONS = GV_JOB_OUTPUT_OPTIONS
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'CONVERT_OTF_2_PDF'
* EXPORTING
* USE_OTF_MC_CMD = 'X'
* ARCHIVE_INDEX =
IMPORTING
BIN_FILESIZE = GV_BIN_FILESIZE
TABLES
OTF = GV_JOB_OUTPUT_INFO-OTFDATA
DOCTAB_ARCHIVE = GIT_DOCS
LINES = GIT_LINES_TEMP
EXCEPTIONS
ERR_CONV_NOT_POSSIBLE = 1
ERR_OTF_MC_NOENDMARKER = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
TABLES
CONTENT_IN = GIT_LINES_TEMP
CONTENT_OUT = GIT_LINES.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'SO_SOLITAB_TO_SOLIXTAB'
EXPORTING
IP_SOLITAB = GIT_LINES "GIT_LINES_TEMP1
IMPORTING
EP_SOLIXTAB = GITAB.
*Create SOFM object from smartform PDF
IF NOT GITAB IS INITIAL.
TRY.
CALL METHOD CL_DOCUMENT_BCS=>CREATE_DOCUMENT
EXPORTING
I_TYPE = 'BIN'
I_SUBJECT = 'NOTICE PAY WAIVER FORM'
* I_LENGTH =
* I_LANGUAGE = SPACE
* I_IMPORTANCE =
* I_SENSITIVITY =
* I_TEXT =
I_HEX = GITAB
* I_HEADER =
* I_SENDER =
RECEIVING
RESULT = LREF_DOCUMENT_BCS.
CATCH CX_DOCUMENT_BCS .
ENDTRY.
LREF_IM_DOCUMENT = LREF_DOCUMENT_BCS.
TRY.
CALL METHOD LREF_DOCUMENT_BCS->ADD_DOCUMENT_AS_ATTACHMENT
EXPORTING
IM_DOCUMENT = LREF_IM_DOCUMENT.
CATCH CX_DOCUMENT_BCS .
ENDTRY.
TRY.
CALL METHOD LREF_DOCUMENT_BCS->GET_DOCTP
RECEIVING
RESULT = SOFM_KEY-DOCTP.
CATCH CX_OS_OBJECT_NOT_FOUND .
ENDTRY.
TRY.
CALL METHOD LREF_DOCUMENT_BCS->GET_DOCYR
RECEIVING
RESULT = SOFM_KEY-DOCYR.
CATCH CX_OS_OBJECT_NOT_FOUND .
ENDTRY.
TRY.
CALL METHOD LREF_DOCUMENT_BCS->GET_DOCNO
RECEIVING
RESULT = SOFM_KEY-DOCNO.
CATCH CX_OS_OBJECT_NOT_FOUND .
ENDTRY.
SWC_CREATE_OBJECT NOTICE_PAY_WAIVER_FORM 'SOFM' SOFM_KEY.
SWC_SET_ELEMENT CONTAINER 'NOTICE_PAY_WAIVER_FORM'
NOTICE_PAY_WAIVER_FORM.
ENDIF.
The object instance thus created will be visible along with other object instances in the workitem display. Provide this object in binding of decision step as you provise any other obect instance and not as ATTACH_OBJECT
Regards,
Neha -
Having trouble with creating objects from instances created with ClassLoade
Hi.
I'm having a bit of trouble with casting an instance of an object from a custom ClassLoader. Don't worry - the code isn't for anything sinister - it's for one of those life simulation thingies, but I want to make it modular so people can write their own 'viruses' which compete for survival. You know the score.
Anyway. I've got the beginnings of my main class, which seems to load the class data for all 'virus' classes in a folder called 'strains'. There is a abstract class called AbstractVirus which declares the method calls for how the viruses should behave and to get textual descriptions, etc. AbstractVirus is to be subclassed to create working virus classes and these are what my main class is trying to load instances of.
Unfortuantely, I can't cast the instances into AbstractVirus objects. The error I've been getting is 'ClassCastException' which I presume is something to do with the fact that my ClassLoader and the Bootstrap ClassLoader aren't seeing eye-to-eye with the class types. Can anyone help? This line of programming is really new to me.
My code for the main class is below:
/* LifeSim.java */
public class LifeSim {
public LifeSim() {
/* Get a list of all classes in the 'strains' directory and store non-
* abstract classes in an array. */
Class virusClasses[] = null;
try {
/* Get a reference to the file folder 'strains' and make sure I can read
* from it. */
java.io.File modulesFolder = new java.io.File("strains");
if (!modulesFolder.isDirectory() || !modulesFolder.canRead()) {
System.out.println("Failed to find accessible 'strains' folder");
System.exit(-1);
/* Get a list of all the class files in the folder. */
String virusFiles[] = modulesFolder.list(new ClassFileFilter());
if (virusFiles.length == 0) {
System.out.println("No virus strains in 'strains' folder");
System.exit(-1);
/* Create an array of class objects to store my Virus classes. Ignore the
* abstract class as I cannot instantiate objects directly from it.*/
virusClasses = new Class[virusFiles.length];
VirusClassLoader classLoader = new VirusClassLoader();
int j = 0;
for (int i = 0; i < virusFiles.length; i++) {
String virusName = "strains/" + virusFiles;
Class tempClass = classLoader.loadClass(virusName);
if (tempClass.getName().compareToIgnoreCase("strains.AbstractVirus") != 0) {
virusClasses[j++] = tempClass;
} catch (ClassNotFoundException ncfe) {
System.out.println("Failed to access virus class files.");
ncfe.printStackTrace();
System.exit(-1);
/* TEST CODE: Create an instance of the first virus and print its class
* name and print details taken from methods defined in the AbstractVirus
* class. */
if (virusClasses.length > 0) {
try {
// Print the class name
System.out.println(virusClasses[0].getName());
Object o = virusClasses[0].newInstance();
strains.AbstractVirus av = (strains.AbstractVirus) o;
// Print the virus name and it's description
System.out.println(av.getQualifiedName());
System.out.println(av.getDescription());
} catch (InstantiationException ie) { ie.printStackTrace(); }
catch (IllegalAccessException iae) { iae.printStackTrace(); }
public static void main(String args[]) {
new LifeSim();
class ClassFileFilter implements java.io.FilenameFilter {
public boolean accept(java.io.File fileFolder, String fileName) {
if (_fileName.indexOf(".class") > 0) return true;
return false;
class VirusClassLoader extends ClassLoader {
private String legalClassName = null;
public VirusClassLoader() {
super(VirusClassLoader.class.getClassLoader());
public byte[] findClassData(String filename) {
try {
java.io.File sourcefile = new java.io.File(filename);
legalClassName = "strains." + sourcefile.getName().substring(0,sourcefile.getName().indexOf("."));
java.io.FileInputStream fis = new java.io.FileInputStream(sourcefile);
byte classbytes[] = new byte[fis.available()];
fis.read(classbytes);
fis.close();
return classbytes;
} catch (java.io.IOException ioex) {
return null;
public Class findClass(String classname) throws ClassNotFoundException {
byte classbytes[] = findClassData(classname);
if (classbytes == null) throw new ClassNotFoundException();
else {
return defineClass(legalClassName, classbytes, 0, classbytes.length);
Thank you in advance
MorganTwo things:
I think your custom ClassLoader isn't delegating. In general a ClassLoader should begin by asking it's parent ClassLoader to get a class, and only if the parent loader fails get it itself. AFAIKS you could do what you're trying to do more easilly with URLClassLoader.
Second, beware that a java source file can, and often does, generate more than one class file. Ignore any class files whose names contain a $ character. It's possible you are loading an internal class which doesn't extend your abstract class. -
Can't create object for multi instance when using GetObject("myconfig1")
Hello,
I have the Indesign Server CS6 Multi Instance. I create an instance using the InDesign Server Windows Service:
Port: 12000
Args: -configuration myconfig1
Now I tried in Visual Basic: GetObject("myconfig1")
Then I get a can't create ActiveX component exception.
Notes:
The service "InDesignServerService x64" is running.
The InDesign Server instance was started.
I can access the instance via SOAP: http://localhost:12000/
Why can I not create the object in Visual Basic?
Thank you for help!
HaraldI found that you need to create the object if it does not already exist, to I implemented that with a try catch, try to get it and if you can't then create it. when you start it I also found it was slow so I have to put a pause in to wait for it. The below code should hopefully be enough to help.
Private Sub AttachToInstance(ObjectName As String, InDesignAppPath As String, ByRef Restarted As Boolean)
Try
oInDesign = GetObject(ObjectName)
Catch ex As Exception ' instance not running, start it
Restarted = True
StartInDesignInstance(ObjectName, InDesignAppPath)
Threading.Thread.Sleep(5000)
oInDesign = GetObject(ObjectName)
End Try
End Sub
Private Sub StartInDesignInstance(ObjectName As String, InDesignAppPath As String)
Dim ProcessProperties As New ProcessStartInfo
ProcessProperties.FileName = "InDesignServer"
ProcessProperties.Arguments = "-configuration " & ObjectName
ProcessProperties.CreateNoWindow = True
ProcessProperties.WorkingDirectory = InDesignAppPath
Dim myProcess As Process = Process.Start(ProcessProperties)
End Sub -
How to Create a Instance of Business Object Inside a class?
Hi All,
I am facing a problem regarding , creating a instance of BO inside a global class ( SE24 ). Initially I have included <CNTN02> in the class and i even tried to use the MACRO SWC_CREATE_OBJECT but , the main issue is that my method exporting parameter is not accepting the type SWC_OBJECT in the class for this reason I am not able to pass the instance of the BO.
Any suggestions
Can we acheive this through classes
Do I need to perform Type casting?
Thanks In Advance
PavanHello Pavan
On ERP 6.0 you find the following documentation in include :
* BITTE NEUES INCLUDE CNTN01_SWC benutzen!!!
* Dieses Include führt bei der Nutzung innerhalb eines CLASS-POOLS zu
* einer Vielzahl von Warnungen. Um dieses zu vermeiden, bitte das oben
* genannte Include in den lokalen Implementierungsteil einer gloabeln
* Klasse inkludieren.
*************************** Macros *************************************
* Types
TYPES:
swc_object LIKE obj_record.
Basically it says that you should replace this include with the new include CNTN01_SWC.
If you add type-pool SWC0 to the properties section of your global class you can define method parameters having type SWC0_OBJECT which should be identical to SWC_OBJECT:
TYPE-POOL swc0.
* Types
TYPES:
swc0_object LIKE obj_record.
Regards
Uwe -
Java process quits while trying to create the instance of COM Object
Hi All,
I have a dll file with some API defined. I am trying to use that API using java, so i created a java file with native methods. and created a cpp file in which i am trying to create the instance of the dll file using CreateInstance(__uuidof) method. But the problem is, when the native call tries to execute the CreateInstance(__uuidof) line, jvm quits abruptly, Please suggests me where i am wrong.
Thanks in advance,Be sure that in the current thread you call CoInitialize or CoInitializeEx and on exit Thread you call CoUninitialize.
Maybe you are looking for
-
I have tried to install this new version several times, but each time I got the same message. I have no other program running on the PC when I perform this installation. My present version is 3.6.16. Best regards Tor Blaasmo
-
Can anyone help with reinstalling please?
Was trying to watch tv on son's laptop. It told me to deinstall flash and then reinstall. It deinstalled fine but when I try to reinstall and push the yellow button nothing happens except a small, new window pops up saying "Bad Request". Please ca
-
While iterating through cursor,system reset, refere to exception in thread
here is the exception,thanks. ====================== EXCEPTION ====================== NIP: C0A4FB54 XER: 20000000 LR: C0A5ABD0 SP: C53C2CB0 REGS: c53c2c00 TRAP: 0300 Not tainted MSR: 00009032 EE: 1 PR: 0 FP: 0 ME: 1 IR/DR: 11 DAR: 0000000C, DSISR: 22
-
Synchronizing files from file explorer
I am unable to synchronize the files from files explorer so I can delete them. Any suggestions? Post relates to: Treo 750 (AT&T)
-
JFileChooser crashes JVM - bug basically ignored. What can I do?
See: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7160713 The bug has been marked as incomplete,needs more info, and "Low Prioroty" - Yet there is no mechanism to provide any more information. There is no way to add comments, or vote. The bug b