[Messaging, JMS & JBossMQ] - Error trying to access remote Queue or Topic
by neidisch
Hi there,
first of all I am just a beginner with JBossMQ and JMS.
I am succesfully using a MDB for sending messages to a queue. Both EJB MDN and queue are in the same server.
Now, for other purposes I need to send some messages to the same queue since a little stand alone client.
The following code works fine if executed on the server:
| Properties env = new Properties();
| env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
| env.put(Context.URL_PKG_PREFIXES, "org.jnp.interfaces");
| env.put(Context.PROVIDER_URL, "jorge:1199");
| env.put("java.naming.rmi.security.manager", "yes");
| QueueConnection connection = null;
| try {
| Context ctx = new InitialContext(env);
| Queue queue = (Queue)ctx.lookup("queue/OrderBriefQueue");
| QueueConnectionFactory queueFactory = (QueueConnectionFactory)ctx.lookup("UIL2ConnectionFactory");
| connection = queueFactory.createQueueConnection();
| QueueSession session = connection.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
| QueueSender sender = session.createSender(queue);
| MapMessage mMessage = session.createMapMessage();
| mMessage.setString("key", "value");
| sender.send(mMessage);
| String msgId = mMessage.getJMSMessageID();
| log.info("Message sent; ID " + msgId);
| } catch (NamingException e) {
| } catch (JMSException e) {
| } finally {
| connection.close();
| }
|
But if executed in any other machine (with provesd access to the server), I get the exception:
org.jboss.mq.SpyJMSException: Cannot authenticate user; - nested throwable: (java.net.ConnectException: Connection refused)
at org.jboss.mq.Connection.authenticate(Connection.java:883)
at org.jboss.mq.Connection.(Connection.java:238)
at org.jboss.mq.SpyConnection.(SpyConnection.java:49)
at org.jboss.mq.SpyConnectionFactory.createQueueConnection(SpyConnectionFactory.java:135)
I know that I am a beginner, but I haven't found documentation explicit enough...
What am I doing wrong?
btw, I am using jboss 3.2.2.
Regards and thanx in advance
Neidisch
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3966923#3966923
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3966923
19 years, 8 months
[JNDI/Naming/Network] - JNDI datasource not available in one webapp while its availa
by wfenthusiast
Hi,
I have a datasource configured using myds-ds.xml in jboss and when starting up it gets bound.
15:57:43,414 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:name=MyDS,service=DataSourceBinding' to JNDI name 'java:MyDS'
But I'm not able to access this datasource through the usual context lookup
InitialContext ctxt = new InitialContext();
| Object o = ctxt.lookup("java:/OracleDS");
| DataSource ds = (DataSource) PortableRemoteObject.narrow(o, DataSource.class);
I get the following exception.
javax.naming.NameNotFoundException: OracleDS not bound
| at org.jnp.server.NamingServer.getBinding(NamingServer.java:514)
| at org.jnp.server.NamingServer.getBinding(NamingServer.java:522)
| at org.jnp.server.NamingServer.getObject(NamingServer.java:528)
| at org.jnp.server.NamingServer.lookup(NamingServer.java:281)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:610)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
| at javax.naming.InitialContext.lookup(InitialContext.java:347)
| at org.foo.bar.db.DataSourceAccess.retrieveDataSource(DataSourceAccess.java:143)
But, just to test out I created another test webapp and tried to get the datasource in a simple JSP page using the same code. It worked. What did I do wrong. I even tried adding resource-ref, resource-env-ref entries to my web.xml. I'm stumped.
Heres my datasource config file
myds-ds.xml
<?xml version="1.0" encoding="UTF-8"?>
| <datasources>
| <local-tx-datasource>
| <jndi-name>MyDS</jndi-name>
| <connection-url>jdbc:oracle:thin:@oradev:1521:dev</connection-url>
| <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
| <user-name>dev</user-name>
| <password>dev</password>
| <exception-sorter-class-name>
| org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter
| </exception-sorter-class-name>
| <min-pool-size>10</min-pool-size>
| <max-pool-size>50</max-pool-size>
| <idle-timeout-minutes>10</idle-timeout-minutes>
| <track-statements>true</track-statements>
| <metadata>
| <type-mapping>Oracle10g</type-mapping>
| </metadata>
| </local-tx-datasource>
| </datasources>
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3966922#3966922
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3966922
19 years, 8 months
[JBossWS] - Re: SOAP over HTTPS?
by DrHok
"DrHok" wrote : I would like to change an existing SOAP interface to a JBoss(4.0.2)-based webservice from HTTP to HTTPS, in order to ensure both privacy and integrity of data.
|
| But how do I do it?
Actually it turned out to be easier than I thought (on JBoss 4.0.2):
1. Uncomment and edit the SSL/TLS Connector section in server/default/deploy/jbossweb-tomcat55.sar/server.xml.
2. Generate a server key pair using keytool, see http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/keytool.html.
3. Export the public key and import it on the client, also using keytool.
Then, if the ws client uses https://server:8443/... instead of http://server:8080/..., SOAP goes over TLS.
The WSDL doesn't need to know about TLS.
Note: I think my description of activating TLS is accurate, but I can't guarantee that it works. I guessed the first two steps by diffing a virgin jboss-4.0.2.zip with a running AS where TLS was activated by someone else. I might have missed some details of the configuration.
"DrHok" wrote : Will this cause a significant delay and load on the AS?
I made a performance comparison between TLS on and off, and surprisingly the effect of TLS is really small.
Neither the response times nor the load on the AS changed much (roughly +10%).
However, the network latency might increase if client and server are further apart in terms of IP hops (I tried up to 3), because sending a SOAP request and receiving a response over TLS requires 6 packet round-trips instead of 3 without TLS.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3966920#3966920
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3966920
19 years, 8 months
[JNDI/Naming/Network] - urgent naming problem
by mummyman
I develope a web application in pc - ip 10.0.92.6 by Jbuilder. This machine also install Jboss server 4.0.4. and have ejb: CheckLogin (session Bean)
Jboss.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 4.0//EN" "http://www.jboss.org/j2ee/dtd/jboss_4_0.dtd">
<enterprise-beans>
<ejb-name>CheckLogin</ejb-name>
<jndi-name>ejb/CheckLogin</jndi-name>
</enterprise-beans>
I have deployed this ejb successfully.
Then i use Jbuilder to build a servlet srvletLogin:
....
System.setProperty("java.naming.factory.url.pkgs",
"org.jnp.interfaces");
System.setProperty("java.naming.factory.initial",
"org.jnp.interfaces.NamingContextFactory");
System.setProperty("java.naming.provider.url", "10.0.92.6:1099");
Context ic = new InitialContext();
Object object = ic.lookup("ejb/CheckLogin");
....
This servlet work fine when run by Jbuilder. Now i build War file contain that servlet and deploy it in tomcat 5.5.17 server ai pc - ip : 10.0.92.116. But now i have error at statement: Object object = ic.lookup("ejb/CheckLogin");
web.xml source:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
<display-name>Web App</display-name>
<servlet-name>jsvllogin</servlet-name>
<servlet-class>Servlet.jsvllogin</servlet-class>
<servlet-mapping>
<servlet-name>jsvllogin</servlet-name>
<url-pattern>/jsvllogin</url-pattern>
</servlet-mapping>
<ejb-ref>
<ejb-ref-name>ejb/CheckLogin</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
TxEjb.CheckLoginHome
TxEjb.CheckLogin
<ejb-link>CheckLogin</ejb-link>
</ejb-ref>
<session-config>
<session-timeout>6000</session-timeout>
</session-config>
</web-app>
Any one can help me?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3966918#3966918
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3966918
19 years, 8 months
[Security & JAAS/JBoss] - explicit authentication via JAAS in a web app
by atamur
1. I don't need declarative security, because our application is ajax based
2. I need JAAS, because I'd like to use it with ejb
3. The only option I see (setting aside some perverse methods including servlets, redirects and j_security_check) is to do login stuff manually.
So, now I'm struggling to implement a method:
void authenticateUser(HttpServletRequest, long userId, String role)
that should bind current user session to some principle with given userId and role. User and password are already tested against DB and authorized. Now I need JAAS to know about this.
As far as I understand, I cannot use stuff like this in a servlet
| LoginContext lc = null;
| lc = new LoginContext("Sample", new MyCallbackHandler());
| lc.login();
Can some one help me?
PS there is a lot of legacy code, so I really cannot use FORM base authentication as my primary method of authentication
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3966917#3966917
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3966917
19 years, 8 months