Re: issue deploying webapp with security realm

2010-05-24 Thread David Jencks
This should work the way you want it to.  I don't see anything wrong with your 
configuration, but my eyes are not an xml validator :-)

Could you see what happens if you put the security realm gbean in the 
geronimo-web.xml?
Also, just for reference could you paste the stack trace you are getting?

There is a configuration change you have to make if you want to use your own 
security realm with (remote) ejb access, but that doesn't sound like your 
situation.

If you can provide a sample app to demonstrate the problem that would be very 
helpful.

thanks
david jencks

On May 24, 2010, at 1:54 AM, ttiurani wrote:

> 
> Hi,
> 
> I am getting the same error with geronimo 2.2, but there does not seem to be
> any way around my problem. I am trying to deploy my application with one
> .ear-file and use a custom security realm that is created with
> geronimo-application.xml and referenced in geronimo-web.xml. This does not
> seem to be possible anymore with Geronimo 2.2.
> 
> geronimo-application.xml has this:
> 
>  class="org.apache.geronimo.security.realm.GenericSecurityRealm"
>   xsi:type="dep:gbeanType"
>   xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2";
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
>   MySecurityRealm
>   
>   ServerInfo
>   
>   
>xmlns:log="http://geronimo.apache.org/xml/ns/loginconfig-2.0";>
>  wrap-principals="false">
>   
>   MySecurityRealm
>   
>   
> org.test.MySecurityRealmLoginModule
>   
>   
>   
>   
>   
> 
> and geronimo-web.xml inside the same .ear tries to reference the realm with
> this:
> 
>MySecurityRealm
> 
> Now this has worked nicely with Geronimo 2.0.1 -> 2.1.3 (I'm guessing it
> works for 2.1.4 and 2.1.5 as well) but it fails with 2.2 with the same stack
> trace as in the first message. I'm guessing the problem is this that by the
> time geronimo-web.xml is evaluated during deployment, the custom security
> realm from geronimo-application.xml is not either created yet or then there
> is some kind of class loader problem.
> 
> I've tried every kind of combination of geronimo-application.xml and
> geronimo-web.xml and am quite confident the problem is not a simple
> configuration typo or lack of  tags.
> 
> I believe it is possible to do this in two separete deployments, where I
> would first deploy the custom security realm alone to Geronimo and then
> reference it in a separeate .ear containing a geronimo-web.xml with a
> dependency to something like this:
> 
>   
>  org.test
>  security
>  1.0
>  car
>
> 
> The unfortunate thing is, this approach complicates my development so
> significantly, it is out of the question.
> 
> Is it possible to create and reference a custom login module inside a single
> .ear with Geronimo 2.2? If not, is this possiblity removed from 2.2 on
> purpose, or is it a bug that wil be fixed in later versions?
> 
> Best regards,
> Timo Tiuraniemi
> 
> p.s. This seems to be possible in JBoss
> (http://community.jboss.org/thread/145856).
> -- 
> View this message in context: 
> http://apache-geronimo.328035.n3.nabble.com/issue-deploying-webapp-with-security-realm-tp334180p839216.html
> Sent from the Users mailing list archive at Nabble.com.



ApacheCon 2010: Technical Talks CFP

2010-05-24 Thread Kevan Miller
Geronimo Community,
Reminder of the Call For Participation for ApacheCon North America 2010: 
https://blogs.apache.org/foundation/entry/call_for_participation_technical_talks

Submissions are due Friday, May 28 by midnight PDT.

--kevan

Re: EJB in Apache Geronimo : Java client invokation

2010-05-24 Thread zecas


Shawn J wrote:
> 
> The provide url should be like this:
> 
> props.setProperty("java.naming.provider.url", "ejbd:"+hostName+":"+port);
> 
> -- 
> Shawn
> 
> 


I thought that too, but in that case I receive:

24/Mai/2010 16:00:33 org.apache.openejb.client.StickyConnectionStrategy
connect
WARNING: Failover: Cannot connect to server(s): ejbd://ejbd:localhost:4201
Exception: Cannot  connect to server: 'ejbd://ejbd:localhost:4201' due to an
unkown exception in the OpenEJB client: java.lang.IllegalArgumentException :
port out of range:-1.  Trying next.
javax.naming.NamingException: Cannot lookup '/TaskBean/remote'. [Root
exception is java.rmi.RemoteException: Unable to connect; nested exception
is: 
java.rmi.RemoteException: Cannot connect to any servers: Server #0:
ejbd://ejbd:localhost:4201]
at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:224)
at javax.naming.InitialContext.lookup(InitialContext.java:392)

It seems it automatically adds that "ejbd://" prefix. Changed to:

props.setProperty("java.naming.provider.url", "ejbd://"+hostName+":"+port);

Will give the same error as before:

java.lang.RuntimeException: Invalid response from server: -1
at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:277)
at javax.naming.InitialContext.lookup(InitialContext.java:392)


