[Installation, Configuration & Deployment] - JBoss AS won't start on Java 1.5 (in contrast to 1.4)
by robbbert
Ubuntu Linux 6.06
Sun JDK 1.5_06, resp. 1.4_12
JBoss AS 4.0.4 GA
When I try to start a freshly unzipped distribution of JBoss AS (by using run.sh), the following exception gets thrown:
=========================================================================
|
| JBoss Bootstrap Environment
|
| JBOSS_HOME: /media/hde1/home/robert/opt/jboss-4.0.4.GA
|
| JAVA: /usr/lib/j2sdk1.5-sun/bin/java
|
| JAVA_OPTS: -server -Xms128m -Xmx512m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Dprogram.name=run.sh
|
| CLASSPATH: /media/hde1/home/robert/opt/jboss-4.0.4.GA/bin/run.jar:/usr/lib/j2sdk1.5-sun/lib:/usr/lib/j2sdk1.5-sun/external-jars:/usr/lib/j2sdk1.5-sun/jre/lib/ext
|
| =========================================================================
|
| Failed to boot JBoss:
| java.lang.NullPointerException
| at java.util.Properties$LineReader.readLine(Properties.java:365)
| at java.util.Properties.load(Properties.java:293)
| at org.jboss.Version.loadProperties(Version.java:262)
| at org.jboss.Version.<init>(Version.java:59)
| at org.jboss.Version.getInstance(Version.java:71)
| at org.jboss.system.server.ServerImpl.<init>(ServerImpl.java:72)
| at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
| at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
| at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
| at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
| at java.lang.Class.newInstance0(Class.java:350)
| at java.lang.Class.newInstance(Class.java:303)
| at org.jboss.system.server.ServerLoader.createServer(ServerLoader.java:274)
| at org.jboss.system.server.ServerLoader.load(ServerLoader.java:253)
| at org.jboss.Main.boot(Main.java:188)
| at org.jboss.Main$1.run(Main.java:464)
| at java.lang.Thread.run(Thread.java:595)
In contrast, when I edit the JAVA_HOME property in $JBOSS_HOME/bin/run.conf to point to the Sun JDK 1.4, JBoss AS starts without this error.
org.jboss.Version.loadProperties() (in $JBOSS_HOME/bin/run.jar):
InputStream in =
| Version.class.getResourceAsStream("/org/jboss/version.properties");
Debugging the server in Eclipse shows that the error occurs because the stream object is null when loaded via Java 1.5.
Please note that the classpath is the same in both cases.
Any ideas?
Thanks
Robert
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3963429#3963429
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3963429
19 years, 9 months
[Persistence, JBoss/CMP, Hibernate, Database] - java.io.NotSerializableException: org.jboss.ejb.plugins.cmp.
by fla83tn
Hi,
I'm trying to learn to manage relationship between two entity beans and the situation is the following:
I have a Customer that purchase orders, so an order have its own table Orders that is composed by 3 fields: id, customer and product purchased.
Thus, given some Customer I want to know all its purchased orders.
(Remark: Instead of Order I renamed it as OrderItem beacuse of it is a reserved word in mysql...)
So, I do the following to get the related orders:
| Collection coll = client.getOrders(dto);
| if (coll!=null){
| Iterator it = coll.iterator();
| while (it.hasNext()) {
| System.out.println(">>>> ORDER FOUND! ");
| }
| }else{
| System.out.println("<<<< ERROR RETRIEVING ORDERS..! >>>>>> ");
| }
|
But then I get this error:
| java.lang.reflect.UndeclaredThrowableException
| at $Proxy1.getOrders(Unknown Source)
| at test.SessionFacadeTestClient.getOrders(SessionFacadeTestClient.java:290)
| at test.SessionFacadeTestClient.main(SessionFacadeTestClient.java:371)
| Caused by: java.io.NotSerializableException: org.jboss.ejb.plugins.cmp.jdbc.bridge.RelationSet
| at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1075)
| at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:291)
|
My ejb-jar is the following:
| <entity>
| <ejb-name>Customer</ejb-name>
| <local-home>untitled2.entity.customer.CustomerHome</local-home>
| <local>untitled2.entity.customer.Customer</local>
| <ejb-class>untitled2.entity.customer.CustomerBean</ejb-class>
| <persistence-type>Container</persistence-type>
| <prim-key-class>untitled2.entity.customer.CustomerPK</prim-key-class>
| <reentrant>False</reentrant>
| <cmp-version>2.x</cmp-version>
| <abstract-schema-name>Customer</abstract-schema-name>
| <cmp-field>
| <field-name>id</field-name>
| </cmp-field>
| <cmp-field>
| <field-name>name</field-name>
| </cmp-field>
| </entity>
| <entity>
| <ejb-name>OrderItem</ejb-name>
| <local-home>untitled2.entity.order.OrderItemHome</local-home>
| <local>untitled2.entity.order.OrderItem</local>
| <ejb-class>untitled2.entity.order.OrderItemBean</ejb-class>
| <persistence-type>Container</persistence-type>
| <prim-key-class>untitled2.entity.order.OrderItemPK</prim-key-class>
| <reentrant>False</reentrant>
| <cmp-version>2.x</cmp-version>
| <abstract-schema-name>OrderItem</abstract-schema-name>
| <cmp-field>
| <field-name>id</field-name>
| </cmp-field>
| <cmp-field>
| <field-name>product</field-name>
| </cmp-field>
| <ejb-local-ref>
| <ejb-ref-name>ejb/Customer</ejb-ref-name>
| <ejb-ref-type>Entity</ejb-ref-type>
| <local-home>untitled2.entity.customer.CustomerHome</local-home>
| <local>untitled2.entity.customer.Customer</local>
| <ejb-link>Customer</ejb-link>
| </ejb-local-ref>
| </entity>
|
The jbosscmp-jdbc.xml is:
| <jbosscmp-jdbc>
| <defaults>
| <datasource>java:/examplesDB</datasource>
| <datasource-mapping>mySQL</datasource-mapping>
| <create-table>true</create-table>
| <remove-table>false</remove-table>
| <read-only>false</read-only>
| <pk-constraint>true</pk-constraint>
| <read-ahead>
| <strategy>on-load</strategy>
| <page-size>15</page-size>
| <eager-load-group>*</eager-load-group>
| </read-ahead>
| </defaults>
| <enterprise-beans>
| <entity>
| <ejb-name>Customer</ejb-name>
| <table-name>customer</table-name>
| <cmp-field>
| <field-name>id</field-name>
| <column-name>id</column-name>
| </cmp-field>
| <cmp-field>
| <field-name>name</field-name>
| <column-name>name</column-name>
| </cmp-field>
| </entity>
| <entity>
| <ejb-name>OrderItem</ejb-name>
| <table-name>orders</table-name>
| <cmp-field>
| <field-name>id</field-name>
| <column-name>id</column-name>
| </cmp-field>
| <cmp-field>
| <field-name>product</field-name>
| <column-name>product</column-name>
| </cmp-field>
| </entity>
| </enterprise-beans>
| <relationships>
| <ejb-relation>
| <ejb-relation-name>Customer-orders</ejb-relation-name>
| <foreign-key-mapping />
| <ejb-relationship-role>
| <ejb-relationship-role-name>Customer-owns-orders</ejb-relationship-role-name>
| <key-fields>
| <key-field>
| <field-name>id</field-name>
| <column-name>customer</column-name>
| </key-field>
| </key-fields>
| </ejb-relationship-role>
| <ejb-relationship-role>
| <ejb-relationship-role-name>orders-belongs-to-customer</ejb-relationship-role-name>
| <key-fields />
| </ejb-relationship-role>
| </ejb-relation>
| </relationships>
| </jbosscmp-jdbc>
|
Obviously, I set up the mysql-ds.xml properly beacause the tables are created correctly!
Any ideas?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3963428#3963428
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3963428
19 years, 9 months
[JNDI/Naming/Network] - Re: HELP: Looking up to java:comp namespace problem!!
by fla83tn
Thanks for the reply, but I solved the problem myself!
The problem was that I was trying to access the java: namespace from outside a bean and my descriptor file was wrong!
With the following all goes right:
For example, in my entity bean I want to refer at java:/Mail so I must declare in the ejb-jar the following:
| <entity>
| <ejb-name>LineOrder</ejb-name>
| ............................
| <resource-env-ref>
| <resource-env-ref-name>mail/Mail</resource-env-ref-name>
| <resource-env-ref-type>javax.mail.Session</resource-env-ref-type>
| </resource-env-ref>
| /entity>
|
and in the file jboss.xml:
| <entity>
| <ejb-name>LineOrder</ejb-name>
| ........................................
| <resource-env-ref>
| <resource-env-ref-name>mail/Mail</resource-env-ref-name>
| <jndi-name>java:/Mail</jndi-name>
| </resource-env-ref>
| </entity>
|
So in my entyty bean (LineOrderBean.java for example) I can do:
| session = (javax.mail.Session) c.lookup("java:comp/env/mail/Mail");
|
I hope this can be helpful for somebody..
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3963427#3963427
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3963427
19 years, 9 months
[Beginners Corner] - JNDI/OpenLdap ClassCastException
by Argy
Hi there,
I have managed to get openldap setup with jboss connecting to it (by the method of editing jboss-service.xml and a properties file).
Properties file:
| java.naming.factory.initial=com.sun.jndi.ldap.LdapCtxFactory
| java.naming.provider.url=ldap://localhost:389/dc=testing,dc=com
| java.naming.security.principal=cn=Manager,dc=testing,dc=com
| java.naming.security.authentication=simple
| java.naming.security.credentials=secret
|
addition to jboss-service.xml:
| <mbean code="org.jboss.naming.ExternalContext" name=":service=ExternalContext,jndiName=/ldap/configuration" >
| <attribute name="JndiName">/ldap/configuration</attribute>
| <attribute name="PropertiesURL">configuration.ldap</attribute>
| <attribute name="InitialContext">javax.naming.directory.InitialDirContext</attribute>
| <attribute name="RemoteAccess">true</attribute>
| </mbean>
|
This all seems to work fine as when I start up Jboss I can see openldap logging say that a manager has connected.
In my servlet however I try to look up the JNDI resource.
| InitialDirContext iniCtx = new InitialDirContext();
| Object ldap = iniCtx.lookup("/ldap/configuration");
|
This works fine, but I am not sure what to cast it as. I try casting as LdapCtxFactory and I get a java.lang.ClassCastException: $Proxy61
Any ideas?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3963426#3963426
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3963426
19 years, 9 months