[JNDI/Naming/Network] - InitialContext error in JBoss 5.x.x
by leeroy
Hi,
I have a strange error when I try to use a DatatSource with JNDI in JBoss 5.0.0.GA, 5.0.1.GA or 5.1.0.Beta1 but not with JBoss 4.2.2
with JRE 1.6
...
| 11:29:19,223 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name 'java:JmsXA'
| 11:29:19,317 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=jdbc/MyDatasource' to JNDI name 'java:jdbc/MyDatasource'
| ...
| javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory. Root exception is
| java.lang.ClassCastException: org.jnp.interfaces.NamingContextFactory cannot be cast to javax.naming.spi.InitialContextFactory
| at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:659)
| at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:250)
| at javax.naming.InitialContext.init(InitialContext.java:226)
| at javax.naming.InitialContext.<init>(InitialContext.java:182)
| at com.MyPackage.MyClass.MyFunction(MyClass.java:xxx) and it's nearly with JDK 1.5
...
| 11:29:19,223 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name 'java:JmsXA'
| 11:29:19,317 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=jdbc/MyDatasource' to JNDI name 'java:jdbc/MyDatasource'
| ...
| javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory. Root exception is
| java.lang.ClassCastException: org.jnp.interfaces.NamingContextFactory
| at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:659)
| at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:250)
| at javax.naming.InitialContext.init(InitialContext.java:226)
| at javax.naming.InitialContext.<init>(InitialContext.java:182)
| at com.MyPackage.MyClass.MyFunction(MyClass.java:xxx)
In MyFunction, the error appear on Context initCtx = new InitialContext();
I use de default serveur and I have copyed then edited mssql-ds.xml in server\default\deploy
I have Windows XP SP3.
I don't understand what can be my mistake because the error seem be in JBoss source.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4222942#4222942
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4222942
17 years
[JBoss jBPM] - Re: Don't see running process in JBPM
by DeanDeen
Still struggling with this one.
Now I work with process definition that is already in Oracle DB. So I create new instances of process or manipulate existing ones.
Still I am not getting data, that is changed within application, saved in DB until I don't restart Jboss server.
example:
I log in in my application and am able to se my current process instances. But f I change existing one (go to next task) or create new instance, nothing is seen in DB...until I restart server.
On the other hand if I correct some data directly in DB and I refresh my application I get new data.
There must be some cache which I don't know how to handle on process changes!?!
I would appreciate some example of similar working app. or some hint...
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4222934#4222934
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4222934
17 years
[Javassist user questions] - VerifyError when instanciating a generated class (Bad type i
by kromate
Dear all,
I'm using javassist to generate access class for reflection, following this tutorial:
http://www.ibm.com/developerworks/java/library/j-dyn0610/index.html?S_TAC...
Everything works fine with my version, but it is not working with field without getter/setter. I need my generated access class to be able to access field directly in some case.
So I wrote the following piece of code:
| ....
| protected static byte[] createAccess(final Class targetJavaClass, final String field, final String generatedClassName)
| throws Exception {
|
| //... code to get read/write method
|
| String targetName = targetJavaClass.getName();
| ClassPool pool = ClassPool.getDefault();
| CtClass accessClass = pool.makeClass(generatedClassName);
| CtClass targetClass = pool.get(targetName);
| final CtClass ctFieldClass = pool.get("java.lang.Object");
| final CtClass[] ctFieldClassParam = new CtClass[]{ctFieldClass};
| CtMethod meth;
|
| // add target object field to class
| accessClass.addField(new CtField(targetClass, "target", accessClass));
|
| // add public default constructor method to class
| CtConstructor cons = new CtConstructor(CT_NO_ARGS, accessClass);
| cons.setBody(";");
| accessClass.addConstructor(cons);
|
| // add public <code>setTarget</code> method
| meth = new CtMethod(CtClass.voidType, "setTarget", ctFieldClassParam, accessClass);
| meth.setBody("target = (" + targetJavaClass.getName() + ") $1;");
| accessClass.addMethod(meth);
|
|
| String src;
|
| // add public <code>setValue</code> method
| meth = new CtMethod(CtClass.voidType, "setValue", ctFieldClassParam, accessClass);
| final Class<?> fieldType = writer.getParameterTypes()[0];
| String cast$1 = "(" + fieldType.getName() + ") $1";
| if(directWriteField) src = "target." + field + " = " + " $1;";
| else src = "target." + writer.getName() + "(" + cast$1 + ");";
| meth.setBody(src);
| accessClass.addMethod(meth);
|
| // add public <code>getValue</code> method
| meth = new CtMethod(ctFieldClass, "getValue", CT_NO_ARGS, accessClass);
| if(directReadField) src = field;
| else src = reader.getName() + "()";
| meth.setBody("return (java.lang.Object) target." + src + ";");
| accessClass.addMethod(meth);
|
| // return binary representation of completed class
| accessClass.addInterface(pool.get(IAccess.class.getName()));
| accessClass.writeFile();
| return accessClass.toBytecode();
| }
| ...
|
Execution of this code throws an exception after class generation, when calling newInstance on it:
| java.lang.VerifyError: (class: Accessor$com/bnpparibas/eqd/fish/fwk/introspection/TestCachedIntrospectionInfo$SampleBean_secret, method: setValue signature: (Ljava/lang/Object;)V) Bad type in
| putfield/putstatic
| at java.lang.Class.getDeclaredConstructors0(Native Method)
| at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)
| at java.lang.Class.getConstructor0(Class.java:2671)
| at java.lang.Class.newInstance0(Class.java:321)
| at java.lang.Class.newInstance(Class.java:303)
|
The part of the code responsible of this is the following part of code:
| f(directWriteField) src = "target." + field + " = " + " $1;";
|
If I remove this line, there are no error.
Here is the decompiled code of the faulty generated class:
| package Accessor$com.bnpparibas.eqd.fish.fwk.introspection;
|
| import com.bnpparibas.eqd.fish.fwk.introspection.IAccess;
| import com.bnpparibas.eqd.fish.fwk.introspection.SampleBean;
|
| public class SampleBean_directAccessField
| implements IAccess {
|
| SampleBean target = null;
|
| public SampleBean_directAccessField() {
| }
|
| public void setTarget(Object obj) {
| target = (SampleBean)obj;
| }
|
| public void setValue(Object obj) {
| target.directAccessField = ((java.util.Date) (obj));
| }
|
| public Object getValue() {
| return (Object)target.directAccessField;
| }
| }
|
And the directAccesField of the target object is a java.util.Date.
I've spend to much time on this problem and I can't figure what the problem is.
Thanks for any help you can provide.
Regards.
K.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4222922#4222922
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4222922
17 years