In the meantime, I found the following error on Geronimo console:

15:55:13,406 ERROR [remote] "null  OEJ/0.0" FAIL "Unexpected error - For
input string: "/""
java.lang.NumberFormatException: For input string: "/"
at
java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:449)
at java.lang.Integer.parseInt(Integer.java:499)
at
org.apache.openejb.client.ProtocolMetaData.init(ProtocolMetaData.java:56)
at
org.apache.openejb.client.ProtocolMetaData.readExternal(ProtocolMetaData.java:92)
at
org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:103)
at
org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:84)
at
org.apache.openejb.server.ejbd.EjbServer.service(EjbServer.java:60)
at org.apache.openejb.server.ServicePool$2.run(ServicePool.java:78)
at org.apache.openejb.server.ServicePool$3.run(ServicePool.java:101)
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:619)

It appears when receive the "Invalid response from server: -1" on client
side.

Is it required to have an openejb definition file (openejb-jar.xml) on the
EJB so geronimo makes it available to the client apps?


Any help appreciated.


Thanks
-- 
View this message in context: 
http://apache-geronimo.328035.n3.nabble.com/EJB-in-Apache-Geronimo-Java-client-invokation-tp839481p839839.html
Sent from the Users mailing list archive at Nabble.com.


OpenJPA custom dictionary

2010-05-24 Thread Cristian Botiza
Hi,
I've tried using a custom implementation for the DBDictionary OpenJPA 
abstraction.
At deployment I get class not found. The reason seems pretty obvious: the 
custom class is not available to the class loader that deals with OpenJPA in 
Geronimo.

What options do I have? Should I rebuild the OpenJPA Geronimo module to include 
my custom class?
Will this affect other applications on the same server? I've specified the 
custom dictionary class in the application's persistence.xml file.

I'm using Geronimo 2.1.4

Many thanks.


The information in this email is confidential and may be legally privileged. It 
is intended solely for the addressee. Any opinions expressed are mine and do 
not necessarily represent the opinions of the Company. Emails are susceptible 
to interference. If you are not the intended recipient, any disclosure, 
copying, distribution or any action taken or omitted to be taken in reliance on 
it, is strictly prohibited and may be unlawful. If you have received this 
message in error, do not open any attachments but please notify the EndavaIT 
Service Desk on (+44 (0)870 423 0187), and delete this message from your 
system. The sender accepts no responsibility for information, errors or 
omissions in this email, or for its use or misuse, or for any act committed or 
omitted in connection with this communication. If in doubt, please verify the 
authenticity of the contents with the sender. Please rely on your own virus 
checkers as no responsibility is taken by the sender for any damage rising out 
of any bug or virus infection.

Endava Limited is a company registered in England under company number 5722669 
whose registered office is at 125 Old Broad Street, London, EC2N 1AR, United 
Kingdom. Endava Limited is the Endava group holding company and does not 
provide any services to clients. Each of Endava Limited and its subsidiaries is 
a separate legal entity and has no liability for another such entity's acts or 
omissions. Please refer to the “Legal” section on our website for a list of 
legal entities.


Re: EJB in Apache Geronimo : Java client invokation

2010-05-24 Thread Shawn Jiang
The provide url should be like this:

props.setProperty("java.naming.provider.url", "ejbd:"+hostName+":"+port);

On Mon, May 24, 2010 at 8:01 PM, zecas  wrote:

