Apache Cayenne ROP Server "No session associated with request." on Tomcat 7 - tomcat7

I develop a cayenne project with a java rich client and an remote obejct persistence server. If i the rich cient connects with a Cayenne-ROP-Server that is deployed on the same machine on localhost (on Jetty from maven goal like explained inside the cayenne rop tutorial) everythings fine:
ClientConnection clientConnection = new HessianConnection("http://localhost:8080/rop.server /cayenne-service",
"cayenne-user", "secret", SHARED_CAYENNE_SESSION_NAME);
DataChannel channel = new ClientChannel(clientConnection);
ObjectContext context = new CayenneContext(channel);
List<Object> someEntities = context.performQuery(allMovies);
If i change the url that i want to connect to in the first line to a non local host (Tomcat7 on ubuntu) then everything works till it comes to the 4th line:
List<Object> someEntities = context.performQuery(allMovies);
Then i get the Error "No session associated with request"
Here is the full Output of the Client:
Running de.pss.hdlist.client.dataservice.MovieDataServiceCayenneImplTest
Sep 07, 2012 10:21:37 AM org.apache.cayenne.remote.hessian.HessianConnection connect
INFO: Connecting to [cayenne-user:*******#http://comunity-server.hopto.org:8080 /rop.server-3.0.2/cayenne-service] - shared session 'global-cayenne-session'
Sep 07, 2012 10:21:40 AM org.apache.cayenne.remote.hessian.HessianConnection connect
INFO: === Connected, session: org.apache.cayenne.remote.RemoteSession#12241e[sessionId=C47DD36ACE2A043401C8D0C44D5BD8C3,n ame=global-cayenne-session] - took 3182 ms.
Sep 07, 2012 10:21:53 AM org.apache.cayenne.remote.BaseConnection sendMessage
INFO: --- Message 0: Bootstrap
Sep 07, 2012 10:21:53 AM org.apache.cayenne.remote.BaseConnection sendMessage
INFO: === Message 0: Bootstrap done - took 406 ms.
Sep 07, 2012 10:21:53 AM org.apache.cayenne.remote.BaseConnection sendMessage
INFO: --- Message 1: Query
Sep 07, 2012 10:21:53 AM org.apache.cayenne.remote.BaseConnection sendMessage
INFO: *** Message error for 1: Query - took 187 ms.
Here is the Serverside output of the Apache Tomcat log:
WARNING: org.apache.cayenne.remote.service.MissingSessionException: [v.3.0.2 Jun 19 2011 09:29:50] No session associated with request.
org.apache.cayenne.remote.service.MissingSessionException: [v.3.0.2 Jun 19 2011 09:29:50] No session associated with request.
at org.apache.cayenne.remote.service.BaseRemoteService.processMessage(BaseRemoteService.java:148)
at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at com.caucho.hessian.server.HessianSkeleton.invoke(HessianSkeleton.java:180)
at com.caucho.hessian.server.HessianSkeleton.invoke(HessianSkeleton.java:109)
at com.caucho.hessian.server.HessianServlet.service(HessianServlet.java:396)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:581)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:679)
I use Apache Cayenne 3.0.2, Apache-Tomcat 7.0.29 and Java 7 sdk
THX in advance for every Help
PS. Maybe the local Jetty server handles things in another way as the Tomcat Server on remote unix machine.
Edit:
After the hint given by Andrus in the answer below i added an SessionListern that looks like this:
public class HttpSessionListenerLogImpl implements HttpSessionListener {
private final static Logger LOGGER = Logger.getLogger(HttpSessionListenerLogImpl.class.getName());
#Override
public void sessionCreated(HttpSessionEvent hse) {
LOGGER.log(Level.SEVERE,
"!__Session created with ID: " + hse.getSession().getId());
LOGGER.log(Level.SEVERE, "!__Session created by: " + hse.getSource());
LOGGER.log(Level.SEVERE, "!__Session Attributes: " + hse.getSession().getAttributeNames());
LOGGER.log(Level.SEVERE, "!__Session max inactivity: " + hse.getSession().getMaxInactiveInterval());
LOGGER.log(Level.SEVERE, "!__Session context: " + hse.getSession().getServletContext().getServletContextName());
}
#Override
public void sessionDestroyed(HttpSessionEvent hse) {
LOGGER.log(Level.SEVERE, "!__Session killed with ID: " + hse.getSession().getId());
LOGGER.log(Level.SEVERE, "!__Session killed by: " + hse.getSource());
LOGGER.log(Level.SEVERE, "!__Session Attributes: " + hse.getSession().getAttributeNames());
LOGGER.log(Level.SEVERE, "!__Session max inactivity: " + hse.getSession().getMaxInactiveInterval());
LOGGER.log(Level.SEVERE, "!__Session context: " + hse.getSession().getServletContext().getServletContextName());
}
So this listern gives me the following output when executing the 4 lines of code statet on top of this Question:
Sep 11, 2012 11:06:27 AM de.pss.hdlist.HttpSessionListenerLogImpl sessionCreated
SEVERE: !__Session created with ID: B07648A2A5F0005AF6DF0741D7EF2D21
Sep 11, 2012 11:06:27 AM de.pss.hdlist.HttpSessionListenerLogImpl sessionCreated
SEVERE: !__Session created by: org.apache.catalina.session.StandardSessionFacade#515f9553
Sep 11, 2012 11:06:27 AM de.pss.hdlist.HttpSessionListenerLogImpl sessionCreated
SEVERE: !__Session Attributes: java.util.Collections$2#5a44a5e1
Sep 11, 2012 11:06:27 AM de.pss.hdlist.HttpSessionListenerLogImpl sessionCreated
SEVERE: !__Session max inactivity: 216000
Sep 11, 2012 11:06:27 AM de.pss.hdlist.HttpSessionListenerLogImpl sessionCreated
SEVERE: !__Session context: Cayenne Tutorial
Sep 11, 2012 11:06:27 AM com.caucho.hessian.server.HessianSkeleton invoke
WARNING: org.apache.cayenne.remote.service.MissingSessionException: [v.3.0.2 Jun 19 2011 09:29:50] No session associated with request.
org.apache.cayenne.remote.service.MissingSessionException: [v.3.0.2 Jun 19 2011 09:29:50] No session associated with request.
at org.apache.cayenne.remote.service.BaseRemoteService.processMessage(BaseRemoteService.java:148)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at com.caucho.hessian.server.HessianSkeleton.invoke(HessianSkeleton.java:180)
at com.caucho.hessian.server.HessianSkeleton.invoke(HessianSkeleton.java:109)
at com.caucho.hessian.server.HessianServlet.service(HessianServlet.java:396)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:581)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:679)
Here you can see there is a session that gets created and there is no session that gets killed. So why does the ObjectContext from my line of code
List<Object> someEntities = context.performQuery(allMovies);
does ignore the session. Do i have to set it explicitly before doing a query? What is the standard initializing code on the client side to access an remotly deployed cayenne server. Does it differ from the one given inside the cayenne rop tutorial?
THX in advance.
Edit:
I upgraded to cayenne 3.1B1 hoping to get rid of this error, but same Situation here: "No session..." when trying to send a query.
I also setup a tomcat on localhost and configured it the same as the remote is. Same Problem here "No Session..." when trying to send a query.
So the Jetty on localhost is the only one that takes the 4 line init code from above and holds the session for every following query. So here is my Question. Does anyone on this planet ever tried to deploy a cayenne rop server on a tomcat and succeeded?
THX in advance for every little hint.
Edit:
So i did a litte bit of server side debugging on my local tomcat7.
1.Client executes line 2 of code from above:
DataChannel channel = new ClientChannel(clientConnection);
on the Serverside my session listener gets triggerd and tells me a session has been created with id: B6565298F222294F601B76333DBE4911
2.Client executes line 3 from above:
ObjectContext context = new CayenneContext(channel);
On the server side the method of class org.apache.cayenne.remote.service.HttpRemoteSession gets called:
/**
* Returns a ServerSession object that represents Cayenne-related state associated
* with the current session. If ServerSession hasn't been previously saved, returns
* null.
*/
#Override
protected ServerSession getServerSession() {
HttpSession httpSession = getSession(true);
return (ServerSession) httpSession.getAttribute(SESSION_ATTRIBUTE);
}
a new session gets created by line one of this method. Its ID is: ECC4A81D6240A1D04DA0A646200C4CE6. This new Session contains exactly one attribute: the key is "org.apache.cayenne.remote.service.HttpRemoteService.ServerSession" and the value is (who guessed it?) the session created before in step 1
What makes me wonder is that my serveltListener dont gets triggerd though a new session gets created.
3.Client executes line 4 from above
List<Object> someEntities = context.performQuery(allMovies);
at the serverside now the getServerSession() method is called again. This time also a new session gets created (why?). And this session does not contain any attribute. So the line "return (ServerSession) httpSession.getAttribute(SESSION_ATTRIBUTE);" inside the method getServerSession() returns null and exactly this triggers the exception "No Session associated with request".
So why is the cayenne serverside creating e ne session and doesnt use the old one created befor? Do i have to explicitly send the session within the query?
Edit:
I made screenshots from the netbeans http-monitor while running the four lines of code from above:

