Anibal Gimenez Canicoba

Greenhorn
+ Follow
since Oct 31, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Anibal Gimenez Canicoba

I found a solution.

I had to remove the default_schema from my persistence.xml file and generate the model again. Now, the entities are generated on the public schema and the schema specification before the entity ( [my_schema].[my_entity] ) is not needed anymore.

It is not the ideal solution and of course the original question remains open.

Cheers
Hi,
My Application is using Hibernate as JPA implementation provider. When I try to persist a bean using the Entity Manager, I'm having a JDBC ERROR saying that the entity doesn't exist in postgresql. Due I have show_sql on true I saw the following query: "insert into my_entity.....", so I went to pgAdmin and tried to run the same query and had an error, then put the schema name before the entity and it worked. query: "insert into my_schema.my_entity....."

After some googling I found the "default_schema" prameter for the persistence.xml cofiguration file. I tried that without success.
Is there any way to include the scema on the queries?

Thanks!
Anibal
Hi Everybody,

I'm getting a 401 when I send a Kerberos Token(X509) into a SOAP envelope. Someone said that I should disable the SPNEGO login on the server, but, I have no idea how to do that. The server is JBOSS.

An example might be more than helpful :-)
15 years ago
Thanks for your help!!!

The problem was that hibernate makes the inserts to links table at commit time!!! I was closing the session without commit!!!

sounds stupid, I've known, but maybe I could help to anyone with that information.
Sorry, but now, I figured out what you trying to ask me, again, the answer is yes. After get the student or assignment bean the set attribute that has a reference to the other bean should be filled and not return empty.
Yes the @ManyToOne annotation is setted in both beans, but Student is the owner.
Does it your question?
As the subject says, I've a got problem when I try to save an entity with @ManyToMany annotation. The main problem is that the save operation is not saving the link Table(but makes an insert in both entities<cascade=CascadeType.All> .
To figure out the the problem, there are the beans with them annotations.


Assignment.java:

package test.bean.school;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;

@Entity
public class Assignment {

private int id;
private String description;
private Set<Student> students = new HashSet<Student>();

public String getDescription() {
return description;
}

public void setDescription(String description) {
this.description = description;
}

@Id
@GeneratedValue
public int getId() {
return id;
}

public void setId(int id) {
this.id = id;
}

@ManyToMany(cascade=CascadeType.ALL, fetch = FetchType.EAGER)
@JoinTable(name="Assignment_Student",
joinColumns={@JoinColumn(name="students_id")},
inverseJoinColumns={@JoinColumn(name="assignments_id")})
public Set<Student> getStudents() {
return students;
}

public void setStudents(Set<Student> students) {
this.students = students;
}

public int hashCode(){
return this.description.hashCode();
}

public boolean equals(Object object){
if (object instanceof Assignment){
return this.description.equals(((Assignment)object).getDescription());
}
return false;
}
}

Student.java :

package test.bean.school;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;

@Entity
public class Student {
private int id;
private String name;
private Set<Assignment> assignments = new HashSet<Assignment>();

@ManyToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER , mappedBy="students")
@JoinTable( name="Assignment_Student",
joinColumns={@JoinColumn(name="assignments_id")},
inverseJoinColumns={@JoinColumn(name="students_id")} )
public Set<Assignment> getAssignments() {
return assignments;
}

public void setAssignments(Set<Assignment> assignments) {
this.assignments = assignments;
}

@Id
@GeneratedValue
public int getId() {
return id;
}

public void setId(int id) {
this.id = id;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public int hashCode(){
return this.name.hashCode();
}

public boolean equals(Object object){
if (object instanceof Student){
return this.name.equals(((Student)object).getName());
}
return false;
}
}


... compiles fine and without exceptions at runtime, but, when I try to get the beans from the database, the set attribute in each bean is empty.

Please, help me!!!
Please help!!! if anybody have usefull information let me know it!!!
Thx
18 years ago
Hi I'm new in The WebLogic Application Server and I would like to know where is the default location for libraries provided by user. I've got libraries to share with another ear's but I don't want to put the same library in each deployed ear.

In Jboss I put these user libraries on {JBOSS_HOME}/server/default/lib

Any Idea?

