[JCA/JBoss] - Re: idle time out question
by adrianï¼ jboss.org
"arparikh" wrote :
| Below is the code where we call getConnection to the connection object. We are getting NullPointer where we do conn.close(). The thing that I am wondering is if we are getting null conn, we should get null pointer at conn.setAutoCommit in getConnection or conn.createStatement. But instead we are getting on conn.close
|
| public void doSelect(String p_sql, int[] p_dataTypes) throws DBException
| {
| Connection conn = null;
| try
| {
| conn = DBConnMgr.getInstance().getConn(this.m_resourceId);
| }
| finally
| {
| try
| {
| }
| finally
| {
| try
| {
| conn.close();
| }
| catch (SQLException se)
| {
| m_logger.info("Failed to close DB connection");
| }
| }
| }
| }
|
| Thanks for the assistance
This is a basic java question. What do you think happens
when getConn() throws an exception? Do you think it still invokes
the finally block(s)?
Here are the correct patterns:
1) Allocate before entering try/finally
| Connection c = allocateConnection();
| try
| {
| }
| finally
| {
| // c cannot be null
| c.close();
| }
|
2) Allocate inside the try block (because you want only one catch block)
Therefore you must check in the finally whether you actually got a connection
| Connection c = null;
| try
| {
| c = allocateConnection();
| }
| catch (SQLException e)
| {
| }
| finally
| {
| // c could be null if allocateConnection() threw an exception
| if (c != null)
| c.close();
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4021063#4021063
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4021063
19Â years, 2Â months
[JBoss Seam] - Re: Seam & Maven2
by fip
I tried your archetypes, but when I tried to run mvn jetty:run (without changing the newly created project), I ended up with the following exception.
Anyone else ever had this problem? I'm a bit lost at the moment on where to look for the error.
Cheers
| org.apache.maven.lifecycle.LifecycleExecutionException: Failure
| at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:559)
| at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:488)
| at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:458)
| at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:306)
| at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:273)
| at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:140)
| at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:393)
| at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:182)
| at org.apache.maven.embedder.MavenEmbedder.execute(MavenEmbedder.java:747)
| at org.apache.maven.cli.MavenCli.main(MavenCli.java:380)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
| at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
| at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
| at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
| Caused by: org.apache.maven.plugin.MojoExecutionException: Failure
| at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:340)
| at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:272)
| at org.mortbay.jetty.plugin.AbstractJettyRunMojo.execute(AbstractJettyRunMojo.java:177)
| at org.mortbay.jetty.plugin.Jetty6RunMojo.execute(Jetty6RunMojo.java:183)
| at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:417)
| at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:534)
| ... 17 more
| Caused by: java.lang.RuntimeException: exception invoking: startup
| at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:112)
| at org.jboss.seam.Component.callComponentMethod(Component.java:1835)
| at org.jboss.seam.Component.callCreateMethod(Component.java:1783)
| at org.jboss.seam.Component.newInstance(Component.java:1772)
| at org.jboss.seam.contexts.Lifecycle.startup(Lifecycle.java:163)
| at org.jboss.seam.contexts.Lifecycle.startup(Lifecycle.java:156)
| at org.jboss.seam.contexts.Lifecycle.endInitialization(Lifecycle.java:135)
| at org.jboss.seam.init.Initialization.init(Initialization.java:452)
| at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:33)
| at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:450)
| at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1129)
| at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:420)
| at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:457)
| at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:38)
| at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:156)
| at org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:120)
| at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:38)
| at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:156)
| at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:38)
| at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:119)
| at org.mortbay.jetty.Server.doStart(Server.java:210)
| at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:38)
| at org.mortbay.jetty.plugin.Jetty6PluginServer.start(Jetty6PluginServer.java:134)
| at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:327)
| ... 22 more
| Caused by: java.lang.reflect.InvocationTargetException
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
| at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:102)
| ... 45 more
| Caused by: java.lang.NoClassDefFoundError: org/jboss/xb/binding/sunday/unmarshalling/ElementInterceptor
| at org.jboss.kernel.plugins.deployment.xml.BeanXMLDeployer.<init>(BeanXMLDeployer.java:49)
| at org.jboss.kernel.plugins.bootstrap.standalone.StandaloneBootstrap.bootstrap(StandaloneBootstrap.java:80)
| at org.jboss.kernel.plugins.bootstrap.AbstractBootstrap.run(AbstractBootstrap.java:91)
| at org.jboss.kernel.plugins.bootstrap.standalone.StandaloneBootstrap.main(StandaloneBootstrap.java:61)
| at org.jboss.seam.core.Microcontainer.startup(Microcontainer.java:31)
| ... 51 more
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4021048#4021048
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4021048
19Â years, 2Â months
[JBoss jBPM] - Hibernate Query To SQL Query Mismatch
by Anandnatraj
I am trying to convert the following SQL to equivalent Hibernate Query.
SELECT ti.id_, ti.name_, t.processinstance_, pi.processdefinition_
FROM jbpm_taskinstance ti, jbpm_token t, jbpm_processinstance pi
WHERE ti.token_ = t.id_
AND t.processinstance_ = pi.id_
AND pi.processdefinition_ = 1474
AND ti.name_ = 'Initiate Swap'
AND ti.isopen_ = 0
This query is given 1 record from the DB
But when I am trying the equivalent Hibernate query it is not giving any results. (No one has deleted the data in the meantime, though ;-)
SELECT ti
FROM org.jbpm.taskmgmt.exe.TaskInstance ti join ti.token tok join tok.processInstance pi
WHERE
pi.processDefinition = (:processDefinitionId)
AND ti.name = (:name)
AND ti.isOpen = (:state)
I have set the same values for the parameters.
By any choice am I missing any basic elements?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4021047#4021047
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4021047
19Â years, 2Â months
[JBoss Portal] - problem with deployin
by prisonbreaker
hi everybody,
I am new to this JBoss Portal. i trying do portlet tutorial by
http://struts.apache.org/2.x/docs/portlet-tutorial-webwork-22.html#Portle...
but i am not getting the my page in portal view..
in log page its showing error like
file:/D:/jboss-portal-2.4.1/server/default/tmp/deploy/tmp15843MyPortlet1-exp.war/WEB-INF/
org.jboss.deployment.DeploymentException: Cannot deploy portlet application; - nested throwable: (org.jboss.xb.binding.JBossXBException: Failed to parse source: No locale info found for EN)
at org.jboss.portal.portlet.deployment.jboss.PortletAppDeployment.create(PortletAppDeployment.java:162)
at org.jboss.portal.server.deployment.jboss.PortalDeploymentInfo$DeploymentContext.create(PortalDeploymentInfo.java:202)
at org.jboss.portal.server.deployment.jboss.ServerDeployer.create(ServerDeployer.java:228)
at org.jboss.deployment.MainDeployer.create(MainDeployer.java:953)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:807)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at
.........................
...........
129 more
can anyone help me to complete this ,
or
tell me any other good working tutorial on jboss portlet.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4021039#4021039
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4021039
19Â years, 2Â months