This is an issue between Cayenne ROP and newer containers:
https://issues.apache.org/jira/browse/CAY-1739
Here is a Tomcat solution - create context.xml file with the following contents, and place it in META-INF/ of your webapp:
<Context>
<Valve className="org.apache.catalina.authenticator.BasicAuthenticator"
changeSessionIdOnAuthentication="false" />
</Context>

Related

Handshake failed due to invalid Connection header [Keep-Alive]

I have a websocket project, develop it on Weblogic 12c and Spring MVC 5.1.0.RELEASE
When i running project on local tomcat, its working normally, but when trying to deploy on Weblogic, its gave below error. (Error only occurs with secure domain, when i tried to on http adress with ip its working good.)
Apr 09, 2021 2:28:57 PM org.springframework.web.socket.server.support.AbstractHandshakeHandler handleInvalidConnectHeader
SEVERE: Handshake failed due to invalid Connection header [Keep-Alive]
<Apr 9, 2021 2:28:57 PM GMT+03:00> <Error> <org.springframework.web.socket.server.support.DefaultHandshakeHandler> <BEA-000000> <Handshake failed due to invalid Connection header [Keep-Alive]>
My headers;
- Sec-WebSocket-Version : 13
- Sec-WebSocket-Key : MoTfrW6Iim1noQgYHlkeYQ==
- Upgrade : websocket
- Cookie : jwt=eyJhbGciO....
- Sec-WebSocket-Extensions : permessage-deflate; client_max_window_bits
- Host : infotest.infotech.com.tr
- ECID-Context : 1.005jsZwLhO_EoIWVLynJ8A0001Cy0000i2;kXjE
- Connection : Keep-Alive
- X-WebLogic-KeepAliveSecs : 30
- X-WebLogic-Force-JVMID : -414283189
- X-WebLogic-Request-ClusterInfo : true
My implementation something like;
#Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
registry.addHandler(new EchoHandler(), "/echo").addInterceptors(customHandshakeInterceptor())
.setAllowedOrigins("*");
}
Testing with;
wscat -c ws://localhost:8080/projectName/echo --no-color
any help ?
you need to change the value for Connection header to 'Upgrade';

