[EJB 3.0] - SFSB problem with a SAR
by Markley
Im using Jboss 4.2.1.GA and jdk 1.5.0_15.
Im trying to deploy two "applications" (EAR and SAR) in the same jboss. First of all, when i deploy this two apps in different jboss it work.
Ok. There is an ejb-jar module in EAR. In this module i deploy 3 ejbs 3.0, 2 stateless and 1 stateful.
| @Stateful(name="MyService")
| @Remote(IMyService.class)
| public class IngestionService implements IMyService {
| ....
| }
|
SAR project is a client of this stateful bean. the Jndi lookup code :
| Properties prop = new Properties();
| prop.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
| prop.setProperty(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interface");
| prop.put(Context.PROVIDER_URL, "jnp://localhost" + ":" + "1099");
|
|
| InitialContext jndiContext = new InitialContext(prop);
|
| IMyService ms = (IMyService)jndiContext.lookup("MYAPP/MyService/remote");
|
This lookup cause a classcast exception. Like this :
| java.lang.ClassCastException: $Proxy80
| at schedule.TestScheduler.perform(TestScheduler.java:48)
| at org.jboss.varia.scheduler.Scheduler$Listener.handleNotification(Scheduler.java:1251)
| at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.mx.notification.NotificationListenerProxy.invoke(NotificationListenerProxy.java:153)
| at $Proxy11.handleNotification(Unknown Source)
| at javax.management.NotificationBroadcasterSupport.handleNotification(NotificationBroadcasterSupport.java:221)
| at javax.management.NotificationBroadcasterSupport.sendNotification(NotificationBroadcasterSupport.java:184)
| at javax.management.timer.Timer.sendNotification(Timer.java:1295)
| at javax.management.timer.Timer.notifyAlarmClock(Timer.java:1264)
| at javax.management.timer.TimerAlarmClock.run(Timer.java:1347)
| at java.util.TimerThread.mainLoop(Timer.java:512)
| at java.util.TimerThread.run(Timer.java:462)
|
In any other case i get a IMyService reference, but when the same lookup is done in a SAR i get this excepcion. The $Proxy80 is an instance of StatefulRemoteProxy and this proxy does not implement ejb remote interface.
The global JNDI namespace :
| +- MYAPP (class: org.jnp.interfaces.NamingContext)
| | +- AdminService (class: org.jnp.interfaces.NamingContext)
| | | +- local (proxy: $Proxy73 implements interface admin.IAdminService,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBLocalObject)
| | | +- remote (proxy: $Proxy71 implements interface admin.IAdminService,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBObject)
| | +- MyService (class: org.jnp.interfaces.NamingContext)
| | | +- remote (class: java.lang.Object)
| | | +- remoteStatefulProxyFactory (proxy: $Proxy81 implements interface org.jboss.ejb3.ProxyFactory)
| | +- XMLSerializer (class: org.jnp.interfaces.NamingContext)
| | | +- local (proxy: $Proxy77 implements interface jaxb.xmlserializer.ISerializer,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBLocalObject)
|
|
I need ideas.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4203534#4203534
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4203534
17 years, 3 months
[Management, JMX/JBoss] - JBoss Logging
by div_gcet1
Hi
Here i m working on JBoss 4.2.2 and eclipse Gynemade. I m instantiating
a java file at the time when jboss configure log4j.xml. I had given its entry
in log4j.xml. Now my problem is that file have to access the database which
are bound to perticuler JNDI names. And JNDI service starts after the log4j
configure. So a null pointer exception is coming at the time server configure
log4j, due to that java file. Can Anyone help me here. I m sending the change in log4j.xml that exception detail
| <appender name="FILE" class="org.jboss.logging.appender.DailyRollingFileAppender">
| <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
| <param name="File" value="${jboss.server.log.dir}/server.log"/>
| <param name="Append" value="false"/>
|
| <!-- Rollover at midnight each day -->
| <param name="DatePattern" value="'.'yyyy-MM-dd"/>
|
| <!-- Rollover at the top of each hour
| <param name="DatePattern" value="'.'yyyy-MM-dd-HH"/>
| -->
|
| <layout class="org.apache.log4j.PatternLayout">
| <!-- The default pattern: Date Priority [Category] Message\n -->
| <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
|
| <!-- The full pattern: Date MS Priority [Category] (Thread:NDC) Message\n
| <param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
| -->
| </layout>
| </appender>
| <appender name ="FILE1" class="org.apache.log4j.FileAppender">
| <param name="File" value="${jboss.server.log.dir}/server1.log" />
| <param name="Append" value="false" />
| <layout class="org.apache.log4j.PatternLayout">
| <param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
|
| </layout>
| <filter class="com.propco.tools.mergemanager.profiles.Domfilter"/>
|
|
|
[img]http://img223.imageshack.us/my.php?image=95972212vg1.png[/img]
Please zoom in the image as the image is a little out of focus.
Sorry for the inconvenience.
Thanks
Divya Garg
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4203533#4203533
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4203533
17 years, 3 months
[JCA/JBoss] - Error while closing connection from a pool
by rohit.macherla
Hi,
I am using JBoss 4.2.2.GA on a HP Unix platform. For the sake of delegating connection management to the application server, I have started using connection pooling.
The code I used was :
| InitialContext jndiCntx = new InitialContext();
| DataSource ds = (DataSource) jndiCntx.lookup("java:/testapi");
| Connection con = (Connection)ds.getConnection();
|
But with this, I was unable to invoke any Oracle Stored Procedures that takes in an Oracle Object. I have resolved this issue by fetching the connection as :
| InitialContext jndiCntx = new InitialContext();
| WrapperDataSource ds = (WrapperDataSource) jndiCntx.lookup
| ("java:/clarityapi");
| org.jboss.resource.adapter.jdbc.WrappedConnection wrappedCon = (WrappedConnection) ds.getConnection(
| );
| java.sql.Connection connection = wrappedCon.getUnderlyingConnection();
|
Using this, I am able to send in any Oracle Objects by using StructDescriptor's and ArrayDescriptor's wherever necessary. Also, necessary validations were put in to check if the 'wrappedCon' is 'closed' and if so I was retrying for a maximum of 4 times to check for stale connections.
However, the problem comes in when I am trying to close the connection. If i close it using :
connection.close();
there is no problem. But in the next invocations of the :
ds.getConnection()
I receive the following statements:
anonymous wrote :
| [CachedConnectionManager] Closing a connection for you. Please close them yourself: org.jboss.resource.ada
| pter.jdbc.WrappedConnection@1c1ec0e
|
and the subsequent connections i receive the following error :
anonymous wrote :
| java.sql.SQLException: Closed Connection
| at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:187)
| at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:229)
| at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:292)
|
With the debug statements, I have found the following status for the subsequent calls:
wrappedCon.isClosed : false
wrappedCon.getUnderlyingConnection.isClosed() : true .
So, the WrappedConnection object is not closed, but the underlying java.sql.Connection is closed.
This "Closing a connection for you..." may be only a debug statement given for my benefit but even if I disable it, the fact is that the connection is getting closed when I wanted it to be just put back into the connection pool.
The same scenario exists when I do :
wrappedCon.close(); instead of connection.close();
Please suggest me a valid way to close these wrapped connections. I was under the impression that these close() methods would place it back into the connection pool, but probably with this output I think the JBoss connection pooling needs to be handled differently in my code.
Thanks in advance.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4203529#4203529
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4203529
17 years, 3 months