>
> Hi,
>
> I'm trying to connect a standalone java client application to an EJB in
> Apache Geronimo, but with no success so far.
>
> It's a starting project so I can learn something about EJB and remote
> invocation, and ... well, I'll put some info and hope someone can put some
> light on the matter.
>
> My Geronimo has the following ports, which are displayed on console, when
> starting up:
>
>
>  Listening on Ports:
>   0 0.0.0.0   Derby Connector
>  80 0.0.0.0   Tomcat Connector HTTP BIO HTTP
>1099 0.0.0.0   RMI Naming
>1150 127.0.0.1 CORBA Naming Service
>2001 127.0.0.1 OpenEJB ORB Adapter
>4201 0.0.0.0   OpenEJB Daemon
>6882 127.0.0.1 OpenEJB ORB Adapter
>8009 0.0.0.0   Tomcat Connector AJP AJP
>8443 0.0.0.0   Tomcat Connector HTTPS BIO HTTPS
> 0.0.0.0   JMX Remoting Connector
>   61613 0.0.0.0   ActiveMQ Transport Connector
>   61616 0.0.0.0   ActiveMQ Transport Connector
>
>
> I'm working with Apache Geronimo 2.1.2, in a windows system, installed
> locally.
>
> My EJB3 has the following definition:
>
>
> @Stateful(name="test-bean", mappedName="test-bean-map")
> public class TestBean implements TestLocal, TestRemote {
>
>public String hello(String user) {
>return "Hello " + user + ", welcome to this EJB!";
>}
>
>public List getList(String user) {
>...
>}
>
> }
>
>
> And the interfaces, which are part of the EJB client JAR:
>
>
> @Remote
> public interface TestRemote {
>
>public String hello(String user);
>
> }
>
> @Local
> public interface TestLocal {
>
>public List getList(String user);
>
> }
>
>
> The EAR has the EJB and a WAR module that successfully injects TestLocal
> and
> uses it.
>
> Now I've started a Java project from scratch, and inside a runnable class
> main method I do something like:
>
>
>String hostName = "localhost";
>String port = "4201";
>
>Properties props = new Properties();
>
>props.setProperty("java.naming.factory.initial",
> "org.openejb.client.RemoteInitialContextFactory");
>props.setProperty("java.naming.provider.url", hostName+":"+port);
> //props.setProperty("java.naming.security.principal", "username");
> //props.setProperty("java.naming.security.credentials", "passwd");
>
>Context ic = null;
>try {
>ic = new InitialContext(props);
>
>// java:comp/env/
>// @Stateful(name="test-bean", mappedName="test-bean-map")
>
>TestRemote testBean = (TestRemote) PortableRemoteObject.narrow(
>ic.lookup("test-bean"),
>TestRemote.class
>);
>
>String result = testBean.hello( "peter" );
>log( result );
>
>} catch(Throwable ex) {
>ex.printStackTrace();
>} finally {
>if( ic!=null ) {
>ic.close();
>}
>}
>
>
> The result:
>
>
> java.lang.RuntimeException: Invalid response from server: -1
>at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:277)
>at javax.naming.InitialContext.lookup(InitialContext.java:392)
>
>
> I've tried using ports 1099, 1150 and 4201, with the same result. Shouldn't
> I use port 4201 0.0.0.0   OpenEJB Daemon?
>
> So what am I missing here?
>
> In apache geronimo, where am I suppose to check the jndi name configured? I
> can't seem to find it ... although it works on the webapp that goes with
> the
> EJB (on the same EAR).
>
> I've deployed the EAR to Geronimo, without any ejb descriptor and no
> geronimo plan descriptor. The EJB uses annotations. But the webapp uses the
> injected EJB dependency, so I assume it is properly configured.
>
> Also, can anyone tell me where I should look for the available EJBs? In
> JBoss I can check a tree of JNDI entries, and the EJB nammings can be found
> there, but in Geronimo I cannot find this EJB name ... I searched in
> console->Debug Views (JMX and JNDI) they both present a tree, but I didn't
> find the EJB entry that was deployed.
>
>
>
> Thanks
> --
> View this message in context:
> http://apache-geronimo.328035.n3.nabble.com/EJB-in-Apache-Geronimo-Java-client-invokation-tp839481p839481.html
> Sent from the Users mailing list archive at Nabble.com.
>



-- 
Shawn


EJB in Apache Geronimo : Java client invokation

2010-05-24 Thread zecas

Hi,

I'm trying to connect a standalone java client application to an EJB in
Apache Geronimo, but with no success so far.

It's a starting project so I can learn something about EJB and remote
invocation, and ... well, I'll put some info and hope someone can put some
light on the matter.

My Geronimo has the following ports, which are displayed on console, when
starting up:


  Listening on Ports:
   0 0.0.0.0   Derby Connector
  80 0.0.0.0   Tomcat Connector HTTP BIO HTTP
1099 0.0.0.0   RMI Naming
1150 127.0.0.1 CORBA Naming Service
2001 127.0.0.1 OpenEJB ORB Adapter
4201 0.0.0.0   OpenEJB Daemon
6882 127.0.0.1 OpenEJB ORB Adapter
8009 0.0.0.0   Tomcat Connector AJP AJP
8443 0.0.0.0   Tomcat Connector HTTPS BIO HTTPS
 0.0.0.0   JMX Remoting Connector
   61613 0.0.0.0   ActiveMQ Transport Connector
   61616 0.0.0.0   ActiveMQ Transport Connector


I'm working with Apache Geronimo 2.1.2, in a windows system, installed
locally.

My EJB3 has the following definition:


@Stateful(name="test-bean", mappedName="test-bean-map")
public class TestBean implements TestLocal, TestRemote {

public String hello(String user) {
return "Hello " + user + ", welcome to this EJB!";
}

public List getList(String user) {
...
}

}


