tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mansour Al Akeel <mansour.alak...@gmail.com>
Subject Re: Starting OpenEJB embedded in another JVM
Date Fri, 21 Nov 2014 05:15:58 GMT
Thank you Andy and Romain. I did was passing the argument in quote,
and this is what caused the issue.


On Sat, Nov 15, 2014 at 11:21 PM, Andy Gumbrecht
<agumbrecht@tomitribe.com> wrote:
> Try using a ProcessBuilder.
>
> Andy.
>
> http://www.tomitribe.com - @AndyGeeDe - On a mobile device, and I have fat
> fingers. Sorry for typos.
> On 15 Nov 2014 09:10, "Mansour Al Akeel" <mansour.alakeel@gmail.com> wrote:
>
>> I am trying to fork a java process, where the subprocess runs openejb.
>> I am passing the classpath as an argument to the child process:
>>
>>
>> String classpath = classpathBuilder.toString();
>>     StringBuilder commandBuilder = new StringBuilder();
>>
>>     commandBuilder.append(javaBin);
>>
>>     commandBuilder.append(" -Djdbc.driver='" + driver);
>>     commandBuilder.append("' -Djdbc.url='" + url);
>>     commandBuilder.append("' -Djdbc.username='" + username);
>>     commandBuilder.append("' -Djdbc.password='" + password + "'");
>>
>>     commandBuilder.append(" -cp '");
>>     commandBuilder.append(classpath);
>>     commandBuilder.append("' ");
>>
>>     commandBuilder.append(" -Xdebug
>> -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005 ");
>>     commandBuilder.append(className);
>>
>>
>> Process process = Runtime.getRuntime().exec(command);
>>
>>
>> In the child process I have
>>
>>     Class cls = Class.forName("org.postgresql.Driver");
>>
>>
>>     System.setProperty("openejb.classloader.forced-load",
>> "org.postgresql");
>>
>> properties.put(Context.INITIAL_CONTEXT_FACTORY,
>> "org.apache.openejb.client.LocalInitialContextFactory");
>>
>>     properties.put("openejb.validation.output.level", "VERBOSE");
>>
>>     String driver = System.getProperty("jdbc.driver");
>>     String url = System.getProperty("jdbc.url");
>>     String username = System.getProperty("jdbc.username");
>>     String password = System.getProperty("jdbc.password");
>>
>>     properties.put("jdbc/dataSource", "new://Resource?type=DataSource");
>>     properties.put("jdbc/dataSource.JdbcDriver", driver);
>>     properties.put("jdbc/dataSource.JdbcUrl", url);
>>     properties.put("jdbc/dataSource.UserName", username);
>>     properties.put("jdbc/dataSource.Password", password);
>>
>> However, I am getting this error:
>>
>> INFO - Creating TransactionManager(id=Default Transaction Manager)
>> INFO - Creating SecurityService(id=Default Security Service)
>> INFO - Creating Resource(id=jdbc/dataSource)
>> SEVERE - FATAL ERROR: Unknown error in Assembler.  Please send the
>> following stack trace and this message to users@openejb.apache.org :
>>  org.apache.xbean.propertyeditor.PropertyEditorException: Unable to
>> resolve class 'org.postgresql.Driver'
>>         at
>> org.apache.xbean.propertyeditor.ClassEditor.toObjectImpl(ClassEditor.java:43)
>>         at
>> org.apache.xbean.propertyeditor.AbstractConverter.toObject(AbstractConverter.java:86)
>>         at
>> org.apache.xbean.propertyeditor.PropertyEditors.getValue(PropertyEditors.java:284)
>>         at
>> org.apache.xbean.recipe.RecipeHelper.convert(RecipeHelper.java:172)
>>         at
>> org.apache.xbean.recipe.ObjectRecipe.extractConstructorArgs(ObjectRecipe.java:592)
>>         at
>> org.apache.xbean.recipe.ObjectRecipe.internalCreate(ObjectRecipe.java:275)
>>         at
>> org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:96)
>>         at
>> org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:61)
>>         at
>> org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:49)
>>         at
>> org.apache.openejb.assembler.classic.Assembler.createResource(Assembler.java:2120)
>>         at
>> org.apache.openejb.assembler.classic.Assembler.buildContainerSystem(Assembler.java:490)
>>         at
>> org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:409)
>>         at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:148)
>>         at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:65)
>>         at org.apache.openejb.OpenEJB.init(OpenEJB.java:296)
>>         at org.apache.openejb.OpenEJB.init(OpenEJB.java:276)
>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>         at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>>         at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>         at java.lang.reflect.Method.invoke(Method.java:601)
>>         at
>> org.apache.openejb.loader.OpenEJBInstance.init(OpenEJBInstance.java:36)
>>         at
>> org.apache.openejb.core.LocalInitialContextFactory.init(LocalInitialContextFactory.java:96)
>>         at
>> org.apache.openejb.core.LocalInitialContextFactory.init(LocalInitialContextFactory.java:60)
>>         at
>> org.apache.openejb.core.LocalInitialContextFactory.getInitialContext(LocalInitialContextFactory.java:44)
>>         at
>> javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:684)
>>         at
>> javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:307)
>>
>>
>> I am sure the jdbc driver is in the classpath because I can load it
>> successfully.
>>
>> Any idea ??
>>
>> Thank you.
>>

Mime
View raw message