I am trying to load a method present in a .jar. Following is code snippet
JavaVMInitArgs vm_args;
memset(&vm_args, 0, sizeof(vm_args));
JavaVMOption* options = new JavaVMOption[1];
options[0].optionString =
"- Djava.class.path=C:\\Users\\Desktop\\POC\\POC\\Debug\\Sample2.jar;
vm_args.version = JNI_VERSION_1_6;
vm_args.nOptions = 1;
vm_args.options = options;
vm_args.ignoreUnrecognized = 0;
JNI_GetDefaultJavaVMInitArgs(&vm_args);
m_Status = JNI_CreateJavaVM_ptr (&m_JVM, (void**)&m_JavaEnv, &vm_args);
But when I use the
classForJava = m_JavaEnv->FindClass ("Sample2");
classForJava contains 0.
Specify full name of the class including package name with . replaced with /.
For exampe if your Sample2 class is in org.test package, use m_JavaEnv->FindClass ("org/test/Sample2");
By the way, it might be a typo but the optionString space between - and Djava.class.path should be removed.
Related
I have built a shared module on apache 2.4. I could get the apache build succesfull. On apache start there is a dump at the below line:
if (r != NULL) ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r, "test");
I derefernce the structure variable r which is of type server_rec(apache struct) and below is the value in dbx
(dbx) p *r
(process = 0x000000011001fa88, next = (nil), error_fname = "logs/error_log", error_log = 0x000000011001fa10, log = (module_levels = (nil), level = 4), module_config = 0x0000000110053420, lookup_defaults = 0x0000000110054ef8, defn_name = (nil), defn_line_number = 0, is_virtual = '\0', port = 0, server_scheme = (nil), server_admin = "you#example.com", server_hostname = "isi081.wdf.sap.corp", addrs = 0x000000011004e410, timeout = 60000000, keep_alive_timeout = 5000000, keep_alive_max = 100, keep_alive = 1, names = (nil), wild_names = (nil), path = (nil), pathlen = 0, limit_req_line = 8190, limit_req_fieldsize = 8190, limit_req_fields = 100, context = (nil))
I do not see any corruption in memory. But still there is a dump on apache start.
If i comment out this line, then everything works as expected. Apache starts and i am able to complete the operation as well. But we would need this statement in order to have logging enabled. Is there any other alternative or fix for the same.
The same code is working for other platforms like linux,solaris and HP on apache 2.4.
ALso on aix with apache 2.2 the same code works. Only on apache 2.4 this issue is observed.
Any help would be highly appreciated.
I'm thinking you did not fully compile against 2.4 headers, and "ap_log_error" was not treated as the macro it is in 2.4.
Also, that server_rec named "r" is super misleading. "r" is traditionally a request_rec. I can't believe it's not actually the source of your problem, and maybe it is somehow indirectly.
I followed all the steps mentioned on create custom module in vtiger 6 to create custom module but I am getting the error Module already present - choose a different name
Please advice.
As your are using vtiger 6.4 , there are lot of difference between vTiger 6 and vtiger6.4.
Try with the below script as I am using same for new module creation. Use new module name. And change the UI Types and field labels as per your requirement.
<?php
$Vtiger_Utils_Log = true;
include_once('vtlib/Vtiger/Menu.php');
include_once('vtlib/Vtiger/Module.php');
$module = new Vtiger_Module();
$module->name = 'Your_MODULE_NAME';
$module->parent = 'Tools';
$module->save();
$module->initTables();
$module->initWebservice();
$block = new Vtiger_Block();
$block->label = 'LBL_INFORMATION_DETAIL';
$module->addBlock($block); //to create a new block
$field1 = new Vtiger_Field();
$field1->name = 'browse';
$field1->table=$module->basetable;
$field1->label= 'Upload Csv';
$field1->column = 'browse';
$field1->columntype = 'VARCHAR(255)';
$field1->uitype= 28;
$field1->typeofdata = 'V~O';
$block->addField($field1);
$field2 = new Vtiger_Field();
$field2->name = 'fieldid';
$field2->table=$module->basetable;
$field2->label= 'Record ID';
$field2->uitype= 4;
$field2->column = 'fieldid';
$field2->columntype = 'VARCHAR(255)';
$field2->typeofdata = 'V~M';
$block->addField($field2);
$module->setEntityIdentifier($field2);
$field3 = new Vtiger_Field();
$field3->name = 'age';
$field3->table=$module->basetable;
$field3->label= 'Age';
$field3->uitype= 1;
$field3->column = 'age';
$field3->columntype = 'VARCHAR(100)';
$field3->typeofdata = 'V~O';
$block->addField($field3);
$field4 = new Vtiger_Field();
$field4->name = 'statusrecord';
$field4->table=$module->basetable;
$field4->label= 'Status';
$field4->uitype= 15;
$field4->column = 'statusrecord';
$field4->columntype = 'VARCHAR(255)';
$field4->setPicklistValues( Array('new','closed','closedwithfailure','inprogress'));
$field4->typeofdata = 'V~M';
$block->addField($field4);
// Recommended common fields every Entity module should have (linked to core table)
$field5 = new Vtiger_Field();
$field5->name = 'assigned_user_id';
$field5->label = 'Assigned To';
$field5->table = 'Vtiger_crmentity';
$field5->column = 'smownerid';
$field5->uitype = 53;
$field5->typeofdata = 'V~M';
$block->addField($field5);
$field6 = new Vtiger_Field();
$field6->name = 'CreatedTime';
$field6->label= 'Created Time';
$field6->table = 'Vtiger_crmentity';
$field6->column = 'createdtime';
$field6->uitype = 70;
$field6->typeofdata = 'T~O';
$field6->displaytype= 2;
$block->addField($field6);
$field7 = new Vtiger_Field();
$field7->name = 'ModifiedTime';
$field7->label= 'Modified Time';
$field7->table = 'Vtiger_crmentity';
$field7->column = 'modifiedtime';
$field7->uitype = 70;
$field7->typeofdata = 'T~O';
$field7->displaytype= 2;
$block->addField($field7);
// Filter Setup
$filter1 = new Vtiger_Filter();
$filter1->name = 'All';
$filter1->isdefault = true;
$module->addFilter($filter1);
// Add fields to the filter create
$filter1->addField($field7, 2);
$filter1->addField($field3, 3);
$filter1->addField($field4, 5);
/** Set sharing access of this module */
$module->setDefaultSharing();
/** Enable and Disable available tools */
$module->enableTools(Array('Import', 'Export'));
$module->disableTools('Merge');
?>
You can also refer Entity-Module-Documentation
I have the following JSON:
{"test1":"1", "test2": {"test21":"21", "test22":"22"}}"
but I'm having troubles parsing it. Actually, I'm somehow trying to read "test21" but don't know how to reach it. I tried this but it's not good:
UnicodeString myJSON = "{\"test1\" :\"1\",\"test2\":{\"test21\":\"21\",\"test22\":\"22\"}}";
TJSONObject *JSON = (TJSONObject*)TJSONObject::ParseJSONValue(myJSON);
TJSONValue *test2 = (TJSONValue*)JSON->Get("test2");
//TJSONString* test21 = (TJSONString*)test2->Get("test21");
TJSONObject *JSON = (TJSONObject*)TJSONObject::ParseJSONValue(myJSON);
TJSONPair *pair = JSON->Get("test2");
TJSONObject *jsonObj = (TJSONObject*) pair->JsonValue;
TJSONPair *test21 = jsonObj->Get("test21");
String value = test21->JsonValue->ToString();
I'm trying to write an application that would work with the EWS proxy classes. To generate proxy classes I used gsoap (compiled OpenSSL).
I have implemented a library that works with EWS, but. Net.
The problem is this: I have no idea how to implement a connection to the server.
Doing the following:
ExchangeServiceBindingProxy *proxy = new ExchangeServiceBindingProxy("https://192.168.0.49/EWS/exchange.asmx");
soap *pSoap = proxy->soap;
pSoap->userid = "user1";
pSoap->passwd = "password1";
pSoap->recv_timeout = 300;
pSoap->send_timeout = 300;
SOAP_ENV__Header *header = new SOAP_ENV__Header();
header->ns3__RequestServerVersion = new _ns3__RequestServerVersion();
header->ns3__RequestServerVersion->soap = pSoap;
header->ns3__RequestServerVersion->Version = ns3__ExchangeVersionType__Exchange2010;
pSoap->header = header;
//get root folder ID
ns3__DistinguishedFolderIdType *dfit = new ns3__DistinguishedFolderIdType();
dfit->Id = ns3__DistinguishedFolderIdNameType__inbox;
//set the props that we want to retrieve
ns3__FolderResponseShapeType *frst = new ns3__FolderResponseShapeType();
frst->BaseShape = ns3__DefaultShapeNamesType__AllProperties;
//get folder
ns1__GetFolderType *gftRoot = new ns1__GetFolderType();
gftRoot->FolderIds = new ns3__NonEmptyArrayOfBaseFolderIdsType();
gftRoot->FolderIds->__union_NonEmptyArrayOfBaseFolderIdsType = new __ns3__union_NonEmptyArrayOfBaseFolderIdsType();
gftRoot->FolderIds->__union_NonEmptyArrayOfBaseFolderIdsType->union_NonEmptyArrayOfBaseFolderIdsType.DistinguishedFolderId = dfit;
gftRoot->FolderShape = frst;
__ns1__GetFolderResponse response;
int error = proxy->GetFolder(gftRoot, response);
As a result, getting the error: SLL_ERROR.
I know, that i`m doing something wrong. But what? What i should to do, to use proxy classes functions?
I resolved it by myself:
Added to project LibNTLM and added to preprocessor WITH_NTLM.
Also changed code, a little bit:
ExchangeServiceBindingProxy *proxy = new ExchangeServiceBindingProxy(endpoint.c_str());
soap *pSoap = proxy->soap;
pSoap->userid = "Ivan1";
pSoap->passwd = "1";
pSoap->ntlm_challenge = "";
pSoap->authrealm = "Ursa-Minor";
pSoap->ssl_flags = SOAP_SSL_NO_AUTHENTICATION;
//pSoap->keep_alive = true;
pSoap->mode = SOAP_IO_KEEPALIVE;
//get root folder ID
ns3__DistinguishedFolderIdType *dfit = new ns3__DistinguishedFolderIdType();
dfit->Id = ns3__DistinguishedFolderIdNameType__inbox;
//set the props that we want to retrieve
ns3__FolderResponseShapeType *frst = new ns3__FolderResponseShapeType();
frst->BaseShape = ns3__DefaultShapeNamesType__AllProperties;
//get folder
ns1__GetFolderType *gftRoot = new ns1__GetFolderType();
gftRoot->FolderIds = new ns3__NonEmptyArrayOfBaseFolderIdsType();
gftRoot->FolderIds->__size_NonEmptyArrayOfBaseFolderIdsType = 1;
gftRoot->FolderIds->__union_NonEmptyArrayOfBaseFolderIdsType = new __ns3__union_NonEmptyArrayOfBaseFolderIdsType();
gftRoot->FolderIds->__union_NonEmptyArrayOfBaseFolderIdsType->union_NonEmptyArrayOfBaseFolderIdsType.DistinguishedFolderId = dfit;
gftRoot->FolderIds = (ns3__NonEmptyArrayOfBaseFolderIdsType*)dfit;
gftRoot->FolderShape = frst;
__ns1__GetFolderResponse response;
int qq = proxy->GetFolder(gftRoot, response);
return true;
But now i have enother problems: Error 500: Internal Server Error
I'm trying to get ID3D11VideoDecoder Decoder with h264 decoder profile but catching exception on Windows Phone 8.
Using this code:
DX::ThrowIfFailed(device.Get()->QueryInterface(__uuidof(ID3D11VideoDevice), (void**)&videoDevice));
GUID guid = {0x1b81be68, 0xa0c7,0x11d3,{0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5}};
D3D11_VIDEO_DECODER_DESC *desc = new D3D11_VIDEO_DECODER_DESC();
desc->Guid = guid;
desc->OutputFormat = DXGI_FORMAT_420_OPAQUE;
desc->SampleHeight = 480;
desc->SampleWidth = 800;
D3D11_VIDEO_DECODER_CONFIG *conf = new D3D11_VIDEO_DECODER_CONFIG();
ID3D11VideoDecoder *decoder;
DX::ThrowIfFailed(videoDevice.Get()->CreateVideoDecoder(desc, conf, &decoder));
PS. I tried SharpDX for this and got the same issue.
It seems you didn't pass in a valid D3D11_VIDEO_DECODER_CONFIG variable. you just define a pointer of struct D3D11_VIDEO_DECODER_CONFIG and didn't set the values of it before calling function CreateVideoDecoder.
D3D11_VIDEO_DECODER_CONFIG *conf = new D3D11_VIDEO_DECODER_CONFIG();
DX::ThrowIfFailed(videoDevice.Get()->CreateVideoDecoder(desc, conf, &decoder));
You can try it as below.
D3D11_VIDEO_DECODER_CONFIG conf
ZeroMemory(&conf, sizeof(conf));
conf.guidConfigBitstreamEncryption = xxx;
...
conf.ConfigDecoderSpecific = xxx;
DX::ThrowIfFailed(videoDevice.Get()->CreateVideoDecoder(desc, conf, &decoder));
So, I found solution.
for H264 decoder ConfigBitstreamRaw field must be "2". Not "1", not "0". Only "2". Like this
VideoDecoderDescription decoderDescription = new VideoDecoderDescription();
decoderDescription.OutputFormat = Format.Opaque420;
decoderDescription.SampleHeight = 480;
decoderDescription.SampleWidth = 800;
decoderDescription.Guid = _formatGuid;
VideoDecoderConfig config = new VideoDecoderConfig();
config.ConfigMinRenderTargetBuffCount = 1;
config.ConfigBitstreamRaw = 2;