[Persistence, JBoss/CMP, Hibernate, Database] - JBoss 4.2.0, hibernate annotations being picked up
by pixel
Hi,
I am trying to set up a new project using hibernate annotations instead of mapping files. I am running JBoss 4.2.0-GA.
My hibernate-service.xml looks like
| <server>
| <mbean code="org.jboss.hibernate.jmx.Hibernate"
| name="jboss.har:service=HibernateHCE">
| <attribute name="DatasourceName">java:/DefaultDS</attribute>
| <attribute name="Dialect">
| org.hibernate.dialect.OracleDialect
| </attribute>
| <attribute name="SessionFactoryName">
| java:/hibernate/SessionFactory
| </attribute>
| <attribute name="CacheProviderClass">
| org.hibernate.cache.HashtableCacheProvider
| </attribute>
| <attribute name="ShowSqlEnabled">true</attribute>
| </mbean>
| </server>
|
and an example entity looks like
| @Entity
| @Table( name="NETWORKS" )
| @NamedQuery( name="getNetworks", query="from Network" )
| public class Network {
|
| private Long id;
| private String name;
| private Country country;
|
| @Id
| @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="NETWORKS_PK_SEQ")
| @Column(name="PK_NETWORK_ID")
| public Long getId() {
| return id;
| }
| public void setId( Long _id ) {
| id = _id;
| }
|
|
| @ManyToOne( fetch=FetchType.LAZY )
| @Column(name="FK_COUNTRY_ID")
| public Country getCountry() {
| return country;
| }
| void setCountry( Country _country ) {
| country = _country;
| }
|
|
| @Column(name="NETWORK_NAME", unique=true)
| public String getName() {
| return name;
| }
| void setName( String _name ) {
| name = _name;
| }
|
| }
|
I am getting the session factory by
(SessionFactory) new InitialContext().lookup( "java:/hibernate/SessionFactory" );
But it doesn't appear to be seeing the annotated files. Running session.createQuery( "from Network" ).list() gives Network is not mapped [from Network] ???
Am I missing something? I found a reference to using
new AnnotationConfiguration().buildSessionFactory() - but isn't it better to get the factory from the lookup?
Thanks in advance,
pixel
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4134876#4134876
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4134876
18 years, 1 month
[JBossWS] - Problems getting client to work
by Fugee47
i got a standalone java-client working:
package simpleclient;
import javax.xml.ws.WebServiceRef;
import helloservice.endpoint.HelloService;
import helloservice.endpoint.Hello;
public class HelloClient {
@WebServiceRef(wsdlLocation="http://localhost:8080/helloservice/Hello?wsdl")
static HelloService service = new HelloService();
public static void main(String[] args) {
System.out.println("Retrieving the port from the following service: " + service);
Hello port = service.getHelloPort();
System.out.println("Invoking the sayHello operation on the port.");
String name;
if (args.length > 0) {
name = args[0];
} else {
name = "No Name";
}
String response = port.sayHello(name);
System.out.println(response);
}
}
but when i copy the code into a new function and access it from within a jsp-file, i get errors.
package simpleclient;
import javax.xml.ws.WebServiceRef;
import helloservice.endpoint.HelloService;
import helloservice.endpoint.Hello;
public class HelloClient {
@WebServiceRef(wsdlLocation="http://localhost:8080/helloservice/Hello?wsdl")
static HelloService service = new HelloService();
public static String say(String args) {
Hello port = service.getHelloPort();
String name;
if (args != null) {
name = args;
} else {
name = "No Name";
}
String response = port.sayHello(name);
return response;
}
}
ERROR [ServiceDelegateImpl] Cannot create proxy for SEI helloservice.endpoint.Hello from: vfsfile:/opt/jboss-5.0.0.Beta4/server/default/deploy/
11:51:14,647 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
java.lang.IllegalArgumentException: helloservice.endpoint.Hello is not an interface
i dont understand this error, since the standalone client does not complain about helloservice.endpoint.Hello being not an interface
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4134869#4134869
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4134869
18 years, 1 month
[Installation, Configuration & DEPLOYMENT] - Configuration issue
by rvdwalt
Good day
I have 2 machines, QA and Prod where our application reacts differently (the development machines react as the prod machine).
On the 2 machines run the same downloaded version of Sun's JVM 1.6_03, both have the same JBoss 4.2.2 installed. Besides the application specific config files (which the only difference is for the datasource) the only edited file is the run.conf where I've increased the allocated memory. The only difference that I'm aware of between the 2 servers is that the one runs OpenSuse 10.2 and the other Open Suse 10.3
I'm interested where I can have a look at configurations that might be tweakable to try and sort this out.
Our application Runs on Seam so I'm not sure if it's a Seam or a JBoss config that ccan cause it. The basic symptoms is that sometimes the seam conversations appear to time out immediately, Further the QA machine gets an Out of Memory exception.
Any suggestions would be appreciated.
b.t.w. the memory settings are as follows: -Xms512m -Xmx1024m
Thanks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4134868#4134868
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4134868
18 years, 1 month
[Security & JAAS/JBoss] - Re: HTTP Auth & callerPrincipal
by joshd
Ok, my User class implements Principal already. But this part I dont get:
anonymous wrote : [..] Principal interface and instantiate it in your LoginModule. So now your UserObj becomes the type Principal & you are set.
|
My LoginModule extends UserPasswordLoginModul, and I just override initialize (just saying super.initialize and inject my SecurityManagerBean) and getUsersPossword and getRoleSets (both using the manager for retrieving the needed infos). So where to set explicitly the User i.e. the Principal?!
Do I have to implement my own LoginModule completely (initialize, login, commit etc)?
regards, josh
| public class LoomLoginModule extends UsernamePasswordLoginModule
| {
| private mySecurityManager securityManager;
| private User user;
|
| /**
| * initializes superclass context
| */
| public void initialize(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options)
| {
| this.user = new User();
| super.initialize(subject, callbackHandler, sharedState, options);
|
| try
| {
| //..inject my securityManager
| }
| }
|
| /**
| *
| */
| protected Group[] getRoleSets() throws LoginException
| {
| if (user == null)
| throw new LoginException("user " + super.getUsername() + " does not exist");
| return this.securityManager.getRoleSets(user.getId());
| }
|
| /**
| *
| */
| protected String getUsersPassword() throws LoginException
| {
| String[] userInput = {"", ""};
| userInput = super.getUsernameAndPassword();
| this.user = this.securityManager.login(userInput[0], userInput[1]);
| if (user == null)
| throw new LoginException("user " + super.getUsername() + " does not exist");
|
| return userInput[1];
| }
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4134859#4134859
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4134859
18 years, 1 month
[JBoss AOP] - Re: Trying to build AOP from source but isn't getting 3rd pa
by dsmiley
I'm not using 1.5.6 only because it doesn't work with JBoss 3.2, even though its documentation alleges it does (I've made forum posts about this lately). I followed the instructions. 1.3.6 was really close, however. It just seemed to be the rename of UnifiedClassLoader.clearBlackList(). Earlier 1.3 series suffered from the same problem. So I got the 1.3 branch (which represents development after 1.3.6 was released AFAIK), couldn't build it as-is, but I was able to pluck the relevant source out of it to build it myself (with my IDE, not the JBoss ant scripts). It was a bitch to build because the codebase was targeted at two different JBoss's. It seemed to work okay. So... if AOP 1.5.6 doesn't actually run on AS 3.2, don't claim it does in the documentation because you're leading people down a dead-end street. Remove it or make it actually work in AS 3.2.
Any way, this is somewhat water under the bridge at this point because I convinced the production administrators I work with to go with JBoss 4... though that brings up other hurdles for me (out of scope of AOP).
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4134857#4134857
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4134857
18 years, 1 month