Simple Flyway example fails with ORA-00911 invalid character

I'm trying out Flyway with a simple example, and somehow fell into an error I don't understand. This is just a "hello world" type project.
This migration script fails as posted here, but succeeds if I either remove the ";" at the end, or change the column default to anything but 'N'. Lowercase 'n' also fails.
I've used a hex editor to confirm everything is ascii, and can successfully run the migration script in Toad and SQuirreL. It only fails when going through Flyway.
I've also used the debugger to capture the SQL string within Flyway before it gets executed, and it looks fine there as well. Copying it from the debugger to Toad or SQuirreL also succeeds.
It's got to be something simple that I'm missing, but I can't see what it is. Any ideas?
Here's my only migration script:
CREATE TABLE APP_USER
(
USER_ID INTEGER NOT NULL,
USER_CONFIRMED CHAR(1) DEFAULT 'N'
);
and the code:
import javax.sql.DataSource;
import oracle.jdbc.pool.OracleDataSource;
import org.flywaydb.core.Flyway;
public class FlywayTask {
public static void main(String[] args) {
FlywayTask flywayTask = new FlywayTask();
try {
flywayTask.run();
} catch (Exception e) {
e.printStackTrace();
}
}
public void run() {
System.out.println("FlywayTask Running!");
// Create Flyway instance w/ a datasource
Flyway flyway = new Flyway();
flyway.setDataSource(buildDS());
// Delete the WHOLE SCHEMA!! DANGER!!
flyway.clean();
// Start the migration
flyway.migrate();
}
public DataSource buildDS() {
...
return ods;
}
}
Running this against Oracle 10g or 11g results in this error:
FlywayTask Running!
Jun 12, 2015 10:38:40 AM org.flywaydb.core.internal.util.VersionPrinter printVersion
INFO: Flyway 3.2 by Boxfuse
Jun 12, 2015 10:38:41 AM org.flywaydb.core.internal.dbsupport.DbSupportFactory createDbSupport
INFO: Database: jdbc:oracle:thin:#(DESCRIPTION= (ADDRESS=(PROTOCOL=TCP)(HOST=scan-dev-db.dev.probuild.com )(PORT=1525)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME=NTRADEV.dev.probuild.com))) (Oracle 11.2)
Jun 12, 2015 10:38:42 AM org.flywaydb.core.internal.command.DbClean cleanSchema
INFO: Cleaned schema "TOM1" (execution time 00:00.686s)
Jun 12, 2015 10:38:42 AM org.flywaydb.core.internal.command.DbValidate validate
INFO: Validated 1 migration (execution time 00:00.016s)
Jun 12, 2015 10:38:42 AM org.flywaydb.core.internal.metadatatable.MetaDataTableImpl createIfNotExists
INFO: Creating Metadata table: "TOM1"."schema_version"
Jun 12, 2015 10:38:43 AM org.flywaydb.core.internal.command.DbMigrate migrate
INFO: Current version of schema "TOM1": << Empty Schema >>
Jun 12, 2015 10:38:43 AM org.flywaydb.core.internal.command.DbMigrate applyMigration
INFO: Migrating schema "TOM1" to version 1 - Tables
Jun 12, 2015 10:38:43 AM org.flywaydb.core.internal.command.DbMigrate applyMigration
SEVERE: Migration of schema "TOM1" to version 1 failed! Please restore backups and roll back database and code!
org.flywaydb.core.internal.dbsupport.FlywaySqlScriptException:
Migration V1__Tables.sql failed
-------------------------------
SQL State : 22019
Error Code : 911
Message : ORA-00911: invalid character
Location : db/migration/V1__Tables.sql (C:\Workspaces\luna_64\flyway-spike\target\classes\db\migration\V1__Tables.sql)
Line : 3
Statement : CREATE TABLE APP_USER
(
USER_ID INTEGER NOT NULL,
USER_CONFIRMED CHAR(1) DEFAULT 'N'
);
at org.flywaydb.core.internal.dbsupport.SqlScript.execute(SqlScript.java:117)
at org.flywaydb.core.internal.resolver.sql.SqlMigrationExecutor.execute(SqlMigrationExecutor.java:71)
at org.flywaydb.core.internal.command.DbMigrate$5.doInTransaction(DbMigrate.java:284)
at org.flywaydb.core.internal.command.DbMigrate$5.doInTransaction(DbMigrate.java:282)
at org.flywaydb.core.internal.util.jdbc.TransactionTemplate.execute(TransactionTemplate.java:72)
at org.flywaydb.core.internal.command.DbMigrate.applyMigration(DbMigrate.java:282)
at org.flywaydb.core.internal.command.DbMigrate.access$800(DbMigrate.java:46)
at org.flywaydb.core.internal.command.DbMigrate$2.doInTransaction(DbMigrate.java:207)
at org.flywaydb.core.internal.command.DbMigrate$2.doInTransaction(DbMigrate.java:156)
at org.flywaydb.core.internal.util.jdbc.TransactionTemplate.execute(TransactionTemplate.java:72)
at org.flywaydb.core.internal.command.DbMigrate.migrate(DbMigrate.java:156)
at org.flywaydb.core.Flyway$1.execute(Flyway.java:1059)
at org.flywaydb.core.Flyway$1.execute(Flyway.java:1006)
at org.flywaydb.core.Flyway.execute(Flyway.java:1418)
at org.flywaydb.core.Flyway.migrate(Flyway.java:1006)
at com.probuild.spike.flyway.FlywayTask.run(FlywayTask.java:34)
at com.probuild.spike.flyway.FlywayTask.main(FlywayTask.java:16)
Caused by: java.sql.SQLSyntaxErrorException: ORA-00911: invalid character
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:440)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:837)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:445)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:191)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:523)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:193)
at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:999)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1315)
at oracle.jdbc.driver.OracleStatement.executeInternal(OracleStatement.java:1890)
at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:1855)
at oracle.jdbc.driver.OracleStatementWrapper.execute(OracleStatementWrapper.java:304)
at org.flywaydb.core.internal.dbsupport.JdbcTemplate.executeStatement(JdbcTemplate.java:238)
at org.flywaydb.core.internal.dbsupport.SqlScript.execute(SqlScript.java:114)
... 16 more
It is know bug of Flyway. It is fixed already, but it will be released in Flyway 4.0. Take a look at issue 1080

