We are facing an error while running the sample program given below using java API CORBA on InDesign server. we have enabled CORBA on the server. Exception occurred during document create method, also upon calling other app methods like getChildDocuments() or getName(), etc. you help will be appreciated.
Program giving exception(IDL:com/adobe/ids/IdsException) at this line:
Document myDoc = myApp.addDocument(OptArg.noDocumentPreset());
ORBD service running with port 1050.
Exception details:
"C:\Program Files\Java\jdk1.8.0_301\bin\java.exe"
Exception #30465:
com.adobe.ids.IdsException: IDL:com/adobe/ids/IdsException:1.0
at com.adobe.ids.IdsExceptionHelper.read(Unknown Source)
at com.adobe.ids.basics._ApplicationStub.getFullName(Unknown Source)
at com.adobe.ids.sdk.ImprovedHelloWorld.main(ImprovedHelloWorld.java:40)
Exception in thread "main" com.adobe.ids.IdsException: IDL:com/adobe/ids/IdsException:1.0
at com.adobe.ids.IdsExceptionHelper.read(Unknown Source)
at com.adobe.ids.basics._ApplicationStub.consoleout(Unknown Source)
at com.adobe.ids.sdk.ImprovedHelloWorld.main(ImprovedHelloWorld.java:85)
Program sample:
public static void main(String[] args) throws Exception
{
String iorFile = "d:\\ior.txt";
Properties props = new Properties();
props.put("port", "1050");
props.put("org.omg.CORBA.ORBInitialHost", "localhost");
BufferedReader iorIn = new BufferedReader(new FileReader(iorFile));
String application_IOR = iorIn.readLine();
ORB orb = ORB.init(new String [] {iorFile}, props);
Object object = orb.string_to_object(application_IOR);
Application myApp = ApplicationHelper.narrow(object);
Document arr[] = myApp.getAllChildDocuments();
Document myDoc = myApp.addDocument(OptArg.noDocumentPreset());
orb.shutdown(true); // true to wait for completion
orb.destroy();
}
Related
I'm trying to create a secure webservice server and client using Rampart. Web service server was created successful. But when I created client side, I got NoSuchMethodError in ServiceClient.engageModule("rampart").
Here is my client side code:
public static void main(String arg[]) throws Exception
{
ConfigurationContext ctx = ConfigurationContextFactory.createConfigurationContextFromFileSystem("E:\\axis2-1.6.2\\repository", "E:\\axis2-1.6.2\\conf\\axis2.xml");
TestStub stub = new TestStub(ctx,"http://localhost:8080/Axis2WS/services/Test");
ServiceClient sc = stub._getServiceClient();
Options options = sc.getOptions();
options.setUserName("test");
options.setPassword("pass");
options.setProperty(RampartMessageData.KEY_RAMPART_POLICY,
loadPolicy("policy.xml"));
sc.engageModule("rampart");
Test test = new Test();
test.setA(1);
stub.test(test);
stub.addWS();
}
private static Policy loadPolicy(String xmlPath) throws FileNotFoundException, XMLStreamException{
StAXOMBuilder builder = new StAXOMBuilder(xmlPath);
return PolicyEngine.getPolicy(builder.getDocumentElement());
}
Message Error:
Exception in thread "main" java.lang.NoSuchMethodError: org.apache.axiom.soap.SOAPFaultClassifier.getValueAsQName()Ljavax/xml/namespace/QName;
at org.apache.rampart.util.RampartUtil.isSecurityFaultCode(RampartUtil.java:1929)
at org.apache.rampart.util.RampartUtil.isSecurityFault(RampartUtil.java:1919)
at org.apache.rampart.RampartEngine.isSecurityFault(RampartEngine.java:306)
at org.apache.rampart.RampartEngine.process(RampartEngine.java:73)
at org.apache.rampart.handler.RampartReceiver.invoke(RampartReceiver.java:92)
at org.apache.axis2.engine.Phase.invokeHandler(Phase.java:340)
at org.apache.axis2.engine.Phase.invoke(Phase.java:313)
at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:262)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:168)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:364)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:421)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
at com.ex.TestStub.test(TestStub.java:204)
at com.ex.service.testWS.main(testWS.java:39)
This is policy I used.
Thank for your help.
If i call this server method with the client from different location iam getting following error.If i run the client from same location where the server is there I am getting output.
Please give some soltuions to call my rmi server with rmi client from different location.
Error
Exception in thread "main" java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
java.lang.ClassNotFoundException: com.transform.xsl.XslFoTransformer_Stub (no security manager: RMI class loader disabled)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at java.rmi.Naming.lookup(Naming.java:101)
at com.transform.xsl.RmiClient.main(RmiClient.java:15)
Caused by: java.lang.ClassNotFoundException: com.transform.xsl.XslFoTransformer_Stub (no security manager: RMI class loader disabled)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:394)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:184)
at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:637)
at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:264)
at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:222)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1610)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1515)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1769)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1348)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370)
... 3 more
Code ======
import java.io.File;
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface XslFoTransformerInterface extends Remote {
public byte[] doTransform(File stylesheet, File datafile) throws Throwable,RemoteException;
}
public class XslFoTransformer extends UnicastRemoteObject implements XslFoTransformerInterface {
protected XslFoTransformer() throws RemoteException {
super();
}
public byte[] doTransform(File stylesheet, File datafile) throws Exception {
String fileName = datafile.getName();
int pos = fileName.lastIndexOf(".");
if (pos > 0) {
fileName = fileName.substring(0, pos);
}
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
File file = new File(fileName + ".xsl-fo");
try {
// File stylesheet = new
// File("C:\\Users\\Q811213\\Documents\\XSLT\\files\\ECGSearchResultsPDF_changed1.xsl");
// File datafile = new
// File("C:\\Users\\Q811213\\Documents\\XSLT\\files\\NEWDATA.xml");
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse(datafile);
TransformerFactory tFactory = TransformerFactory.newInstance();
StreamSource stylesource = new StreamSource(stylesheet);
Transformer transformer = tFactory.newTransformer(stylesource);
DOMSource source = new DOMSource(document);
ByteArrayOutputStream bos=new ByteArrayOutputStream();
StreamResult result=new StreamResult(bos);
transformer.transform(source, result);
byte [] array=bos.toByteArray();
return array;
} catch (Exception e) {
throw e;
}}}
--Rmi server class
public class RmiServer {
public static void main(String args[]) throws Exception{
try{
XslFoTransformerInterface stub=new XslFoTransformer();
Naming.rebind("rmi://localhost:1099/Xsl-Fo_Transform",stub);
}catch(Exception e){
throw e;
}
}
}
--Rmi client created in different location
public class RmiClient {
public static void main(String args[]) throws Throwable {
try {
XslFoTransformerInterface stub = (XslFoTransformerInterface) Naming
.lookup("rmi://localhost:1099/Xsl-Fo_Transform");
System.out.println("stub is ready" + stub);
File f1 = new File(
"C:\\Users\\s811213\\osbwstest\\XSL-FO_Transformer\\files\\ECGSearchResultsPDF_changed1.xsl");
File f2 = new File(`enter code here`
"C:\\Users\\s811213\\osbwstest\\XSL-FO_Transformer\\files\\NEWDATA.xml");
try {
byte[] f = stub.doTransform(f1, f2);
}cartch(){}
}}
If i call this server method with the client from different location iam getting following error.If i run the client from same location where the server is there i am getting output.
Please give some soltuions to call my rmi server with rmi client from different location.
You need to deploy the stub class named in the exception to the client.
In RMI client
XslFoTransformerInterface stub = (XslFoTransformerInterface) Naming
.lookup("rmi://localhost:1099/Xsl-Fo_Transform");
you need to change localhost to server ip
I'm not sure if you running your program in different locations (no the server machine) with the updated version of your code for ip which you hard coded for localhost.
If this is not the problem, you must be sure that you placed the XslFoTransformerInterface class in your client codes in the same package as it is in server codes.
Also in the future if you have some Serializable POJO classes as the arguments or the return types of you remote methods, same rule is applied for them. Always put them in the same package as they reside is the server codes.
Good Luck.
I am using the JClouds-Chef API to bootstrap a Linux VM (myapp01.me.example.com) with Chef Client, and to then run the client and configure the VM with its app stack via a typicalapp role:
package com.me.myorg.chef;
import org.jclouds.Constants
import org.jclouds.ContextBuilder
import org.jclouds.chef.ChefContext
import org.jclouds.chef.ChefService
import org.jclouds.chef.config.ChefProperties
import org.jclouds.chef.domain.BootstrapConfig
import org.jclouds.chef.util.RunListBuilder
import org.jclouds.compute.domain.ExecResponse
import org.jclouds.compute.domain.OsFamily
import org.jclouds.domain.LoginCredentials
import org.jclouds.scriptbuilder.domain.Statement
import org.jclouds.ssh.SshClient
import org.jclouds.sshj.config.SshjSshClientModule
import com.google.common.base.Charsets
import com.google.common.collect.ImmutableSet
import com.google.common.io.Files
import com.google.common.net.HostAndPort
import com.google.inject.Key
import com.google.inject.TypeLiteral
public class ChefProvisioner {
public static void main(String[] args) {
ChefProvisioner.provision()
}
public static provision() {
String vmIp = "myapp01.me.example.com"; // A Linux VM living in our local vCenter
String vmSshUsername = "admin";
String vmSshPassword = "12345";
String endpoint = "https://mychefserver";
String client = "myuser";
String validator = "chef-validator";
String clientCredential = Files.toString(new File("C:\\Users\\myuser\\sandbox\\chef\\myuser.pem"), Charsets.UTF_8);
String validatorCredential = Files.toString(new File("C:\\Users\\myuser\\sandbox\\chef\\chef-validator.pem"), Charsets.UTF_8);
Properties props = new Properties();
props.put(ChefProperties.CHEF_VALIDATOR_NAME, validator);
props.put(ChefProperties.CHEF_VALIDATOR_CREDENTIAL, validatorCredential);
props.put(Constants.PROPERTY_RELAX_HOSTNAME, "true");
props.put(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
ChefContext ctx = ContextBuilder.newBuilder("chef")
.endpoint(endpoint)
.credentials(client, clientCredential)
.overrides(props)
.modules(ImmutableSet.of(new SshjSshClientModule())) //
.buildView(ChefContext.class);
ChefService chef = ctx.getChefService();
List<String> runlist = new RunListBuilder().addRole("typicalapp").build();
BootstrapConfig bootstrapConfig = BootstrapConfig.builder().runlist(runlist).build();
chef.updateBootstrapConfigForGroup("jclouds-chef", bootstrapConfig);
Statement bootstrap = chef.createBootstrapScriptForGroup("jclouds-chef");
SshClient.Factory sshFactory = ctx.unwrap().utils()
.injector().getInstance(Key.get(new TypeLiteral<SshClient.Factory>() {}));
SshClient ssh = sshFactory.create(HostAndPort.fromParts(vmIp, 22),
LoginCredentials.builder().user(vmSshUsername).password(vmSshPassword).build());
ssh.connect();
try {
String rawScript = bootstrap.render(OsFamily.UNIX);
ExecResponse result = ssh.exec(rawScript);
} finally {
ssh.disconnect();
}
}
}
When I run this I get:
Exception in thread "main" java.util.ServiceConfigurationError: org.jclouds.apis.ApiMetadata: Provider org.jclouds.openstack.swift.SwiftApiMetadata could not be instantiated: java.lang.IllegalAccessError: tried to access class com.google.common.reflect.TypeResolver from class org.jclouds.util.TypeToken2
at java.util.ServiceLoader.fail(ServiceLoader.java:224)
at java.util.ServiceLoader.access$100(ServiceLoader.java:181)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:377)
at java.util.ServiceLoader$1.next(ServiceLoader.java:445)
at com.google.common.collect.ImmutableCollection$Builder.addAll(ImmutableCollection.java:323)
at com.google.common.collect.ImmutableSet$Builder.addAll(ImmutableSet.java:633)
at org.jclouds.apis.Apis.all(Apis.java:72)
at org.jclouds.apis.Apis.withId(Apis.java:89)
at org.jclouds.ContextBuilder.newBuilder(ContextBuilder.java:168)
at org.jclouds.ContextBuilder$newBuilder.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at com.me.myorg.chef.ChefProvisioner.provision(ChefProvisioner.groovy:51)
at com.me.myorg.chef.ChefProvisioner$provision.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)
at com.me.myorg.chef.ChefProvisioner.main(ChefProvisioner.groovy:27)
Caused by: java.lang.IllegalAccessError: tried to access class com.google.common.reflect.TypeResolver from class org.jclouds.util.TypeToken2
at org.jclouds.util.TypeToken2.where(TypeToken2.java:47)
at org.jclouds.rest.internal.BaseRestApiMetadata.contextToken(BaseRestApiMetadata.java:60)
at org.jclouds.rest.internal.BaseRestApiMetadata$Builder.<init>(BaseRestApiMetadata.java:74)
at org.jclouds.openstack.swift.SwiftApiMetadata$Builder.<init>(SwiftApiMetadata.java:85)
at org.jclouds.openstack.swift.SwiftApiMetadata$Builder.<init>(SwiftApiMetadata.java:81)
at org.jclouds.openstack.swift.SwiftApiMetadata$ConcreteBuilder.<init>(SwiftApiMetadata.java:108)
at org.jclouds.openstack.swift.SwiftApiMetadata$ConcreteBuilder.<init>(SwiftApiMetadata.java:108)
at org.jclouds.openstack.swift.SwiftApiMetadata.<init>(SwiftApiMetadata.java:60)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at java.lang.Class.newInstance(Class.java:374)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:373)
... 16 more
Any ideas as to what is going on here?
You will need the following, in order to be able to bootstrap your VM:
The ip address of the VM. It must be reachable, have the port 22 open (as the bootstrap will be done via SSH) and have access to the Internet so it can install Ruby and Chef.
A client in the Chef Server and its corresponding private key. That client is used by jclouds to perform the operations against the Chef Server REST API.
The validator certificate. That certificate will be uploaded to the node so it can self-register in the Chef Server.
In this case, as the jclouds ComputeService is not being used, you'll have to manually instantiate an SSH client to connect to the virtual machine, but it should be pretty straightforward.
In the example you mention, the Git repo is cloned when using ChefSolo, but since you have a Chef Server the only thing you need to do is to configure the connection and the desired run list and attributes.
A minimal program to do that would require the following dependencies:
<!-- Required dependencies -->
<dependency>
<groupId>org.apache.jclouds.driver</groupId>
<artifactId>jclouds-sshj</artifactId>
<version>${jclouds.version}</version>
</dependency>
<dependency>
<groupId>org.apache.jclouds.api</groupId>
<artifactId>chef</artifactId>
<version>${jclouds.version}</version>
</dependency>
And it could be something like the following:
Update: I've changed the configuration to match the provided knife.rb configuration, and also added a couple properties to avoid SSL errors, as your Chef endpoint is https.
// Configuration
String vmIp = "vm-ip";
String vmSshUsername = "root";
String vmSshPassword = "foo";
String endpoint = "https://mychefserver.example.com";
String client = "myuser";
String validator = "chef-validator";
String clientCredential = Files.toString(new File("/home/myuser/.chef/myuser.pem"), Charsets.UTF_8);
String validatorCredential = Files.toString(new File("/home/myuser/.chef/chef-validator.pem"), Charsets.UTF_8);
Properties props = new Properties();
props.put(ChefProperties.CHEF_VALIDATOR_NAME, validator);
props.put(ChefProperties.CHEF_VALIDATOR_CREDENTIAL, validatorCredential);
props.put(Constants.PROPERTY_RELAX_HOSTNAME, "true");
props.put(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
/* *** First, create the context to connect to the Chef Server *** */
// Create the context and configure the SSH driver to use. sshj in this example
ChefContext ctx = ContextBuilder.newBuilder("chef")
.endpoint(endpoint)
.credentials(client, clientCredential)
.overrides(props)
.modules(ImmutableSet.of(new SshjSshClientModule())) //
.buildView(ChefContext.class);
CherService chef = ctx.getChefService();
/* *** Second, generate the bootstrap script *** */
// Generate the bootsrap configuration
List<String> runlist = new RunListBuilder().addRole("typicalapp").build();
BootstrapConfig bootstrapConfig = BootstrapConfig.builder().runlist(runlist).build();
// Generate the bootstrap script to be executed in the VM (this will persist
// the configuration in a data bag under the key 'jclouds-chef' so it can be reused
// and then build the bootstrap script with the information in the configuration data bag)
chef.updateBootstrapConfigForGroup("jclouds-chef", bootstrapConfig);
Statement bootstrap = chef.createBootstrapScriptForGroup("jclouds-chef");
/* *** Finally create an SSH connection manually and run the script on the VM *** */
SshClient.Factory sshFactory = ctx.unwrap().utils()
.injector().getInstance(Key.get(new TypeLiteral<SshClient.Factory>() {}));
SshClient ssh = sshFactory.create(HostAndPort.fromParts(vmIp, 22),
LoginCredentials.builder().user(vmSshUsername).password(vmSshPassword).build());
ssh.connect();
try {
String rawScript = bootstrap.render(OsFamily.UNIX);
ExecResponse result = ssh.exec(rawScript);
} finally {
ssh.disconnect();
}
magento api using soap doesn't work due to missing magento-api.properties files, can someone help?
public class testConnection {
public static void main(String[] args) throws AxisFault {
String user = "rajeshvishnani";
String pass = "123456";
String host = "http://cypherincorporated.co.in/magento/index.php/api/soap?wsdl";
SoapConfig soapConfig = new SoapConfig(user, pass, host);
MagentoSoapClient magentoSoapClient = MagentoSoapClient.getInstance(soapConfig);
magentoSoapClient.setConfig(soapConfig);
}
}
Exception in thread "main" java.lang.IllegalArgumentException: could not load [magento-api.properties] as a classloader resource
at com.google.code.magja.utils.PropertyLoader.loadProperties(PropertyLoader.java:106)
at com.google.code.magja.utils.PropertyLoader.loadProperties(PropertyLoader.java:123)
at com.google.code.magja.soap.MagentoSoapClient.getInstance(MagentoSoapClient.java:69)
at magentomanager.testConnection.main(testConnection.java:15)
Try changing the url to 'http://yoursite.com/api/v2_soap/index?wsdl=1'.
Please provide more details.
Not sure about java exception but you can try following link.
Link
I'm at the very early stages of a project requiring the broadcasting, using RTP, of a DataStream created from a MediaLocation. I'm following some example code which currently failingin on the rptManager.initalize(localAddress) with the error "Can't open local data port: xxxx", specifically:
Exception in thread "main" javax.media.rtp.InvalidSessionAddressException: Can't open local data port: 34586
at com.sun.media.rtp.RTPSessionMgr.initialize(RTPSessionMgr.java:2688)
at com.sun.media.rtp.RTPSessionMgr.initialize(RTPSessionMgr.java:2515)
at RTPBroadcast.main(RTPBroadcast.java:20)
I'm developing on Lucid and my firewall is completely disabled. I'm a little stumped to be honest. My code is as follows:
// http://jcs.mobile-utopia.com/jcs/26201_RTPManager.java
public class RTPBroadcast {
public static void main (String[] args) throws InvalidSessionAddressException, IOException, UnsupportedFormatException {
RTPManager rtpManager = RTPManager.newInstance();
SessionAddress localAddress = new SessionAddress();
rtpManager.initialize(localAddress);
InetAddress ipAddress = InetAddress.getByName("192.168.1.5");
SessionAddress remoteAddress = new SessionAddress(ipAddress, 3000);
rtpManager.addTarget(remoteAddress);
DataSource dataOutput = new ScreenSource();
SendStream sendStream = rtpManager.createSendStream( dataOutput, 1);
sendStream.start();
}
}
Any ideas on what could be causing the problem?
If your problem currently isn't solved, try to look at jlibrtp instead of jmf.