Hi guys, I join a programming competition that requires participant to use JBOSS platform. Do you guys have any recommendation on what books or articles I could use?
This seems like it should be easy to do, but I just can make it work. I'm hooked on the convention plugin in Struts 2.1. However, I need to define some package-level configuration such as a new interceptor stack and exception mappings. I'd like to use the struts.xml file for this, but I can't get the convention-based packages matched to the struts.xml packages. My struts.xml looks like:
<struts>
<constant name="struts.convention.default.parent.package" value="default"/>
<package name="default" extends="struts-default">
</package>
<package name="root" namespace="/" extends="struts-default">
<action name="index">
<result>/index.jsp</result>
</action>
</package>
<package name="my.package.actions.myaccount" namespace="/myaccount" extends="struts-default">
<interceptors>
<interceptor name="authenticationInterceptor" class="my.package.interceptors.AuthenticationInterceptor"/>
<interceptor-stack name="secureStack">
<interceptor-ref name="authenticationInterceptor"/>
<interceptor-ref name="defaultStack"/>
</interceptor-stack>
</interceptors>
<default-interceptor-ref name="secureStack"/>
</package>
</struts>
I have my interceptor in:
/src/my/package/interceptors
and my actions in:
/src/my/package/actions/myaccount
Hi all,
I am working on a Spring application and trying to get my URL mapping correct. What I would like to have work is the following:
http://localhost:8080/idptest -> doesn't work
But instead, I have to reference the context name in my URL in order to resolve the mapping:
http://localhost:8080/<context_name>/idptest -> works
How can I avoid the requirement of referencing the context name in my URL without using a rewrite/proxy engine e.g. Apache?
Here is the servlet definition and mapping from my web.xml:
<servlet>
<servlet-name>idptest</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/conf/idptest.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>idptest</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
Here's the outline of my controller (showing annotations for request mappings):
@Controller
@RequestMapping("/idptest")
public class MyController {
@RequestMapping(method=RequestMethod.GET)
public String setupForm(Model model){
MyObject someObject = new MyObject();
model.addAttribute("someObject", someObject);
return "myform";
}
@RequestMapping(method = RequestMethod.POST)
public String processSubmit(@ModelAttribute("someObject") MyObject someObject) throws Exception {
// POST logic...
}
}
Thanks!
I managed to do it with the next code but there must be an easier way.
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<c:if test="${fn:length(attachments) > 0}">
<c:forEach var="attachment" items="${attachments}" varStatus="loopCount">
<c:if test="${loopCount.count eq 1}">
attachment.id
</c:if>
</c:forEach>
</c:if>
I am having some problems setting up Tomcat for JMX. I added the following properties to
CATALINA_OPTS="-Dcom.sun.management.jmxremote.port=18070 -Dcom.sun.management.jmxremote.password.file=$CATALINA_BASE/conf/jmxremote.password -Dcom.sun
.management.jmxremote.ssl=false"
And have added the jmxremote.password file in to the conf directory. I wrote a client tool that connects to the JMX server running on port 18070. When i run the client program i get the following error.
Exception in thread "main" java.lang.SecurityException: Authentication failed! Credentials required
at com.sun.jmx.remote.security.JMXPluggableAuthenticator.authenticationFailure(JMXPluggableAuthenticator.java:193)
at com.sun.jmx.remote.security.JMXPluggableAuthenticator.authenticate(JMXPluggableAuthenticator.java:145)
at sun.management.jmxremote.ConnectorBootstrap$AccessFileCheckerAuthenticator.authenticate(ConnectorBootstrap.java:185)
at javax.management.remote.rmi.RMIServerImpl.doNewClient(RMIServerImpl.java:213)
at javax.management.remote.rmi.RMIServerImpl.newClient(RMIServerImpl.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
at sun.rmi.transport.Transport$1.run(Transport.java:159)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142)
at javax.management.remote.rmi.RMIServerImpl_Stub.newClient(Unknown Source)
at javax.management.remote.rmi.RMIConnector.getConnection(RMIConnector.java:2312)
at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:277)
at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:248)
at com.bt.c21sc.c21tkprobe.accessors.C21TkProbeJmxDAO.connect(Unknown Source)
at com.bt.c21sc.c21tkprobe.service.C21TkProbeBD.execute(Unknown Source)
at com.bt.c21sc.c21tkprobe.C21AppserverProbe.main(Unknown Source)
If i change the CATALINA_OPTS properties to
CATALINA_OPTS="-Dcom.sun.management.jmxremote.port=18070 -Dcom.sun.management.jmxremote.password.file=$CATALINA_BASE/conf/jmxremote.password -Dcom.sun
.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"
Then it works fine. I think what i am confused of is what is classed as remote access. I am running the client program away from the Tomcat instance but both Tomcat and the client tool are on the same machine (i.e. different virtual machines but same environemnt). I thought i had to configure the remote authentication if i access the JMX server remotely from a different machine.
By remote access do they mean accessing the JMX server from any VM either locally or remotely?
I'm currently developing a library for monitoring calls to several remote services (WebServices, EJBs...).
One of the parameters that i would like to register is the port from which a EJB is called (a Stateless Session Bean invoked like a remote object)
There is any standarised way of getting the port? Or should I inspect the JNDI tree for this kind of information?
I'm using the EJB 2.1 spec, but it's also posible for me to use EJB 3
I'm currently trying to get into the Java EE development with the Spring framework. As I'm new to Spring, it is hard to imaging how a good running project should start off.
Do you have any best practices, tipps or major DO NOTs for a starter? How did you start with Spring - big project or small tutorial-like applications? Which technology did you use right away: AOP, complex Hibernate...
Basically I'm trying to proxy some webservices locally (for reasons I won't go into now) and then have a Java application call it.
I'm looking at BlazeDS since it seems to do just this, mostly to avoid the crossDomain.xml file required by Flex to call webservices. However I can't seem to find any reference on how to connect through a Java client (probably using Axis2).
Any suggestions, and especially tutorials, would be greatly appreciated.
I want to know the differences/similarities between Hibernate and simple persistence in J5EE?
I'm not clear if Hibernate implements J5EE persistence implementation or if it is a totally different approach to data representation over back-end systems.
Also, I want to know other approaches (frameworks) like JPA or Spring...
Thanks
We are having some difficulties connecting our Java SE standalone client with the EJB module deployed on a remote GlassFish server.
Pointers to how we are supposed to connect our client would be appreciated.
The client code we currently has to get the initial context:
props.setProperty("org.omg.CORBA.ORBInitialHost", "*remotehost*");
props.setProperty("org.omg.CORBA.ORBInitialPort", "portNumber");
javax.naming.InitialContext ic = new javax.naming.InitialContext(props);
*We have tried several different port numbers; 3700, 7676, 8080..
The closest we are getting, got us the error: "Error in GIOP magic".
I read that jms are using port 7676 as a broker port for a bunch of dynamically generated ports, but can't figure out how to specify those ports in order to create proper port-forwards.
How to convert doc to pdf using java api. where document contains various formats such as tables in ms word. when converting to pdf using iText. where actual document looks different to converted pdf. please provide any api not an exe installed for converting . must be an open source
Right now for my ConversionPattern I have:
log4j.appender.A1.layout.ConversionPattern=%d{yyyy MMM dd HH:mm:ss,SSS} %5p [%t] (%F:%L) - %m%n
What I'd like to do is also include the full package name with the class (%F:%L) but I can't find any config to do so in the docs. I do understand that this will be slower, but it's only for debugging and not when the system will be in production.
I am curious learner of Java, I was thinking on one topic "CONSTANTS"
I have learnt that Java allows us to declare constants by using "Final" keyword.
My question is Java didnot introduce Constant(Const) Keyword. Since many people say it has come from C++, in C++ we have Const keyword
Is there any strong reason behind, Please share your thoughts on this.
I am writing a filter that will handle all authentication related tasks. My filter is a standard servlet filter as shown below
@Override
public void doFilter(ServletRequest req, ServletResponse res,
FilterChain chain) throws IOException, ServletException {
UserSession attribute = (UserSession)request.getSession().getAttribute("user_session_key");
if(attribute!=null && attribute.isValid())
{
//proceed as usual,
chain.doFilter(req, res);
return;
}
else
{
//means the user is not authenticated, so we must redirect him/her to the login page
((HttpServletResponse)res).sendRedirect("loginpage");
return;
}
}
But when I do this, I get an IllegalStateException thrown by Tomcat's ResponseFacade. How do I acheive this in a filter. I read in other SO threads that in TOmcat this is a problem as the response object is already commited. How do I get past this ?
My organization previously used ASP.NET for web projects.
They are now migrating to WebLogic Portal/JEE for all future web projects.
My experience as a Lead Developer / Architect is totally with .NET projects. I want to get ramped up on WebLogic/JEE, so I can contribute to future projects.
Any training/certification suggestions for WebLogic/JEE, in a 6-month time frame?
Assume that I will need to fund my own training, and I am working full time. So, money and time are limited.
While from version 5 on, Java provides many extremely useful features like annotations, enums, generics, etc., 1.4 is still in use in many enterprise projects. So I'm wondering what the chances are that you still have to work with 1.4, thus being forced to go without JPA, EJB3 etc. In your answer, please also state the branch of company you work for. Which are the reasons for not switching to Java 5?
Thanks,
Armin
Hi ,
After I do a JNDI look up , what I get is a reference to the Home of EJB Object.
But when I do an API call on Home/Remote , how does it find the URL/port of the server ?
Thanks
J
Hi,
I am using the hibernate increment strategy to create my IDs on my entities.
@GenericGenerator(name="increment-strategy", strategy="increment")
@Id @GeneratedValue(generator="increment=strategy")
@Column(name="HDR_ID", unique=true, nullable=false)
public int getHdrId(){
return this.hdrId;
}
The entity has the following table annotation
@Table(name = "PORDER.PUB.PO_HEADER", schema = "UVOSi", catalog = "VIRT_UVOS")
Please note I have two datasources.
When I try to insert an entity Hibernate creates the following SQL statement:
select max(hdr_id) from PORDER.PUB.PO_HEADER
which causes the following error: Group specified is ambiguous, resubmit the query by fully qualifying group name.
When I create a query by hand with entityManager.createQuery()
hibernate uses the fully qualified name
select XXX from VIRT_UVOS.UVOSi.PORDER.PUB.PO_HEADER
and that works fine.
So how do I get Hibernate to use the fully qualified name in the Id autogeneration?
Btw. I am using Hibernate 3.2 and Seam 2.2 running on JBoss 4.2.3
Regards
Immo
Hi All,
I am a C# programmer. I want to learn Java to implement my windows application. But I don't know what IDE and what tools can help me.
Please help me to choose best platform and IDE and other tools.
Edit:
Thank You For Your Helping. And What is Best Ebooks and UserGuids to Learn java.
Hi I have host web application which is developed using java and jsp. In client side each client give five ajax calls to the server to retrieve data from the server in every 30 seconds.
My problem is can one user who use one browser to log in to the system have multiple session at a time. Reason is when i use the tool to use monitor the firewall I can see more than 10 sessions are active for one IP. How this can happen? any comments
Hello,
I'm planning to do a heap dump with jmap jdk1.5 tool on a production weblogic (10) instance.
Actually there are 3 EAR (perhaps more, don't really know i don't have access) deployed on this weblogic instance.
Someone told me "weblogic creates a JVM for each EAR"
Can someone confirm this?
With jmap i need the jvm pid as parameter to do the heap dump...
Since i have 3 EAR i guess i have 3 pid so i wonder how to know which pid correspond to which EAR JVM?
im new to java ee platform and im having a hard time searching for a book for java ee that uses eclipse IDE. So please can you tell me any book that involves java ee and eclipse for beginners. and some tips from you how to learn this stuff and a follow up question, is java EE still good 20 years from now?