thanks in advance
18 years ago
I've got some troubles configuring Axis with SunOne 8.0.
I was following the guide from:

http://access1.sun.com/techarticles/using_axis.html
18 years ago
I'm trying to get a class from a jar inside of an ear file(Always from an Ejb), but I get ClassNotFoundException... Wich is the right way to do that?

I'm trying with this:

Class c1 = Class.forName("com.product.MyClass", true,
ClassLoader.getSystemClassLoader());

"MyClass" is inside of a jar and the jar inside the ear.

any idea?
Hi, I'm using rmi-iiop, I did two jar and in one of them I put all the classes relationated with the client (Bean_Stub + BeanInterface) and in the other with the server stuff.
At the begining I used the ORB default that J2SE provides, and I had not problems with that... Start the ORB, Start the server(binding my bean) and on the client I did lookup and I got the Bean_Stup object. Basically a happy story...

But...
When I tried to use de Java Naming Service of JBoss I've gotten the sad exception "javax.naming.CommunicationException [Root exception is java.lang.ClassNotFoundException: adss.iiop.RemoteTestAgent (no security manager: RMI class loader disabled)]" with this Context configuration:

-Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -Djava.naming.provider.url=jnp://10.0.0.40:1099

Ok I said, is a problem with the security, so I tried with that:

-Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -Djava.naming.provider.url=jnp://10.0.0.40:1099
-Djava.security.manager
-Djava.security.policy="server.policy"

Uff another exception but in this case:
javax.naming.CommunicationException: Could not obtain connection to any of these urls: 10.0.0.40:1099 and discovery failed with error: java.security.AccessControlException: access denied (java.net.SocketPermission 230.0.0.4 connect,accept,resolve) [Root exception is javax.naming.CommunicationException: Failed to connect to server 10.0.0.40:1099 [Root exception is java.security.AccessControlException: access denied (java.net.SocketPermission 10.0.0.40:1099 connect,resolve)]]

Any idea?
18 years ago
You right, the right tag should be <res-type>com.mycompany.MyBean</res-type>, but I don't want to publish an EJB, I want to work with RMI-iiop, I created a simple bean whith its stub and skeleton(rmic) and I would like to let it available like a resource in the simple RMI registry but in an app. server.
I heard or read in some place that this is possible(publish as a resource).

Any idea?


18 years ago
I created a new resource on my jboss and I was trying to get the reference through JNDI, but I got some error when tryied do that.

1_ I declared on jboss-web.xml of my app this:
<?xml version="1.0" encoding="UTF-8" ?>
<jboss-web>
<resource-ref>
<res-ref-name>bean/MyBeanFactory</res-ref-name>
<res-type>com.mycompany.MyBean_Stub</res-type>
<jndi-name>java:bean/MyBeanFactory</jndi-name>
</resource-ref>
</jboss-web>

2_ the web.xml file:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<web-app>
<display-name>Bean Test</display-name>
<description>Just a bean test</description>
<resource-ref>
<res-ref-name>bean/MyBeanFactory</res-ref-name>
<res-type>com.mycompany.MyBean_Stub</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</web-app>

3_ In the client app I did this:
String sInitialContextFactory = "org.jnp.interfaces.NamingContextFactory";
String sProviderUrl = "jnp://localhost:1099";
String sInterface = "org.jboss.naming rg.jnp.interfaces";

Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, sInitialContextFactory);
env.put(Context.PROVIDER_URL, sProviderUrl);
env.put(Context.URL_PKG_PREFIXES, sInterface);

Context initialContext = new InitialContext(env);
Object obj = initialContext.lookup("/bean/MyBeanFactory");

---------------------------------------------------------------

I get the following exception.

Exception in thread "main" javax.naming.NameNotFoundException: bean 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:252)
at sun.reflect.GeneratedMethodAccessor124.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:610)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
at javax.naming.InitialContext.lookup(Unknown Source)
at com.mycompany.BeanClient.main(BeanClient.java:41)


------------**************----------------

Tired of try that, I did other thing, I made a lookup to "java:comp" and I got the same exception "comp not bound"

Any Idea? I think is something related with the Naming context.

Is this the right step to registry a resource?



Anibal
18 years ago