WSO2 data service (DS) in ESB 4.0.3 returns wrong fault message

I work at Apple and we are working on the prototype using WSO2 ESB with Data Services Feature. I am using WSO2 ESB 4.0.3 with DSS feature. I have deployed data service and calling the data service from proxy service in ESB. I am using MAC OS X 10.7.4 and java version details are as below.
java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b04-415-11M3635)
Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01-415, mixed mode)
My DS service is expecting certain parameter say parameter A and I do not pass that this parameter in the Input XML I see following error on the WSO2 ESB console.
[2012-06-07 09:49:11,348] ERROR - DataService DS Fault Message: Error in 'CallQuery.extractParams', cannot find parameter with type:query-param name:Hw_Serial_Nr
DS Code: INCOMPATIBLE_PARAMETERS_ERROR
Source Data Service:-
Name: OWCHECK
Location: /TQS_OWCHECK.dbs
Description: N/A
Default Namespace: http://ws.wso2.org/dataservice
Current Request Name: OWCHECK_OP
Current Params: {COUNTRYORIGIN=US, SUBDT=20090428}
DS Fault Message: Error in 'CallQuery.extractParams', cannot find parameter with type:query-param name:Hw_Serial_Nr
DS Code: INCOMPATIBLE_PARAMETERS_ERROR
Source Data Service:-
Name: OWCHECK
Location: /TQS_OWCHECK.dbs
Description: N/A
Default Namespace: http://ws.wso2.org/dataservice
Current Request Name: OWCHECK_OP
Current Params: {COUNTRYORIGIN=US, SUBDT=20090428}
at org.wso2.carbon.dataservices.core.engine.CallQuery.extractParams(CallQuery.java:214)
at org.wso2.carbon.dataservices.core.engine.CallQuery.execute(CallQuery.java:183)
at org.wso2.carbon.dataservices.core.engine.CallQueryGroup.execute(CallQueryGroup.java:110)
at org.wso2.carbon.dataservices.core.description.operation.Operation.execute(Operation.java:71)
at org.wso2.carbon.dataservices.core.engine.DataService.invoke(DataService.java:592)
at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.execute(DSOMDataSource.java:99)
at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.serialize(DSOMDataSource.java:110)
at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.getReader(DSOMDataSource.java:116)
at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.getDirectReader(OMSourcedElementImpl.java:225)
at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.forceExpand(OMSourcedElementImpl.java:254)
at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.getFirstOMChild(OMSourcedElementImpl.java:867)
at org.apache.axiom.om.impl.OMNavigator._getFirstChild(OMNavigator.java:196)
at org.apache.axiom.om.impl.OMNavigator.updateNextNode(OMNavigator.java:140)
at org.apache.axiom.om.impl.OMNavigator.getNext(OMNavigator.java:112)
at org.apache.axiom.om.impl.SwitchingWrapper.updateNextNode(SwitchingWrapper.java:1113)
at org.apache.axiom.om.impl.SwitchingWrapper.updateLastNode(SwitchingWrapper.java:1104)
at org.apache.axiom.om.impl.SwitchingWrapper.next(SwitchingWrapper.java:1041)
at javax.xml.stream.util.StreamReaderDelegate.next(StreamReaderDelegate.java:47)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:681)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:214)
at org.apache.axiom.om.impl.llom.OMSerializableImpl.build(OMSerializableImpl.java:78)
at org.apache.axiom.om.impl.llom.OMElementImpl.build(OMElementImpl.java:722)
at org.apache.axiom.om.impl.llom.OMElementImpl.cloneOMElement(OMElementImpl.java:1065)
at org.wso2.carbon.tracer.module.handler.AbstractTracingHandler.storeMessage(AbstractTracingHandler.java:81)
at org.wso2.carbon.tracer.module.handler.TracingMessageOutObservationHandler.invoke(TracingMessageOutObservationHandler.java:94)
at org.apache.axis2.engine.Phase.invokeHandler(Phase.java:340)
at org.apache.axis2.engine.Phase.invoke(Phase.java:313)
at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:262)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:427)
at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.invokeBusinessLogic(AbstractInOutSyncMessageReceiver.java:45)
at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:110)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)
at org.apache.synapse.transport.nhttp.ServerWorker.processEntityEnclosingMethod(ServerWorker.java:409)
at org.apache.synapse.transport.nhttp.ServerWorker.run(ServerWorker.java:261)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:173)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
[2012-06-07 09:49:11,352] ERROR - OMSourcedElementImpl Could not get parser from data source for element {http://ws.wso2.org/dataservice}EVENT
javax.xml.stream.XMLStreamException: DS Fault Message: Error in 'CallQuery.extractParams', cannot find parameter with type:query-param name:Hw_Serial_Nr
DS Code: INCOMPATIBLE_PARAMETERS_ERROR
Source Data Service:-
Name: OWCHECK
Location: /TQS_OWCHECK.dbs
Description: N/A
Default Namespace: http://ws.wso2.org/dataservice
Current Request Name: OWCHECK_OP
Current Params: {COUNTRYORIGIN=US, SUBDT=20090428}
at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.execute(DSOMDataSource.java:105)
at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.serialize(DSOMDataSource.java:110)
at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.getReader(DSOMDataSource.java:116)
at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.getDirectReader(OMSourcedElementImpl.java:225)
at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.forceExpand(OMSourcedElementImpl.java:254)
at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.getFirstOMChild(OMSourcedElementImpl.java:867)
at org.apache.axiom.om.impl.OMNavigator._getFirstChild(OMNavigator.java:196)
at org.apache.axiom.om.impl.OMNavigator.updateNextNode(OMNavigator.java:140)
at org.apache.axiom.om.impl.OMNavigator.getNext(OMNavigator.java:112)
at org.apache.axiom.om.impl.SwitchingWrapper.updateNextNode(SwitchingWrapper.java:1113)
at org.apache.axiom.om.impl.SwitchingWrapper.updateLastNode(SwitchingWrapper.java:1104)
at org.apache.axiom.om.impl.SwitchingWrapper.next(SwitchingWrapper.java:1041)
at javax.xml.stream.util.StreamReaderDelegate.next(StreamReaderDelegate.java:47)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:681)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:214)
at org.apache.axiom.om.impl.llom.OMSerializableImpl.build(OMSerializableImpl.java:78)
at org.apache.axiom.om.impl.llom.OMElementImpl.build(OMElementImpl.java:722)
at org.apache.axiom.om.impl.llom.OMElementImpl.cloneOMElement(OMElementImpl.java:1065)
at org.wso2.carbon.tracer.module.handler.AbstractTracingHandler.storeMessage(AbstractTracingHandler.java:81)
at org.wso2.carbon.tracer.module.handler.TracingMessageOutObservationHandler.invoke(TracingMessageOutObservationHandler.java:94)
at org.apache.axis2.engine.Phase.invokeHandler(Phase.java:340)
at org.apache.axis2.engine.Phase.invoke(Phase.java:313)
at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:262)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:427)
at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.invokeBusinessLogic(AbstractInOutSyncMessageReceiver.java:45)
at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:110)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)
at org.apache.synapse.transport.nhttp.ServerWorker.processEntityEnclosingMethod(ServerWorker.java:409)
at org.apache.synapse.transport.nhttp.ServerWorker.run(ServerWorker.java:261)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:173)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
[2012-06-07 09:49:11,355] ERROR - ServerWorker Error processing POST request
org.apache.axis2.AxisFault: javax.xml.stream.XMLStreamException
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:180)
at org.apache.synapse.transport.nhttp.ServerWorker.processEntityEnclosingMethod(ServerWorker.java:409)
at org.apache.synapse.transport.nhttp.ServerWorker.run(ServerWorker.java:261)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:173)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
Caused by: org.apache.axiom.om.OMException: javax.xml.stream.XMLStreamException
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:296)
at org.apache.axiom.om.impl.llom.OMSerializableImpl.build(OMSerializableImpl.java:78)
at org.apache.axiom.om.impl.llom.OMElementImpl.build(OMElementImpl.java:722)
at org.apache.axiom.om.impl.llom.OMElementImpl.cloneOMElement(OMElementImpl.java:1065)
at org.wso2.carbon.tracer.module.handler.AbstractTracingHandler.storeMessage(AbstractTracingHandler.java:81)
at org.wso2.carbon.tracer.module.handler.TracingMessageOutObservationHandler.invoke(TracingMessageOutObservationHandler.java:94)
at org.apache.axis2.engine.Phase.invokeHandler(Phase.java:340)
at org.apache.axis2.engine.Phase.invoke(Phase.java:313)
at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:262)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:427)
at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.invokeBusinessLogic(AbstractInOutSyncMessageReceiver.java:45)
at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:110)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)
... 6 more
Caused by: javax.xml.stream.XMLStreamException
at org.apache.axiom.om.impl.SwitchingWrapper.updateLastNode(SwitchingWrapper.java:1106)
at org.apache.axiom.om.impl.SwitchingWrapper.next(SwitchingWrapper.java:1041)
at javax.xml.stream.util.StreamReaderDelegate.next(StreamReaderDelegate.java:47)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:681)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:214)
... 19 more
[2012-06-07 09:49:11,375] WARN - ClientHandler Received an internal server error : Internal Server Error For : 127.0.0.1:8280 For Request : Axis2Request [Message ID : urn:uuid:55a4d59a-2be2-43ee-99b5-8943b1ff2b91] [Status Completed : true] [Status SendingCompleted : true]
How ever the fault message it returned to the proxy service is as below
2012-06-07 09:49:11,081 [-] [HttpServerWorker-1] TRACE OWCHECK_RPOXY To: /services/OWCHECK_RPOXY.OWCHECK_RPOXYHttpSoap12Endpoint, WSAction: urn:mediate, SOAPAction: urn:mediate, MessageID: urn:uuid:1f8cb9bf-ab10-40a4-b75d-6b3d4805322c, Direction: request, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><OWCHECK_OP spec="IDL:com/apple/vitria/idl/sapamr_rfcevents/RfcCallEvents:1.0#Z_WARR_VALIDATION_GROUP"><TAB_SERNHDR><SERIALNR>YM6191TJSCH</SERIALNR><SUBDT>20090428</SUBDT><COUNTRYORIGIN>US</COUNTRYORIGIN></TAB_SERNHDR></OWCHECK_OP></soapenv:Body></soapenv:Envelope>
2012-06-07 09:49:11,398 [-] [HttpClientWorker-1] TRACE OWCHECK_RPOXY To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:55a4d59a-2be2-43ee-99b5-8943b1ff2b91, Direction: response, MESSAGE = In-to-OutSequence !!!!!!!!!!!!!!!!!!!!!!!!!!!!, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><soapenv:Fault><soapenv:Code><soapenv:Value>soapenv:Receiver</soapenv:Value></soapenv:Code><soapenv:Reason><soapenv:Text xml:lang="en-US">javax.xml.stream.XMLStreamException</soapenv:Text></soapenv:Reason><soapenv:Detail><Exception>org.apache.axis2.AxisFault: javax.xml.stream.XMLStreamException
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:180)
at org.apache.synapse.transport.nhttp.ServerWorker.processEntityEnclosingMethod(ServerWorker.java:409)
at org.apache.synapse.transport.nhttp.ServerWorker.run(ServerWorker.java:261)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:173)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
Caused by: org.apache.axiom.om.OMException: javax.xml.stream.XMLStreamException
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:296)
at org.apache.axiom.om.impl.llom.OMSerializableImpl.build(OMSerializableImpl.java:78)
at org.apache.axiom.om.impl.llom.OMElementImpl.build(OMElementImpl.java:722)
at org.apache.axiom.om.impl.llom.OMElementImpl.cloneOMElement(OMElementImpl.java:1065)
at org.wso2.carbon.tracer.module.handler.AbstractTracingHandler.storeMessage(AbstractTracingHandler.java:81)
at org.wso2.carbon.tracer.module.handler.TracingMessageOutObservationHandler.invoke(TracingMessageOutObservationHandler.java:94)
at org.apache.axis2.engine.Phase.invokeHandler(Phase.java:340)
at org.apache.axis2.engine.Phase.invoke(Phase.java:313)
at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:262)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:427)
at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.invokeBusinessLogic(AbstractInOutSyncMessageReceiver.java:45)
at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:110)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)
... 6 more
Caused by: javax.xml.stream.XMLStreamException
at org.apache.axiom.om.impl.SwitchingWrapper.updateLastNode(SwitchingWrapper.java:1106)
at org.apache.axiom.om.impl.SwitchingWrapper.next(SwitchingWrapper.java:1041)
at javax.xml.stream.util.StreamReaderDelegate.next(StreamReaderDelegate.java:47)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:681)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:214)
... 19 more
</Exception></soapenv:Detail></soapenv:Fault></soapenv:Body></soapenv:Envelope>
Looking at the SOAP fault I have to return the error message to client but even thought the correct error message must "Parameter Missing" SOAP fault's reason text is "javax.xml.stream.XMLStreamException"
Is there any thing wrong I am doing or is it BUG in DSS?
By looking at the stacktrace, I can see that you've enabled the SOAP tracer in invoking the service, disable the SOAP tracer and you should get the proper fault message.
Cheers,
Anjana.
As error message explains itself, it is expecting input parameters, which is not coming int the request. It can be fixed by two ways:
Passing empty tag from ESB without value.
Set default value in DSS.
First option works with all versions, here is the example for setting default value.
<payloadFactory media-type="xml">
<format>
<ds:DATA_SERVICE_REQUST xmlns:ds="http://ws.wso2.org/dataservice">
<ds:INPUT_PARAM_1>$1</ds:INPUT_PARAM_1>
</ds:DATA_SERVICE_REQUST>
</format>
<args>
<arg xmlns:ds="http://ws.wso2.org/dataservice" evaluator="xml" expression="get-property('INPUT_PARAMETER')"/>
</args>
</payloadFactory>
<call>
<endpoint>
<address uri="DSS_END_POINT"/>
</endpoint>
</call>
For 2nd option, please check your DSS version if this supports null values
Latest Version of DSS Supports default parameter values in the query param list.
Could you please give a try by adding defaultValue="#{NULL}" in query param list in your data service (dbs) file?
<query id="QUERY-ID" useConfig="DATA-SOURCE-ID">
<sql>-------------SQL QUERY HERE -----</sql>
<result ----------- >
<element ------------ />
</result>
<param defaultValue="#{NULL}" name="PARAM-NAME" ordinal="1" sqlType="INTEGER"/>
</query>
If this issue is still not resolved then it would be good if you can provide your API details.