And the interfaces, which are part of the EJB client JAR:


@Remote
public interface TestRemote {

public String hello(String user);

}

@Local
public interface TestLocal {

public List getList(String user);

}


The EAR has the EJB and a WAR module that successfully injects TestLocal and
uses it.

Now I've started a Java project from scratch, and inside a runnable class
main method I do something like:


String hostName = "localhost";
String port = "4201";

Properties props = new Properties();

props.setProperty("java.naming.factory.initial",
"org.openejb.client.RemoteInitialContextFactory");
props.setProperty("java.naming.provider.url", hostName+":"+port);
//props.setProperty("java.naming.security.principal", "username");
//props.setProperty("java.naming.security.credentials", "passwd");

Context ic = null;
try {
ic = new InitialContext(props);

// java:comp/env/
// @Stateful(name="test-bean", mappedName="test-bean-map")

TestRemote testBean = (TestRemote) PortableRemoteObject.narrow(
ic.lookup("test-bean"),
TestRemote.class
);

String result = testBean.hello( "peter" );
log( result );

} catch(Throwable ex) {
ex.printStackTrace();
} finally {
if( ic!=null ) {
ic.close();
}
}


The result:


java.lang.RuntimeException: Invalid response from server: -1
at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:277)
at javax.naming.InitialContext.lookup(InitialContext.java:392)


I've tried using ports 1099, 1150 and 4201, with the same result. Shouldn't
I use port 4201 0.0.0.0   OpenEJB Daemon?

So what am I missing here?

In apache geronimo, where am I suppose to check the jndi name configured? I
can't seem to find it ... although it works on the webapp that goes with the
EJB (on the same EAR).

I've deployed the EAR to Geronimo, without any ejb descriptor and no
geronimo plan descriptor. The EJB uses annotations. But the webapp uses the
injected EJB dependency, so I assume it is properly configured.

Also, can anyone tell me where I should look for the available EJBs? In
JBoss I can check a tree of JNDI entries, and the EJB nammings can be found
there, but in Geronimo I cannot find this EJB name ... I searched in
console->Debug Views (JMX and JNDI) they both present a tree, but I didn't
find the EJB entry that was deployed.



Thanks
-- 
View this message in context: 
http://apache-geronimo.328035.n3.nabble.com/EJB-in-Apache-Geronimo-Java-client-invokation-tp839481p839481.html
Sent from the Users mailing list archive at Nabble.com.


Re: issue deploying webapp with security realm

2010-05-24 Thread ttiurani

Hi,

I am getting the same error with geronimo 2.2, but there does not seem to be
any way around my problem. I am trying to deploy my application with one
.ear-file and use a custom security realm that is created with
geronimo-application.xml and referenced in geronimo-web.xml. This does not
seem to be possible anymore with Geronimo 2.2.

geronimo-application.xml has this:

   http://geronimo.apache.org/xml/ns/deployment-1.2";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
MySecurityRealm

ServerInfo


http://geronimo.apache.org/xml/ns/loginconfig-2.0";>


MySecurityRealm


 org.test.MySecurityRealmLoginModule






and geronimo-web.xml inside the same .ear tries to reference the realm with
this:

MySecurityRealm

Now this has worked nicely with Geronimo 2.0.1 -> 2.1.3 (I'm guessing it
works for 2.1.4 and 2.1.5 as well) but it fails with 2.2 with the same stack
trace as in the first message. I'm guessing the problem is this that by the
time geronimo-web.xml is evaluated during deployment, the custom security
realm from geronimo-application.xml is not either created yet or then there
is some kind of class loader problem.

I've tried every kind of combination of geronimo-application.xml and
geronimo-web.xml and am quite confident the problem is not a simple
configuration typo or lack of  tags.

I believe it is possible to do this in two separete deployments, where I
would first deploy the custom security realm alone to Geronimo and then
reference it in a separeate .ear containing a geronimo-web.xml with a
dependency to something like this:

   
  org.test
  security
  1.0
  car


The unfortunate thing is, this approach complicates my development so
significantly, it is out of the question.

Is it possible to create and reference a custom login module inside a single
.ear with Geronimo 2.2? If not, is this possiblity removed from 2.2 on
purpose, or is it a bug that wil be fixed in later versions?

Best regards,
Timo Tiuraniemi

p.s. This seems to be possible in JBoss
(http://community.jboss.org/thread/145856).
-- 
View this message in context: 
http://apache-geronimo.328035.n3.nabble.com/issue-deploying-webapp-with-security-realm-tp334180p839216.html
Sent from the Users mailing list archive at Nabble.com.