Problem with JCA
Hi,
I have a error and I don't know the solution to this Problem.
Sorry for my bad english.
Here the code section where the error is performing.
32: try{
33: InitialContext ic = new InitialContext();
34: SAPConnectionFactory cf = (SAPConnectionFactory)ic.lookup( "java:comp/env/eis/sap" );
35:
36: if( cf == null ){
37: out.println( "Fehler beim Verbinden mit der Connection Factory!" );
38: }
39: SAPConnectionSpec spec = new SAPConnectionSpec("DE", username, password);
40: SAPConnection c = (SAPConnection)cf.getConnection(spec);
41:
42: c.close();
43: }catch(NamingException e){
44: out.println(e);
45: }catch(ResourceException e){
46: out.println(e);
47: }[/And here the error-log.
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: org/flashfactor/sap/SAPConnectionSpec
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:293)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:161)
root cause
java.lang.NoClassDefFoundError: org/flashfactor/sap/SAPConnectionSpec
at.kages.Test.doPost(Test.java:39)
at.kages.Test.doGet(Test.java:27)
javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:324)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:275)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:161)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.9 logs.
Apache Tomcat/5.5.9The class SAPConnectionSpec is in the RAR-File. And in the package org.flashfactor.sap .
Where are you checking the content of the XML?
It seems that platform's default encoding is not able to identify those characters and hence dispalying those as "???". Sometimes you get some invalid characters (like null), in the XML file and when platform's default encoding could not identify those characters then they get displayed like "?". Please check the content of the XML to verify it does not contain any invalid XML characters (sometims null). You may try to log the XML in database and in OSB to see it's content.
Regards,
Anuj
Similar Messages
-
Problem with JCA compliant adapter in XI
Hi
I have problem with JCA compliant adapter in XI (SP15).
Adapter works in PCK but doesn't work in XI (periodically).
Sometimes messages delivered with successful status but
very often after send message i have following message in
Message Display Tool (Detail Display):
Engine All
Status System Error
Repeatable Yes
Cancelable Yes
Start 29.03.2006 17:26:57
End 29.03.2006 17:26:57
Quality of Service Exactly Once
Error Category XICACHE
Error Code COMMUNICATIONIncrease the trace level of AFW components to "info" with the Log Configurator J2EE service using VisualAdmin.
When the error happens again, crawl into the most recent DefaultTrace, either by opening the file or by using the more confortable NetWeaver Administrator log viewer (defaulttrace), reachable via browser at http://xiboxhostname:5<sysnr>00/nwa
Good luck.
Alex -
Problem with JCA-DB in Business Service character
Hi,
I'm calling to database with JCA in Business Service, but when output contains the character "*&*" the business show "*&*";
Example
OUTPUT FROM BD:_
AMERICA NT & SAN FRANCISCO
OUTPUT FROM BS_
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
<Body>
<OutputParameters xmlns="http://xmlns.oracle.com/pcbpel/adapter/db/SGT/PKG_SGT_OPER/PRC_OPER_SRV_DAT_CON/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<OUT>AMERICA NT &amp; SAN FRANCISCO</OUT>
</OutputParameters>
</Body>
</Envelope>What should I do to show just only the character &?
PD: when I select and edit the html to get this output:
&amp;amp; -
Problem with JCA-DB in Business Service
Hi,
I'm calling to database with JCA in Business Service, but when output contains the character "*&*" the business show "*&*";
For Example
OUTPUT FROM BD:_
AMERICA NT & SAN FRANCISCO
OUTPUT FROM BS_
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
<Body>
<OutputParameters xmlns="http://xmlns.oracle.com/pcbpel/adapter/db/SGT/PKG_SGT_OPER/PRC_OPER_SRV_DAT_CON/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<OUT>AMERICA NT &amp; SAN FRANCISCO</OUT>
</OutputParameters>
</Body>
</Envelope>
Edited by: user8674403 on 28-ene-2011 10:51
Edited by: user8674403 on 28-ene-2011 10:52What should I do to show just only the character &?
PD: when I select and edit the html to get this output:
&amp;amp; -
Problem with JCA calling to DB function from Service Bus
Hi there
I have managed to use JCA from the Service Bus on several tables, on some diferent Oracle databases and it worked OK.
Now, I try to use it with a DB function that I have defined. Calling to this function from any DB software returns good values.
But calling this function using JCA (adapter created with jDeveloper) on OSB gives me the correct answer except that instead of the data there are question marks, like +<param>???</param>+
The database encoding is ISO-8859 (by using "SELECT * FROM NLS_DATABASE_PARAMETERS") .
This encoding is the same as was on different databases that worked ok with other adapters, just not calling a DB function, but a custom SQL.
I would appreciate if anyone might know what can solve this ..
ThanksWhere are you checking the content of the XML?
It seems that platform's default encoding is not able to identify those characters and hence dispalying those as "???". Sometimes you get some invalid characters (like null), in the XML file and when platform's default encoding could not identify those characters then they get displayed like "?". Please check the content of the XML to verify it does not contain any invalid XML characters (sometims null). You may try to log the XML in database and in OSB to see it's content.
Regards,
Anuj -
Hello all,
Im trying to modify the JCA program from SAP to get details from SALESORDER_GETLIST BAPI. But im getting some errors. Please help me out. In the next two consecutive replies im posting the java code and the jsp code.
thnx
SteveSorry here are the errors
#1.5#00127991C81900580000003500000F
30000404619D71A0EA#1130717206643#
com.sap.portal.portal#sap.com/irj#
com.sap.portal.portal#gsundarakris#11295##
sys13_EP6_204619550#gsundarakris#
36cd7ba0499211da88af00127991c819#
SAPEngine_Application_Thread[impl:3]_19##0#0#Error#1#/System/Server#Java###Exception ID:04:06_30/10/05_0052_204619550
[EXCEPTION]
#1#com.
sapportals.portal.prt.component.PortalComponentException: Error in service call of Resource
Component : pcd:portal_content/systechi/customer/PJM/iView/
com.systechi.sample.jcaConnection
Component class : jca.SampleComponent
User : gsundarakris
at com.sapportals.portal.prt.core.PortalRequestManager.
handlePortalComponentException(PortalRequestManager.java:969)
at com.sapportals.portal.prt.core.PortalRequestManager.
dispatchRequest(PortalRequestManager.java:444)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:527)
at com.sapportals.portal.prt.component.AbstractComponentResponse.include(AbstractComponentResponse.java:89)
at com.sapportals.portal.prt.component.PortalComponentResponse.include(PortalComponentResponse.java:232)
at jca.SampleComponent.doContent(SampleComponent.java:149)
at com.sapportals.portal.prt.component.AbstractPortalComponent.serviceDeprecated(AbstractPortalComponent.java:209)
at com.sapportals.portal.prt.component.AbstractPortalComponent.service(AbstractPortalComponent.java:114)
at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
at com.sapportals.portal.prt.component.PortalComponentResponse.include(PortalComponentResponse.java:215)
at com.sapportals.portal.prt.pom.PortalNode.service(PortalNode.java:646)
at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
at com.sapportals.portal.prt.core.PortalRequestManager.runRequestCycle(PortalRequestManager.java:753)
at com.sapportals.portal.prt.connection.ServletConnection.handleRequest(ServletConnection.java:240)
at com.sapportals.portal.prt.dispatcher.Dispatcher$doService.run(Dispatcher.java:522)
at java.security.AccessController.doPrivileged(Native Method)
at com.sapportals.portal.prt.dispatcher.Dispatcher.service(Dispatcher.java:405)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.servlet.InvokerServlet.service(InvokerServlet.java:156)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:390)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:264)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:347)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:325)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:887)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:241)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:95)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:160)
Caused by: com.sapportals.portal.prt.component.PortalComponentException: Original exception:
at pagelet._sapportalsjsp_index.doContent(_sapportalsjsp_index.java:47)
at com.sapportals.portal.prt.component.AbstractPortalComponent.serviceDeprecated(AbstractPortalComponent.java:209)
at com.sapportals.portal.prt.component.AbstractPortalComponent.service(AbstractPortalComponent.java:114)
at com.sapportals.portal.prt.core.broker.PortalComponentItemFacade.service(PortalComponentItemFacade.java:360)
at com.sapportals.portal.prt.core.broker.PortalComponentItem.service(PortalComponentItem.java:934)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:435)
... 36 more
Caused by: java.lang.NullPointerException
at pagelet._sapportalsjsp_index.subDoContent(_sapportalsjsp_index.java:375)
at pagelet._sapportalsjsp_index.doContent(_sapportalsjsp_index.java:42)
... 41 more
#1.5#00127991C81900480000005100000F3000040461ACD31BA9#1130717464689#com.sap.portal.jsp#sap.com/irj#com.sap.portal.jsp#gsundarakris#11295##sys13_EP6_204619550#gsundarakris#36cd7ba0499211da88af00127991c819#SAPEngine_Application_Thread[impl:3]_7##0#0#Warning#1#/System/Server#Java###null
[EXCEPTION]
#1#java.lang.NullPointerException
at pagelet._sapportalsjsp_index.subDoContent(_sapportalsjsp_index.java:375)
at pagelet._sapportalsjsp_index.doContent(_sapportalsjsp_index.java:42)
at com.sapportals.portal.prt.component.AbstractPortalComponent.serviceDeprecated(AbstractPortalComponent.java:209)
at com.sapportals.portal.prt.component.AbstractPortalComponent.service(AbstractPortalComponent.java:114)
at com.sapportals.portal.prt.core.broker.PortalComponentItemFacade.service(PortalComponentItemFacade.java:360)
at com.sapportals.portal.prt.core.broker.PortalComponentItem.service(PortalComponentItem.java:934)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:435)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:527)
at com.sapportals.portal.prt.component.AbstractComponentResponse.include(AbstractComponentResponse.java:89)
at com.sapportals.portal.prt.component.PortalComponentResponse.include(PortalComponentResponse.java:232)
at jca.SampleComponent.doContent(SampleComponent.java:149)
at com.sapportals.portal.prt.component.AbstractPortalComponent.serviceDeprecated(AbstractPortalComponent.java:209)
at com.sapportals.portal.prt.component.AbstractPortalComponent.service(AbstractPortalComponent.java:114)
at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
at com.sapportals.portal.prt.component.PortalComponentResponse.include(PortalComponentResponse.java:215)
at com.sapportals.portal.prt.pom.PortalNode.service(PortalNode.java:646)
at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
at com.sapportals.portal.prt.core.PortalRequestManager.runRequestCycle(PortalRequestManager.java:753)
at com.sapportals.portal.prt.connection.ServletConnection.handleRequest(ServletConnection.java:240)
at com.sapportals.portal.prt.dispatcher.Dispatcher$doService.run(Dispatcher.java:522)
at java.security.AccessController.doPrivileged(Native Method)
at com.sapportals.portal.prt.dispatcher.Dispatcher.service(Dispatcher.java:405)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.servlet.InvokerServlet.service(InvokerServlet.java:156)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:390)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:264)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:347)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:325)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:887)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:241)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:95)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:160)
#1.5#00127991C81900480000005300000F3000040461ACD3297B#1130717464689#com.sap.portal.portal#sap.com/irj#com.sap.portal.portal#gsundarakris#11295##sys13_EP6_204619550#gsundarakris#36cd7ba0499211da88af00127991c819#SAPEngine_Application_Thread[impl:3]_7##0#0#Error#1#/System/Server#Java###Exception ID:04:11_30/10/05_0053_204619550
[EXCEPTION]
#1#com.sapportals.portal.prt.component.PortalComponentException: Error in service call of Resource
Component : pcd:portal_content/systechi/customer/PJM/iView/com.systechi.sample.jcaConnection
Component class : jca.SampleComponent
User : gsundarakris
at com.sapportals.portal.prt.core.PortalRequestManager.handlePortalComponentException(PortalRequestManager.java:969)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:444)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:527)
at com.sapportals.portal.prt.component.AbstractComponentResponse.include(AbstractComponentResponse.java:89)
at com.sapportals.portal.prt.component.PortalComponentResponse.include(PortalComponentResponse.java:232)
at jca.SampleComponent.doContent(SampleComponent.java:149)
at com.sapportals.portal.prt.component.AbstractPortalComponent.serviceDeprecated(AbstractPortalComponent.java:209)
at com.sapportals.portal.prt.component.AbstractPortalComponent.service(AbstractPortalComponent.java:114)
at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
at com.sapportals.portal.prt.component.PortalComponentResponse.include(PortalComponentResponse.java:215)
at com.sapportals.portal.prt.pom.PortalNode.service(PortalNode.java:646)
at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
at com.sapportals.portal.prt.core.PortalRequestManager.runRequestCycle(PortalRequestManager.java:753)
at com.sapportals.portal.prt.connection.ServletConnection.handleRequest(ServletConnection.java:240)
at com.sapportals.portal.prt.dispatcher.Dispatcher$doService.run(Dispatcher.java:522)
at java.security.AccessController.doPrivileged(Native Method)
at com.sapportals.portal.prt.dispatcher.Dispatcher.service(Dispatcher.java:405)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.servlet.InvokerServlet.service(InvokerServlet.java:156)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:390)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:264)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:347)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:325)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:887)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:241)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:95)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:160)
Caused by: com.sapportals.portal.prt.component.PortalComponentException: Original exception:
at pagelet._sapportalsjsp_index.doContent(_sapportalsjsp_index.java:47)
at com.sapportals.portal.prt.component.AbstractPortalComponent.serviceDeprecated(AbstractPortalComponent.java:209)
at com.sapportals.portal.prt.component.AbstractPortalComponent.service(AbstractPortalComponent.java:114)
at com.sapportals.portal.prt.core.broker.PortalComponentItemFacade.service(PortalComponentItemFacade.java:360)
at com.sapportals.portal.prt.core.broker.PortalComponentItem.service(PortalComponentItem.java:934)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:435)
... 36 more
Caused by: java.lang.NullPointerException
at pagelet._sapportalsjsp_index.subDoContent(_sapportalsjsp_index.java:375)
at pagelet._sapportalsjsp_index.doContent(_sapportalsjsp_index.java:42)
... 41 more -
Problem with PCK 7.1 SP07 JCA Sample Adapter
Hello!
I have a Problem with the JCA Sample Adapter in the PCK 7.1 SP07. I will test the Configuration ( http://help.sap.com/saphelp_nwpi71/helpdata/en/f7/0c2441509fa831e10000000a1550b0/content.htm ) .
But the receiver channel has a Massage processing failure: u201CMessage processing failed. Cause: java.lang.Exception: JNDI name of the ra connectionFactory is not configured. Go to the directory and create a value with name 'JNDIName' and value 'deployedAdapters/<ra name>/shareable/<ra name>' as module configuration data of the module 'ModuleProcessorExitBean'u201D
In the JNDI-Browser of Netwaver Administration canu2019t found JNDIName from directory ('deployedAdapters/sample_ra/shareable/sample_ra). I have located the name deployedAdapters/com.sap.aii.adapter.sample.ra/shareable/com.sap.aii.adapter.sample.ra and change this in the receiver channel u201CTo_Au201D. But I have the same problem.
I hope you can help me!
Thanks & Regards
StefanHello!
Yes I followed the Instruction.
I have deployed the Sample Source as AdapterJCA, change the JNDI name in the SampleRa.xml and upload to CPA Cache.
I have by now the Configuration deleted in PCK and rebuild the scenario. The demo Configuration runs now. I think the Configuration in the CPA Cache was wrong.
Stefan -
EJB 3.0 - problem with persistence unit.
Hi everybody, I got this problem I would like you to help me.
I'm doing a proyect with EJB 3.0 using Netbeans 5.5 and Jboss
The data source is MySQL.
When I deploy the proyect, the Jboss Log show me this:
--- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
ObjectName: persistence.units:ear=DecmoCVLAC.ear,jar=DecmoCVLAC-ejb.jar,unitName=DecmoCVLAC-ejbPU
State: FAILED
Reason: javax.naming.NameNotFoundException: jdbc not bound
I Depend On:
jboss.jca:service=ManagedConnectionFactory,name=jdbc/connectionPool
Depends On Me:
jboss.j2ee:ear=DecmoCVLAC.ear,jar=DecmoCVLAC-ejb.jar,name=NewMessage,service=EJB3
jboss.j2ee:ear=DecmoCVLAC.ear,jar=DecmoCVLAC-ejb.jar,name=PersonaEntityFacade,service=EJB3
[Please help me, I'm kind of new in EJB]
[ENTIRE JBOSS LOG]
10:08:37,375 INFO [TomcatDeployer] undeploy, ctxPath=/DecmoCVLAC-war, warUrl=.../tmp/deploy/tmp16823DecmoCVLAC.ear-contents/DecmoCVLAC-war-exp.war/
10:08:37,515 INFO [EARDeployer] Undeploying J2EE application, destroy step: file:/C:/jboss-4.0.4.GA/server/default/deploy/DecmoCVLAC.ear
10:08:37,515 INFO [EARDeployer] Undeployed J2EE application: file:/C:/jboss-4.0.4.GA/server/default/deploy/DecmoCVLAC.ear
10:08:37,546 INFO [EARDeployer] Init J2EE application: file:/C:/jboss-4.0.4.GA/server/default/deploy/DecmoCVLAC.ear
10:08:39,281 INFO [Ejb3Deployment] EJB3 deployment time took: 47
10:08:39,296 INFO [JmxKernelAbstraction] installing MBean: persistence.units:ear=DecmoCVLAC.ear,jar=DecmoCVLAC-ejb.jar,unitName=DecmoCVLAC-ejbPU with dependencies:
10:08:39,296 INFO [JmxKernelAbstraction] jboss.jca:name=jdbc/connectionPool,service=ManagedConnectionFactory
10:08:39,312 WARN [ServiceController] Problem starting service persistence.units:ear=DecmoCVLAC.ear,jar=DecmoCVLAC-ejb.jar,unitName=DecmoCVLAC-ejbPU
javax.naming.NameNotFoundException: jdbc not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:240)
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.ejb3.ServiceDelegateWrapper.startService(ServiceDelegateWrapper.java:99)
at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
at sun.reflect.GeneratedMethodAccessor83.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
at $Proxy0.start(Unknown Source)
at org.jboss.system.ServiceController.start(ServiceController.java:417)
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy91.start(Unknown Source)
at org.jboss.ejb3.JmxKernelAbstraction.install(JmxKernelAbstraction.java:82)
at org.jboss.ejb3.Ejb3Deployment.startPersistenceUnits(Ejb3Deployment.java:626)
at org.jboss.ejb3.Ejb3Deployment.start(Ejb3Deployment.java:475)
at org.jboss.ejb3.Ejb3Module.startService(Ejb3Module.java:139)
at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
at sun.reflect.GeneratedMethodAccessor83.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
at $Proxy0.start(Unknown Source)
at org.jboss.system.ServiceController.start(ServiceController.java:417)
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy36.start(Unknown Source)
at org.jboss.ejb3.EJB3Deployer.start(EJB3Deployer.java:449)
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.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
at org.jboss.ws.server.WebServiceDeployer.start(WebServiceDeployer.java:117)
at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy37.start(Unknown Source)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1007)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:997)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:808)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:771)
at sun.reflect.GeneratedMethodAccessor13.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy6.deploy(Unknown Source)
at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:610)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:274)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:225)
10:08:39,812 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:ear=DecmoCVLAC.ear,jar=DecmoCVLAC-ejb.jar,name=NewMessage,service=EJB3 with dependencies:
10:08:39,812 INFO [JmxKernelAbstraction] persistence.units:ear=DecmoCVLAC.ear,jar=DecmoCVLAC-ejb.jar,unitName=DecmoCVLAC-ejbPU
10:08:39,828 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:ear=DecmoCVLAC.ear,jar=DecmoCVLAC-ejb.jar,name=PersonaEntityFacade,service=EJB3 with dependencies:
10:08:39,828 INFO [JmxKernelAbstraction] persistence.units:ear=DecmoCVLAC.ear,jar=DecmoCVLAC-ejb.jar,unitName=DecmoCVLAC-ejbPU
10:08:39,859 INFO [EJB3Deployer] Deployed: file:/C:/jboss-4.0.4.GA/server/default/tmp/deploy/tmp16824DecmoCVLAC.ear-contents/DecmoCVLAC-ejb.jar
10:08:39,859 INFO [TomcatDeployer] deploy, ctxPath=/DecmoCVLAC-war, warUrl=.../tmp/deploy/tmp16824DecmoCVLAC.ear-contents/DecmoCVLAC-war-exp.war/
10:08:40,046 INFO [EARDeployer] Started J2EE application: file:/C:/jboss-4.0.4.GA/server/default/deploy/DecmoCVLAC.ear
10:08:40,062 ERROR [URLDeploymentScanner] Incomplete Deployment listing:
--- MBeans waiting for other MBeans ---
ObjectName: persistence.units:ear=DecmoCVLAC.ear,jar=DecmoCVLAC-ejb.jar,unitName=DecmoCVLAC-ejbPU
State: FAILED
Reason: javax.naming.NameNotFoundException: jdbc not bound
I Depend On:
jboss.jca:service=ManagedConnectionFactory,name=jdbc/connectionPool
Depends On Me:
jboss.j2ee:ear=DecmoCVLAC.ear,jar=DecmoCVLAC-ejb.jar,name=NewMessage,service=EJB3
jboss.j2ee:ear=DecmoCVLAC.ear,jar=DecmoCVLAC-ejb.jar,name=PersonaEntityFacade,service=EJB3
ObjectName: jboss.j2ee:ear=DecmoCVLAC.ear,jar=DecmoCVLAC-ejb.jar,name=NewMessage,service=EJB3
State: NOTYETINSTALLED
I Depend On:
persistence.units:ear=DecmoCVLAC.ear,jar=DecmoCVLAC-ejb.jar,unitName=DecmoCVLAC-ejbPU
ObjectName: jboss.j2ee:ear=DecmoCVLAC.ear,jar=DecmoCVLAC-ejb.jar,name=PersonaEntityFacade,service=EJB3
State: NOTYETINSTALLED
I Depend On:
persistence.units:ear=DecmoCVLAC.ear,jar=DecmoCVLAC-ejb.jar,unitName=DecmoCVLAC-ejbPU
--- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
ObjectName: persistence.units:ear=DecmoCVLAC.ear,jar=DecmoCVLAC-ejb.jar,unitName=DecmoCVLAC-ejbPU
State: FAILED
Reason: javax.naming.NameNotFoundException: jdbc not bound
I Depend On:
jboss.jca:service=ManagedConnectionFactory,name=jdbc/connectionPool
Depends On Me:
jboss.j2ee:ear=DecmoCVLAC.ear,jar=DecmoCVLAC-ejb.jar,name=NewMessage,service=EJB3
jboss.j2ee:ear=DecmoCVLAC.ear,jar=DecmoCVLAC-ejb.jar,name=PersonaEntityFacade,service=EJB3Reason: javax.naming.NameNotFoundException: jdbc not bound
Although i am quite new to this as well i would say that there is a problem with your connection with the database.
It seems it cannot connect to Mysql.
have you download the mysql package library and imported it ?
Also in your deploy folder in you Jboss
have you altered the jdbc to connect to you database in your dataset ? ( i am not sure about mysql, but postgre reguired this)
Most probably it would be the same in mysql.
<connection-url>jdbc:postgresql://127.0.0.1:5432/Dissertation</connection-url>
Not sure if this is what you reguire, i am new at this my self -
Hi iam a newbee to this Forum and have some problems with the JCA API.
I try to do somting linke this :
Signature sign = Signature.getInstance("SHA256WithRSA", "SUN");
the Compiler notfie some problem
Exception in thread "main" java.security.NoSuchAlgorithmException: no such algorithm: SHA256WithRSA for provider SUN
at sun.security.jca.GetInstance.getService(Unknown Source)
at sun.security.jca.GetInstance.getInstance(Unknown Source)
at java.security.Signature.getInstance(Unknown Source)
at pkcs_signer.coconet_package.TestClass.main(TestClass.java:76)
How i can solve this problem ? i use the SUN Provider.
I read in the internet i need to Download the Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files 6, is this right ? and how i install this ?
thank you
Richard from Germany ( Java newbie )878183 wrote:
Signature sign = Signature.getInstance("SHA256withRSA");
System.out.println(sign.getAlgorithm());
the Compiler searches vor a Provider is this right ? and then the compiler find the SUN Provider. Since the SUN provider does not provide an implementation for "SHA256withRSA" then no - the JRE (not compiler) does not find the SUN provider. BUT - the JRE does find the "SunRsaSign" provider which does support "SHA256withRSA". You can of course explicitly request the "SunRsaSign" provider using
Signature sign = Signature.getInstance("SHA256withRSA","SunRsaSign"); -
Reading large file with JCA Adapter in OSB
Hello,
We are searching for a solution how to read large file (>50M) from network drive and deliver it to queue via OSB 11gR4 (10.3.4). The problem is when reading the file with JCA File Adapter. It seems that it cannot handle as large files as we have. The documentation provides a way to bypass file size limitation by using Chunk Read but it seems to require BPEL Process execution which is not possible in our environment. Does anyone know if there are ways to implement this without having BPEL Process?
Our usecase:
read file from network drive -> transfer with OSB -> deliver MQ
Other options than JCA File Adapter can be considered, if anyone can advice...If it's a plain routing use case and no message processing is required then you may simply use OSB's FILE transport instead of JCA adapter. Create a messaging type proxy service and select request message type as "binary". Also enable the content streaming (Disk buffer, compression).
From OSB Dev guide -
Oracle JCA Adapter for FTP and Files – Attachments (large payload support), pre- and post-processing of files, using a re-entrant valve for processing ZIP files, content streaming, and file chunked read are not supported with Oracle Service Bus.
http://download.oracle.com/docs/cd/E17904_01/doc.1111/e15866/jca.htm#BABBICIA
You may also refer -
Reading huge flat file in OSB 11gR1
Regards,
Anuj -
Problem with reached maximum number of connections to database
Dear Experts,
Our Production system was not responding properly last week.
The below was the reply from the Basis team.
"It seems that we have again problem with reached maximum number of connections to database. We have extended this number to 100 this year and now it seems that it’s not enough again. It seems that something is running on Production, which takes over too many connections."
They have increased the number to 200 as a work around.
Do we have any means to find out, which component or application is causing the issue.
Please advise me if any better way is available to correct the issue.
Please see the below trace.
From default trace:
======
Caused by: com.sap.engine.services.dbpool.exceptions.BaseSQLException: ResourceException occurred in method ConnectionFactoryImpl.getConnection(): javax.resource.R
esourceException: (Failed in component: dbpool, BC-JAS-TRH) Cannot create connection. Possible reasons: 1)Maximum allowed connections to DB or EIS is reached. You
can apply CSN Note 719778 in order to check and resolve connection leaks. 2) Configuration to DB/EIS is wrong or DB/EIS is temporary unreachable. 3) Connections ar
e not enough for current load.
at com.sap.engine.services.dbpool.cci.ConnectionFactoryImpl.getConnection(ConnectionFactoryImpl.java:60)
at com.sap.security.core.persistence.datasource.imp.J2EEConnectionPool.getConnection(J2EEConnectionPool.java:205)
... 61 more
Caused by: javax.resource.ResourceException: (Failed in component: dbpool, BC-JAS-TRH) Cannot create connection. Possible reasons: 1)Maximum allowed connections to
DB or EIS is reached. You can apply CSN Note 719778 in order to check and resolve connection leaks. 2) Configuration to DB/EIS is wrong or DB/EIS is temporary unr
eachable. 3) Connections are not enough for current load.
at com.sap.engine.services.connector.jca.ConnectionHashSet.match(ConnectionHashSet.java:230)
at com.sap.engine.services.connector.jca.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:343)
at com.sap.engine.services.connector.jca.ShareableConnectionManager.allocateConnection(ShareableConnectionManager.java:54)
at com.sap.engine.services.dbpool.cci.ConnectionFactoryImpl.getConnection(ConnectionFactoryImpl.java:52)
... 62 more
Caused by: com.sap.engine.services.dbpool.exceptions.BaseResourceException: SQLException is thrown by the pooled connection: com.sap.sql.log.OpenSQLException: No c
onnection to data source SAPEPPDB available. All 100 pooled connections are in use and 70 connection requests are currently waiting. The connection pool size might
need to be adjusted.
at com.sap.engine.services.dbpool.spi.ManagedConnectionFactoryImpl.createManagedConnection(ManagedConnectionFactoryImpl.java:192)
at com.sap.engine.services.connector.jca.ConnectionHashSet.match(ConnectionHashSet.java:221)
... 65 more
Caused by: com.sap.sql.log.OpenSQLException: No connection to data source SAPEPPDB available. All 100 pooled connections are in use and 70 connection requests are
currently waiting. The connection pool size might need to be adjusted.
======
Thanks and Kind Regards,
JelbinStop all instances(including DB) and start again, Hope it should work.
It may happened that jar has not been synchronized with the database and may be version mismatch with the java.
719778 - Data Source fails to return connection
1650472 - Transactions are interrupted due to database connection periodically failing to establish
1138877 - How to Deploy External Drivers JDBC/JMS Adapters
Change the connection pool so that it can connect to DB as per the note 719778
Regards
Vijay Kalluri -
hello,
my scenario
EJB application, with JCA and JAAS.
My problem is, that I'm not able to read the config file. where i have to copy the .conf file that my application find that file.
System.setProperty("java.security.auth.login.config", "demo.conf");
kind regards
JohannesHello!
I've done the following tasks:
Searched for jazn-data.xml file of OC4J-installation.
Added information of jaas.conf-file to a new entry of application.
e.g.
TestJaas { com.sun.security.auth.module.Krb5LoginModule required debug=false useTicketCache=false; };
<application>
<name>TestJaas</name>
<login-modules>
<login-module>
<class>com.sun.security.auth.module.Krb5LoginModule</class>
<control-flag>required</control-flag>
<options>
<option>
<name>debug</name>
<value>false</value>
<name>useTicketCache</name>
<value>false</value>
</option>
</options>
</login-module>
</login-modules>
</application>
It should work.
regards
Harald. -
How do I get started replacing JCo with JCA?
Hi all,
After upgrading to EP SP15 I'm now reading that I should stop using JCo for client connection and start using JCA.
I've searched but can't seem to find any step-by-step procedure that shows me how to convert my existing Java code to be JCA-compliant.
Basically, I was doing client = poolEntry.getClient() and then using the client.execute("myrfc"). What code change is required to replace that code with JCA code?
Thanks,
MikeHey Mike,
Glad I could help!!
There have been a couple things that I have noticed. If you are using a table as an input parameter, use a table.close() once you are done filling it and before adding it to the importParams("table_name",table) code. I have two scenarios for that. Here is the first:
for (int j = 0; j < exportTable.length; j++) {
table.insertRow();
table.setString("VAR1", exportTable[j][0]);
table.setString("VAR2", exportTable[j][1]);
table.close();
importParams.put("EXTAB", table);
,and the second one:
table.insertRow();
table.setString("VAR1", "This is variable 1");
table.setString("VAR2", "This is variable 2");
table.close();
importParams.put("EXTAB", table);
We are running EP6 SP14. In that booklet, it doesn't show using table.close(). You may not have to use it, but for me, I couldn't get it to work any other way. Once it was working, I removed it, and I would receive nothing.
Other than that right now, I haven't really run into any other problems... yet... haha.
Cheers,
Kevin -
I am trying to implement some kind of a server listening for requests. The listener part of the app, is a daemon thread that listens for connections and instantiates a handling daemon thread once it gets some. However, my problem is that i must be able to kill the listening thread at the user's will (say via a sto button). I have done this via the Sun's proposed way, by testing a boolean flag in the loop, which is set to false when i wish to kill the thread. The problem with this thing is the following...
Once the thread starts excecuting, it will test the flag, find it true and enter the loop. At some point it will LOCK on the server socket waiting for connection. Unless some client actually connects, it will keep on listening indefinatelly whithought ever bothering to check for the flag again (no matter how many times you set the damn thing to false).
My question is this: Is there any real, non-theoretical, applied way to stop thread in java safely?
Thank you in advance,
LeftyThis was one solution from the socket programming forum, have you tried this??
public Thread MyThread extends Thread{
boolean active = true;
public void run(){
ss.setSoTimeout(90);
while (active){
try{
serverSocket = ss.accept();
catch (SocketTimeoutException ste){
// do nothing
// interrupt thread
public void deactivate(){
active = false;
// you gotta sleep for a time longer than the
// accept() timeout to make sure that timeout is finished.
try{
sleep(91);
}catch (InterruptedException ie){
interrupt();
} -
Problem with Threads and a static variable
I have a problem with the code below. I am yet to make sure that I understand the problem. Correct me if I am wrong please.
Code functionality:
A timer calls SetState every second. It sets the state and sets boolean variable "changed" to true. Then notifies a main process thread to check if the state changed to send a message.
The problem as far I understand is:
Assume the timer Thread calls SetState twice before the main process Thread runs. As a result, "changed" is set to true twice. However, since the main process is blocked twice during the two calls to SetState, when it runs it would have the two SetState timer threads blocked on its synchronized body. It will pass the first one, send the message and set "changed" to false since it was true. Now, it will pass the second thread, but here is the problem, "changed" is already set to false. As a result, it won't send the message even though it is supposed to.
Would you please let me know if my understanding is correct? If so, what would you propose to resolve the problem? Should I call wait some other or should I notify in a different way?
Thanks,
B.D.
Code:
private static volatile boolean bChanged = false;
private static Thread objMainProcess;
protected static void Init(){
objMainProcess = new Thread() {
public void run() {
while( objMainProcess == Thread.currentThread() ) {
GetState();
objMainProcess.setDaemon( true );
objMainProcess.start();
public static void initStatusTimer(){
if(objTimer == null)
objTimer = new javax.swing.Timer( 1000, new java.awt.event.ActionListener(){
public void actionPerformed( java.awt.event.ActionEvent evt){
SetState();
private static void SetState(){
if( objMainProcess == null ) return;
synchronized( objMainProcess ) {
bChanged = true;
try{
objMainProcess.notify();
}catch( IllegalMonitorStateException e ) {}
private static boolean GetState() {
if( objMainProcess == null ) return false;
synchronized( objMainProcess ) {
if( bChanged) {
SendMessage();
bChanged = false;
return true;
try {
objMainProcess.wait();
}catch( InterruptedException e ) {}
return false;
}Thanks DrClap for your reply. Everything you said is right. It is not easy to make them alternate since SetState() could be called from different places where the state could be anything else but a status message. Like a GREETING message for example. It is a handshaking message but not a status message.
Again as you said, There is a reason I can't call sendMessage() inside setState().
The only way I was able to do it is by having a counter of the number of notifies that have been called. Every time notify() is called a counter is incremented. Now instead of just checking if "changed" flag is true, I also check if notify counter is greater than zero. If both true, I send the message. If "changed" flag is false, I check again if the notify counter is greater than zero, I send the message. This way it works, but it is kind of a patch than a good design fix. I am yet to find a good solution.
Thanks,
B.D.
Maybe you are looking for
-
Special Character in Subject Field of Discussion Forum
I am creating a new discussion, in the subject when i enter "Portal Discussion?" then it gives error that special character is not allowed. But i want to use the "?" in the subject at the time of creation. After creating the discussion i can edit the
-
Idoc to File Scenario(SFTP) with special requirement
Hi experts, We have a scenario Idoc-->File(SFTP), in which one field which is having multi-line and we want that field as structured below. Expected Output- <?xml version="1.0" encoding="UTF-"> <ggol_xml_payment><cust_payment_header><sender_id>SGCI</
-
working on a new website .I want to cut and paste information from microsoft. firefox is not letting me.
-
Using iTunes 10.7 (21). I have selected several types of columns so as to see different information in conjunction with a listed item (e.g. composer, etc.). A small black triangle can be above any one of the columns, which, when clicked, causes the o
-
Upload control in Visual Composer
Hi guys, We here are wondering whether an upload control is something that's needed or not. We are considering implementing this for EhP2. Can you please comment on this? Do you find such control helpful? Thanks, Natty