Disconnecting Atmosphere sockets in Grails

I'm writing a Grails application which uses Atmosphere plugin. The connection works but every time I update the page in a browser I see that my web server adds a new Daemon thread which is never released afterwards.
After the thread count reaches 200 the web server freezes.
There seems to be no documentation explaining what is exactly the right way to handle the resources (disconnect) with the Atmosphere plugin?
My client code does this:
var connectedEndpoint = null;
$(function()
{
function callback(response)
{
if (response.transport != 'polling' && response.state != 'connected' && response.state != 'closed') {
if (response.status == 200) {
eval(response.responseBody);
}
}
}
$.atmosphere.subscribe('${resource(dir: '/atmosphere/channel')}', callback, $.atmosphere.request = {transport: 'streaming'});
connectedEndpoint = $.atmosphere.response;
});
$(window).unload( function ()
{
$.atmosphere.unsubscribe();
connectedEndpoint = null;
});
I use an atmosphere handler on the server side;
package demo
import javax.servlet.http.HttpServletRequest
import javax.servlet.http.HttpServletResponse
import org.atmosphere.cpr.AtmosphereHandler
import org.atmosphere.cpr.AtmosphereResource;
import org.atmosphere.cpr.AtmosphereResourceEvent;
class DemoController implements AtmosphereHandler<HttpServletRequest, HttpServletResponse> {
#Override
public void destroy() {
println "destroy"
}
#Override
public void onRequest( AtmosphereResource<HttpServletRequest, HttpServletResponse> event) throws IOException
{
event.suspend()
}
#Override
public void onStateChange( AtmosphereResourceEvent<HttpServletRequest, HttpServletResponse> event) throws IOException
{
if (event.isSuspended())
{
event.resource.response.writer.with {
def message = event.message
write "set${message.paramName}(\"${message.id}\",\"${message.value}\");"
flush()
}
}
}
}
The destroy function of the handler is never called!
The next picture shows that I have 23 threads running. When I start my application there are about 6 of them and they are added every time I press F5! If I disable atmosphere new threads are not added so this problem is related to the Atmosphere. (I am using SpringSource Tools Suite on Windows7).
If the solution is not trivial I would appreciate detailed step-by step instructions or an example.
UPDATE: After deployment in Tomcat I have the following errors each 20 seconds:
Apr 02, 2012 2:35:15 PM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor host-manager.xml
Apr 02, 2012 2:35:16 PM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor manager.xml
Apr 02, 2012 2:35:16 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory docs
Apr 02, 2012 2:35:16 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory examples
Apr 02, 2012 2:35:17 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory ROOT
Apr 02, 2012 2:35:17 PM org.apache.coyote.http11.Http11AprProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Apr 02, 2012 2:35:17 PM org.apache.coyote.ajp.AjpAprProtocol start
INFO: Starting Coyote AJP/1.3 on ajp-8009
Apr 02, 2012 2:35:17 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 11401 ms
2012-04-02 14:41:17,122 [http-8080-39] ERROR cpr.AsynchronousProcessor - failed
to timeout resource AtmosphereResourceImpl{, hasCode-1035775543,
action=org.atmosphere.cpr.AtmosphereServlet$Action#f2718e,
broadcaster=org.atmosphere.cpr.DefaultBroadcaster,
cometSupport=org.atmosphere.container.TomcatCometSupport#107fff7,
serializer=null,
isInScope=true,
useWriter=true,
listeners=[]}
2012-04-02 14:42:15,034 [http-8080-69] ERROR cpr.AsynchronousProcessor - failed
to timeout resource AtmosphereResourceImpl{, hasCode-58082012,
action=org.atmosphere.cpr.AtmosphereServlet$Action#ae4dd4,
broadcaster=org.atmosphere.cpr.DefaultBroadcaster,
cometSupport=org.atmosphere.container.TomcatCometSupport#107fff7,
serializer=null,
isInScope=true,
useWriter=true,
listeners=[]}
2012-04-02 14:44:41,159 [http-8080-13] ERROR cpr.AsynchronousProcessor - failed
to timeout resource AtmosphereResourceImpl{, hasCode648226529,
action=org.atmosphere.cpr.AtmosphereServlet$Action#507e61,
broadcaster=org.atmosphere.cpr.DefaultBroadcaster,
cometSupport=org.atmosphere.container.TomcatCometSupport#107fff7,
serializer=null,
isInScope=true,
useWriter=true,
listeners=[]}
....
Which web server are you using? Sound like the web server isn't detecting when the browser close the connection. You can add, in web.xml, the following timeout detector
org.atmosphere.cpr.CometSupport.maxInactiveActivity=30000 //30 seconds
I believe your issue is in your unload event. "$(window).unload". I know at least in chrome, you can't do much in the unload or beforeunload events. therefore, your browser is probably never firing the unsubscribe().
if u look at Atmospheres jquery pubsub sample, u can see the unsubscribing before connecting,
function connect() {
unsubscribe();
...
you can code a loop to check broadcasters by pushing insignificant data to validate the broadcasters periodically if they arent getting cleaned up. i need to research atmosphere more and hope for a better solution. hopefully you can clean up threads when the new connection is created from a refresh and let old ones expire with the session when the user leaves.

Building a JMX client in a servlet installed on the Deployment Manager

I'm building a monitoring application as a servlet running on my websphere 7 ND deployment manager. The tool uses JMX to query the deployment manager for various data. Global Security is enabled on the dmgr.
I'm having problems getting this to work however. My first attempt was to use the websphere client code:
String sslProps = "file:" + base +"/properties/ssl.client.props";
System.setProperty("com.ibm.SSL.ConfigURL", sslProps);
String soapProps = "file:" + base +"/properties/soap.client.props";
System.setProperty("com.ibm.SOAP.ConfigURL", pp);
Properties connectProps = new Properties();
connectProps.setProperty(AdminClient.CONNECTOR_TYPE, AdminClient.CONNECTOR_TYPE_SOAP);
connectProps.setProperty(AdminClient.CONNECTOR_HOST, dmgrHost);
connectProps.setProperty(AdminClient.CONNECTOR_PORT, soapPort);
connectProps.setProperty(AdminClient.CONNECTOR_SECURITY_ENABLED, "true");
AdminClient adminClient = AdminClientFactory.createAdminClient(connectProps) ;
This results in the following exception:
Caused by: com.ibm.websphere.management.exception.ConnectorNotAvailableException: ADMC0016E: The system cannot create a SOAP connector to connect to host ssunlab10.apaceng.net at port 13903.
at com.ibm.ws.management.connector.soap.SOAPConnectorClient.getUrl(SOAPConnectorClient.java:1306)
at com.ibm.ws.management.connector.soap.SOAPConnectorClient.access$300(SOAPConnectorClient.java:128)
at com.ibm.ws.management.connector.soap.SOAPConnectorClient$4.run(SOAPConnectorClient.java:370)
at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118)
at com.ibm.ws.management.connector.soap.SOAPConnectorClient.reconnect(SOAPConnectorClient.java:363)
... 22 more
Caused by: java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:519)
at java.net.Socket.connect(Socket.java:469)
at java.net.Socket.<init>(Socket.java:366)
at java.net.Socket.<init>(Socket.java:209)
at com.ibm.ws.management.connector.soap.SOAPConnectorClient.getUrl(SOAPConnectorClient.java:1286)
... 26 more
So, I then tried to do it via RMI, but adding in the sas.client.properties to the environment, and setting the connectort type in the code to CONNECTOR_TYPE_RMI. Now though I got a NameNotFoundException out of CORBA:
Caused by: javax.naming.NameNotFoundException: Context: , name: JMXConnector: First component in name JMXConnector not found. [Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0]
To see if it was an IBM issue, I tried using the standard JMX connector as well with the same result (substitute AdminClient for JMXConnector in the above error)
JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/JMXConnector");
Hashtable h = new Hashtable();
String providerUrl = "corbaloc:iiop:" + dmgrHost + ":" + rmiPort + "/WsnAdminNameService";
h.put(Context.PROVIDER_URL, providerUrl);
// Specify the user ID and password for the server if security is enabled on server.
String[] credentials = new String[] { "***", "***" };
h.put("jmx.remote.credentials", credentials);
// Establish the JMX connection.
JMXConnector jmxc = JMXConnectorFactory.connect(url, h);
// Get the MBean server connection instance.
mbsc = jmxc.getMBeanServerConnection();
At this point, in desperation I wrote a wsadmin sccript to run both the RMI and SOAP methods. To my amazement, this works fine. So my question is, why does the code not work in a servlet installed on the dmgr ?
regards,
Trevor
For the SOAP error, the ConnectException looks like the wrong SOAP host/port was used for the dmgr. I would double-check the server logs for the SOAP port. For the RMI error (NameNotFoundException), it looks like you're trying to use JMXConnectorFactory, which isn't supported by WAS.
If your application is installed on the dmgr, it's probably easiest to just use AdminServiceFactory.getAdminService to get an in-process reference to the AdminService rather than trying to open a new connection to the same process:
http://publib.boulder.ibm.com/infocenter/wasinfo/fep/topic/com.ibm.websphere.javadoc.doc/web/apidocs/com/ibm/websphere/management/AdminServiceFactory.html

Resources